Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

wgl 4 éve
szülő
commit
79abdb1b72

+ 19 - 27
src/components/ShareServer.vue

@@ -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();
 
 		},
 	}

+ 5 - 3
src/projects/business/views/Guest/To/Info.vue

@@ -3,7 +3,7 @@
     <header class="mui-bar mui-bar-nav" v-if="step=='1'" >
       <h1 class="mui-title">访问邀请函</h1>
     </header>
-    <share-server ref="shareServer" ></share-server>
+    <share-server ref="shareServer" :id="1"  ></share-server>
 
     <div   v-if="step=='1'" class="mui-content margin60">
       <div class="mui-content-padded vongi-qingjiadt">
@@ -411,6 +411,9 @@
           this.isLoading = false;
 
           this.detail = response;
+          this.$refs.shareServer.setName('您有一封来自'+this.detail.intervieweeUnit+this.detail.intervieweeName+'的邀请函!');
+          this.$refs.shareServer.setShare();
+
           if(this.detail.status!='0'){
             this.step='3'
             //生成二维码
@@ -448,8 +451,7 @@
     },
     mounted() {
       //获取微信配置
-      this.$refs.shareServer.setShare();
-      this.getDetail();
+       this.getDetail();
 
     },