|
|
@@ -42,17 +42,6 @@
|
|
|
|
|
|
|
|
|
<script>
|
|
|
- // wx.config({
|
|
|
- // debug: false,
|
|
|
- // appId: "<?php echo $signature['appId']; ?>",
|
|
|
- // timestamp: <?php echo $signature['timestamp']; ?> ,
|
|
|
- // nonceStr : "<?php echo $signature['nonceStr']; ?>",
|
|
|
- // signature: "<?php echo $signature['signature']; ?>",
|
|
|
- // jsApiList: [
|
|
|
- // 'imagePreview', 'chooseImage', 'uploadImage'
|
|
|
- // ]
|
|
|
- // });
|
|
|
-
|
|
|
const apiUrl = 'http://fission.xazhima.com/api/api.php';
|
|
|
|
|
|
new Vue({
|
|
|
@@ -62,10 +51,17 @@
|
|
|
headSrc:'image/headImg.png',
|
|
|
contentSrc:"image/content-bg.png",
|
|
|
weChatCode:'',
|
|
|
+ isFollow:'0'
|
|
|
},
|
|
|
methods:{
|
|
|
goWeChat(){
|
|
|
- location.href = 'http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzUzOTcwMjM0OQ==#wechat_webview_type=1&wechat_redirect'
|
|
|
+ if(this.isFollow === '0'){
|
|
|
+ location.href = 'http://mp.weixin.qq.com/mp/getmasssendmsg?__biz=MzUzOTcwMjM0OQ==#wechat_webview_type=1&wechat_redirect'
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ console.log('show share modal');
|
|
|
+ wx.onMenuShareAppMessage()
|
|
|
+ }
|
|
|
},
|
|
|
subStrUrlCode: function () {
|
|
|
let weChatCodeUrl = location.search; //获取url中"?"符后的字符串
|
|
|
@@ -107,15 +103,28 @@
|
|
|
console.log(e);
|
|
|
});
|
|
|
},
|
|
|
+ setWxConfig(param){
|
|
|
+ wx.config({
|
|
|
+ debug: false,
|
|
|
+ appId: param.appId,
|
|
|
+ timestamp: param.timestamp ,
|
|
|
+ nonceStr : param.nonceStr,
|
|
|
+ signature: param.signature,
|
|
|
+ jsApiList: [
|
|
|
+ 'imagePreview', 'chooseImage', 'uploadImage'
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ },
|
|
|
sendCodeRequest(){
|
|
|
- this.weChatCode = this.subStrUrlCode();
|
|
|
+ let that = this;
|
|
|
+ that.weChatCode = that.subStrUrlCode();
|
|
|
axios({
|
|
|
method: 'post', //请求方式 有常用的有get post等
|
|
|
url: apiUrl, //请求地址
|
|
|
data: {
|
|
|
method: 'wxinfo',
|
|
|
timestamp: 11111111,
|
|
|
- code:this.weChatCode,
|
|
|
+ code:that.weChatCode,
|
|
|
sign:md5('wxinfo'+'11111111')
|
|
|
}, //代表传过去的参数对象,
|
|
|
transformRequest: [function(data) {
|
|
|
@@ -128,7 +137,9 @@
|
|
|
}], //将传参修改为formData格式 注释则为JSON格式
|
|
|
}).then(function(rs) {
|
|
|
if(rs.data.code === 200) {
|
|
|
- console.log(rs)
|
|
|
+ that.setWxConfig(rs.data.msg.js_sign);
|
|
|
+ that.headSrc = rs.data.msg.headimgurl;
|
|
|
+ that.isFollow = rs.data.msg.subscribe;
|
|
|
}
|
|
|
}).catch(function(e) {
|
|
|
console.log(e);
|