fission-page.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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">已有 <span style="color: #A4404E">{{num}}</span> 人领取成功</div>
  25. <!--<img class="get-btn-box" src="image/get-free.gif" alt="" onclick="isfollowqr('http://open.weixin.qq.com/qr/code?username=hszuqiu')" />-->
  26. <img class="get-btn-box" src="image/get-free.gif" alt="" @click="goWeChat" />
  27. </div>
  28. </body>
  29. <script>
  30. // wx.config({
  31. // debug: false,
  32. // appId: "<?php echo $signature['appId']; ?>",
  33. // timestamp: <?php echo $signature['timestamp']; ?> ,
  34. // nonceStr : "<?php echo $signature['nonceStr']; ?>",
  35. // signature: "<?php echo $signature['signature']; ?>",
  36. // jsApiList: [
  37. // 'imagePreview', 'chooseImage', 'uploadImage'
  38. // ]
  39. // });
  40. const apiUrl = 'http://fission.xazhima.com/api/api.php';
  41. new Vue({
  42. el:'#myApp',
  43. data:{
  44. num:52255,
  45. headSrc:'image/headImg.png',
  46. contentSrc:"image/content-bg.png",
  47. weChatCode:'',
  48. },
  49. methods:{
  50. goWeChat(){
  51. location.href = 'http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzUzOTcwMjM0OQ==#wechat_webview_type=1&wechat_redirect'
  52. },
  53. subStrUrlCode: function () {
  54. let weChatCodeUrl = location.search; //获取url中"?"符后的字符串
  55. let theRequest = {};
  56. if (weChatCodeUrl.indexOf("?") !== -1) {
  57. let str = weChatCodeUrl.substr(1);
  58. let strS = str.split("&");
  59. for(let i = 0; i < strS.length; i ++) {
  60. theRequest[strS[i].split("=")[0]]=(strS[i].split("=")[1]);
  61. }
  62. }
  63. console.log(theRequest);
  64. return theRequest.code;
  65. },
  66. judgeLogin(){
  67. axios({
  68. method: 'post', //请求方式 有常用的有get post等
  69. url: apiUrl, //请求地址
  70. data: {
  71. method: 'login',
  72. timestamp: 11111111,
  73. sign:md5('login'+'11111111')
  74. }, //代表传过去的参数对象,
  75. transformRequest: [function(data) {
  76. let ret = '';
  77. for (let it in data) {
  78. ret += encodeURIComponent(it) + '=' +
  79. encodeURIComponent(data[it]) + '&'
  80. }
  81. return ret
  82. }], //将传参修改为formData格式 注释则为JSON格式
  83. }).then(function(rs) {
  84. if(rs.data.code === 200) {
  85. window.location.href = rs.data.msg;
  86. }else {
  87. }
  88. }).catch(function(e) {
  89. console.log(e);
  90. });
  91. },
  92. sendCodeRequest(){
  93. this.weChatCode = this.subStrUrlCode();
  94. axios({
  95. method: 'post', //请求方式 有常用的有get post等
  96. url: apiUrl, //请求地址
  97. data: {
  98. method: 'wxinfo',
  99. timestamp: 11111111,
  100. code:this.weChatCode,
  101. sign:md5('wxinfo'+'11111111')
  102. }, //代表传过去的参数对象,
  103. transformRequest: [function(data) {
  104. let ret = '';
  105. for (let it in data) {
  106. ret += encodeURIComponent(it) + '=' +
  107. encodeURIComponent(data[it]) + '&'
  108. }
  109. return ret
  110. }], //将传参修改为formData格式 注释则为JSON格式
  111. }).then(function(rs) {
  112. if(rs.data.code === 200) {
  113. console.log(rs)
  114. }
  115. }).catch(function(e) {
  116. console.log(e);
  117. });
  118. }
  119. },
  120. mounted(){
  121. this.subStrUrlCode() ? this.sendCodeRequest() : this.judgeLogin()
  122. }
  123. })
  124. </script>
  125. </html>