|
@@ -14,6 +14,7 @@
|
|
|
require: true,
|
|
|
default: '0',
|
|
|
},
|
|
|
+
|
|
|
serverList: {
|
|
|
require: true,
|
|
|
type: Array,
|
|
@@ -24,6 +25,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ shareName:null,
|
|
|
isLoading: false,
|
|
|
nowItem: {
|
|
|
shareTitle: '',
|
|
@@ -47,12 +49,13 @@
|
|
|
//定义微信分享
|
|
|
this.wxShare();
|
|
|
},
|
|
|
-
|
|
|
+ get_wx_config() {
|
|
|
+ // this.isLoading = true;
|
|
|
+ var sz=['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone']
|
|
|
+ WxJsApi.getWxConfig(sz)
|
|
|
+ },
|
|
|
//第二种方法,直接通过调用该方法来处理
|
|
|
setShare() {
|
|
|
- //定义微信分享
|
|
|
- this.wxShare();
|
|
|
- return
|
|
|
|
|
|
this.isLoading = true;
|
|
|
API_Common.getSchoolServeList().then(response => {
|
|
@@ -73,42 +76,30 @@
|
|
|
//this.mui.toast(error);
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+ setName(name) {
|
|
|
+ this.shareName=name;
|
|
|
+ },
|
|
|
//获取微信jssdk配置信息
|
|
|
- get_wx_config() {
|
|
|
- this.isLoading = true;
|
|
|
- API_WeiXin.getConfig(window.location.href.split("#")[0]).then(response => {
|
|
|
- this.isLoading = false;
|
|
|
|
|
|
- var wxconfig = response.wxConfig;
|
|
|
- console.log(wxconfig.nonceStr)
|
|
|
- this.wxConfig = wxconfig;
|
|
|
- wx.config({
|
|
|
- debug: false, // 开启调试模式,
|
|
|
- appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
|
|
|
- timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
|
|
|
- nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
|
|
|
- signature: wxconfig.signature, // 必填,签名,见附录1
|
|
|
- jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
- });
|
|
|
- }).catch(error => {
|
|
|
- this.isLoading = false;
|
|
|
- this.mui.toast(error);
|
|
|
- })
|
|
|
- },
|
|
|
//微信分享自定义
|
|
|
wxShare() {
|
|
|
+
|
|
|
console.log(this.nowItem);
|
|
|
+ if(this.shareName){
|
|
|
+ this.nowItem.shareTitle=this.shareName;
|
|
|
+ }
|
|
|
let joinUrl = window.location.href
|
|
|
var _this = this;
|
|
|
wx.ready(function() {
|
|
|
wx.onMenuShareAppMessage({
|
|
|
- title: _this.nowItem.shareTitle,
|
|
|
+ title: '【小鹏管家】'+_this.nowItem.shareTitle,
|
|
|
desc: _this.nowItem.shareDescription,
|
|
|
link: joinUrl,
|
|
|
imgUrl: _this.nowItem.shareImg,
|
|
|
success: function() {
|
|
|
// 设置成功
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
wx.onMenuShareTimeline({
|
|
@@ -118,13 +109,14 @@
|
|
|
imgUrl: _this.nowItem.shareImg,
|
|
|
success: function() {
|
|
|
// 设置成功
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- WxJsApi.getWxConfig();
|
|
|
+ this.get_wx_config();
|
|
|
|
|
|
},
|
|
|
}
|