|
|
@@ -42,8 +42,6 @@
|
|
|
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
-
|
|
|
// wx.config({
|
|
|
// debug: false,
|
|
|
// appId: "<?php echo $signature['appId']; ?>",
|
|
|
@@ -55,26 +53,90 @@
|
|
|
// ]
|
|
|
// });
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ const apiUrl = 'http://fission.xazhima.com/api/api.php';
|
|
|
|
|
|
new Vue({
|
|
|
el:'#myApp',
|
|
|
data:{
|
|
|
num:52255,
|
|
|
headSrc:'image/headImg.png',
|
|
|
- contentSrc:"image/content-bg.png"
|
|
|
+ contentSrc:"image/content-bg.png",
|
|
|
+ weChatCode:'',
|
|
|
},
|
|
|
methods:{
|
|
|
goWeChat(){
|
|
|
location.href = 'http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzUzOTcwMjM0OQ==#wechat_webview_type=1&wechat_redirect'
|
|
|
+ },
|
|
|
+ subStrUrlCode: function () {
|
|
|
+ let weChatCodeUrl = location.search; //获取url中"?"符后的字符串
|
|
|
+ let theRequest = {};
|
|
|
+ if (weChatCodeUrl.indexOf("?") !== -1) {
|
|
|
+ let str = weChatCodeUrl.substr(1);
|
|
|
+ let strS = str.split("&");
|
|
|
+ for(let i = 0; i < strS.length; i ++) {
|
|
|
+ theRequest[strS[i].split("=")[0]]=(strS[i].split("=")[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(theRequest);
|
|
|
+ return theRequest.code;
|
|
|
+ },
|
|
|
+ judgeLogin(){
|
|
|
+ axios({
|
|
|
+ method: 'post', //请求方式 有常用的有get post等
|
|
|
+ url: apiUrl, //请求地址
|
|
|
+ data: {
|
|
|
+ method: 'login',
|
|
|
+ timestamp: 11111111,
|
|
|
+ sign:md5('login'+'11111111')
|
|
|
+ }, //代表传过去的参数对象,
|
|
|
+ transformRequest: [function(data) {
|
|
|
+ let ret = '';
|
|
|
+ for (let it in data) {
|
|
|
+ ret += encodeURIComponent(it) + '=' +
|
|
|
+ encodeURIComponent(data[it]) + '&'
|
|
|
+ }
|
|
|
+ return ret
|
|
|
+ }], //将传参修改为formData格式 注释则为JSON格式
|
|
|
+ }).then(function(rs) {
|
|
|
+ if(rs.data.code === 200) {
|
|
|
+ window.location.href = rs.data.msg;
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }).catch(function(e) {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ sendCodeRequest(){
|
|
|
+ this.data.weChatCode = this.subStrUrlCode();
|
|
|
+ axios({
|
|
|
+ method: 'post', //请求方式 有常用的有get post等
|
|
|
+ url: apiUrl, //请求地址
|
|
|
+ data: {
|
|
|
+ method: 'wxinfo',
|
|
|
+ timestamp: 11111111,
|
|
|
+ code:this.data.weChatCode,
|
|
|
+ sign:md5('wxinfo'+'11111111')
|
|
|
+ }, //代表传过去的参数对象,
|
|
|
+ transformRequest: [function(data) {
|
|
|
+ let ret = '';
|
|
|
+ for (let it in data) {
|
|
|
+ ret += encodeURIComponent(it) + '=' +
|
|
|
+ encodeURIComponent(data[it]) + '&'
|
|
|
+ }
|
|
|
+ return ret
|
|
|
+ }], //将传参修改为formData格式 注释则为JSON格式
|
|
|
+ }).then(function(rs) {
|
|
|
+ if(rs.data.code === 200) {
|
|
|
+ console.log(rs)
|
|
|
+ }
|
|
|
+ }).catch(function(e) {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
|
- fetch('https://www.baidu.com')
|
|
|
- .then((res)=>{
|
|
|
- console.log(res)
|
|
|
- })
|
|
|
+ this.subStrUrlCode() ? this.sendCodeRequest() : this.judgeLogin()
|
|
|
}
|
|
|
})
|
|
|
|