fission-page.html 11 KB

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