fission-page.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  7. <link rel="stylesheet" href="css/weui.min.css"/>
  8. <link rel="stylesheet" href="css/weuix.min.css"/>
  9. <link rel="stylesheet" href="css/style.css?vision=1.11">
  10. <script src="js/md5.js"></script>
  11. <script src="js/vue.min.js"></script>
  12. <script src="js/zepto.min.js"></script>
  13. <script src="js/zepto.weui.min.js"></script>
  14. <script src="js/php.js"></script>
  15. <script src="js/axios.min.js"></script>
  16. <script src="js/weChatSdk.js"></script>
  17. </head>
  18. <body>
  19. <div id="myApp" class="bg-box">
  20. <img alt="" class="headImg-box" :src=headSrc>
  21. <div class="content-box">
  22. <img alt="" :src=contentSrc />
  23. </div>
  24. <div class="num-box">
  25. 已有 <span style="color: #A4404E">{{num}}</span> 人领取成功
  26. </div>
  27. <!--<img class="get-btn-box" src="image/get-free.gif" alt="" onclick="isfollowqr('http://open.weixin.qq.com/qr/code?username=hszuqiu')" />-->
  28. <div class="download-box">
  29. <img class="get-btn-box" src="image/get-free.gif" alt="" @click="goWeChat" v-if="shareCount < 3" />
  30. <div v-else>
  31. <div>
  32. <span>第一步.</span>
  33. <span>复制提取码</span>
  34. <span>qaki</span>
  35. <button>复制</button>
  36. </div>
  37. <div>
  38. <span>第二步.</span>
  39. <span>下载地址:</span>
  40. <span>qaki</span>
  41. </div>
  42. <div>
  43. 【温馨提示】不建议购买网盘会员,由于文件过大,请保存后在电脑上打开网盘,先下载到本地电脑,再解压!
  44. </div>
  45. </div>
  46. </div>
  47. <div class="modal-share" v-show="isShareFlag">
  48. <div class="share-content">
  49. <p>为了帮助更多的家庭</p>
  50. <p>点击菜单<span>“发送给朋友”</span></p>
  51. <p>分享到<span>{{this.shareCount}}个</span>家长群或特教群</p>
  52. <p>分享成功后即可学习!</p>
  53. </div>
  54. <footer class="share-footer">知道了</footer>
  55. </div>
  56. </div>
  57. </body>
  58. <script>
  59. const apiUrl = 'http://fission.xazhima.com/api/api.php';
  60. new Vue({
  61. el:'#myApp',
  62. data:{
  63. num:52255,
  64. headSrc:'image/headImg.png',
  65. contentSrc:"image/content-bg.png",
  66. weChatCode:'',
  67. isFollow:'0',
  68. openId:'',
  69. shareCount:0,
  70. isShareFlag:false
  71. },
  72. methods:{
  73. goWeChat(){
  74. if(this.isFollow === '0'){
  75. location.href = 'http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzUzOTcwMjM0OQ==#wechat_webview_type=1&wechat_redirect'
  76. }
  77. else {
  78. console.log('show share modal');
  79. this.isShareFlag = true;
  80. }
  81. },
  82. subStrUrlCode: function () {
  83. let weChatCodeUrl = location.search; //获取url中"?"符后的字符串
  84. let theRequest = {};
  85. if (weChatCodeUrl.indexOf("?") !== -1) {
  86. let str = weChatCodeUrl.substr(1);
  87. let strS = str.split("&");
  88. for(let i = 0; i < strS.length; i ++) {
  89. theRequest[strS[i].split("=")[0]]=(strS[i].split("=")[1]);
  90. }
  91. }
  92. console.log(theRequest);
  93. return theRequest.code;
  94. },
  95. judgeLogin(){
  96. axios({
  97. method: 'post', //请求方式 有常用的有get post等
  98. url: apiUrl, //请求地址
  99. data: {
  100. method: 'login',
  101. timestamp: 11111111,
  102. sign:md5('login'+'11111111')
  103. }, //代表传过去的参数对象,
  104. transformRequest: [function(data) {
  105. let ret = '';
  106. for (let it in data) {
  107. ret += encodeURIComponent(it) + '=' +
  108. encodeURIComponent(data[it]) + '&'
  109. }
  110. return ret
  111. }], //将传参修改为formData格式 注释则为JSON格式
  112. }).then(function(rs) {
  113. if(rs.data.code === 200) {
  114. window.location.href = rs.data.msg;
  115. console.log(rs.data)
  116. }else {
  117. alert(rs.data.msg)
  118. }
  119. }).catch(function(e) {
  120. console.log(e);
  121. });
  122. },
  123. setWxConfig(param){
  124. wx.config({
  125. debug: false,
  126. appId: param.appId,
  127. timestamp: param.timestamp ,
  128. nonceStr : param.nonceStr,
  129. signature: param.signature,
  130. jsApiList: [
  131. 'imagePreview', 'chooseImage', 'uploadImage','onMenuShareAppMessage'
  132. ]
  133. });
  134. wx.onMenuShareAppMessage({
  135. title: '语言训练认知图片大全', // 分享标题
  136. desc: '已有239218领取成功', // 分享描述
  137. link: '', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
  138. imgUrl: this.headSrc, // 分享图标
  139. type: 'link', // 分享类型:music | video | link,默认为:link
  140. dataUrl: '', // 如果type为:music | video,则要提供数据,默认为:空
  141. success: function(){
  142. console.log('share success')
  143. },
  144. cancel: function(){
  145. console.log('share cancel')
  146. },
  147. })
  148. },
  149. sendCodeRequest(){
  150. let that = this , jsUrl = location.href.split('#')[0];
  151. axios({
  152. method: 'post', //请求方式 有常用的有get post等
  153. url: apiUrl, //请求地址
  154. data: {
  155. method: 'wxinfo',
  156. timestamp: 11111111,
  157. code:that.weChatCode,
  158. jsUrl:jsUrl,
  159. sign:md5('wxinfo'+'11111111')
  160. }, //代表传过去的参数对象,
  161. transformRequest: [function(data) {
  162. let ret = '';
  163. for (let it in data) {
  164. ret += encodeURIComponent(it) + '=' +
  165. encodeURIComponent(data[it]) + '&'
  166. }
  167. return ret
  168. }], //将传参修改为formData格式 注释则为JSON格式
  169. }).then(function(rs) {
  170. if(rs.data.code === 200) {
  171. that.setWxConfig(rs.data.msg.js_sign);
  172. that.headSrc = rs.data.msg.headimgurl;
  173. that.isFollow = rs.data.msg.subscribe;
  174. that.openId = rs.data.msg.openid;
  175. }else {
  176. alert(rs.data.msg)
  177. }
  178. }).catch(function(e) {
  179. console.log(e);
  180. });
  181. },
  182. addCountRequest(){
  183. axios({
  184. method: 'post', //请求方式 有常用的有get post等
  185. url: apiUrl, //请求地址
  186. data: {
  187. method: 'addcount',
  188. timestamp: 11111111,
  189. openid:this.openId,
  190. sign:md5('addcount'+'11111111')
  191. }, //代表传过去的参数对象,
  192. transformRequest: [function(data) {
  193. let ret = '';
  194. for (let it in data) {
  195. ret += encodeURIComponent(it) + '=' +
  196. encodeURIComponent(data[it]) + '&'
  197. }
  198. return ret
  199. }], //将传参修改为formData格式 注释则为JSON格式
  200. }).then(function(rs) {
  201. if(rs.data.code === 200) {
  202. this.shareCount = Number(rs.data.msg.count)
  203. }else {
  204. alert(rs.data.msg)
  205. }
  206. }).catch(function(e) {
  207. console.log(e);
  208. });
  209. },
  210. },
  211. mounted(){
  212. this.weChatCode = this.subStrUrlCode();
  213. this.weChatCode ? this.sendCodeRequest() : this.judgeLogin()
  214. }
  215. })
  216. </script>
  217. <style>
  218. .modal-share {
  219. width: 100%;
  220. height: 100%;
  221. background-color: rgba(0,0,0,.6);
  222. z-index: 99;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-around;
  226. align-items: center;
  227. }
  228. .share-content {
  229. text-align: center;
  230. }
  231. .share-footer {
  232. border: 1px dotted #f1f1f1;
  233. color: #F3F3F3;
  234. }
  235. </style>
  236. </html>