张文飞 3 years ago
parent
commit
610208c19a
1 changed files with 17 additions and 2 deletions
  1. 17 2
      pages/houseDetail/houseDetail.vue

+ 17 - 2
pages/houseDetail/houseDetail.vue

@@ -124,6 +124,7 @@
 
 				categoryList: [],
 				registAmount: null,
+				shareToken:"",
 			}
 		},
 		onLoad(param) {
@@ -146,6 +147,19 @@
 			})
 		},
 		methods: {
+			async getSingle(){
+				let params = {
+					"projectId": this.projectId,
+					"userId": getApp().globalData.userId
+				}
+				let res = await this.$myRequest({
+					url: '/share_token/generate',
+					data: parmas
+				});
+				if(res.data.success){
+					this.shareToken = res.data.single;
+				}
+			},
 			async signJsapiTicket(){
 				let url =  location.href.split('#')[0]
 				let parmas = {
@@ -172,7 +186,7 @@
 				   	wx.updateAppMessageShareData({ //分享给朋友
 				   		title: self.dataInfo.name, // 分享标题
 				   		desc: self.dataInfo.shareRemark, // 分享描述
-				   		link: location.origin+location.pathname + "?projectId="+self.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+				   		link: location.origin+location.pathname + "?projectId="+self.projectId+"&shareToken="+self.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
 				   		imgUrl: self.dataInfo.shareImg, // 分享图标
 				   		success: function() {
 				   			// 设置成功
@@ -180,7 +194,7 @@
 				   	});
 				   	wx.updateTimelineShareData({ //分享到朋友圈
 				   		title: self.dataInfo.name, // 分享标题
-				   		link: location.origin+location.pathname + "?projectId="+self.projectId+"&shareToken="+getApp().globalData.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+				   		link: location.origin+location.pathname + "?projectId="+self.projectId+"&shareToken="+self.shareToken, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
 				   		imgUrl: self.dataInfo.shareImg, // 分享图标
 				   		success: function() {
 				   			// 设置成功
@@ -201,6 +215,7 @@
 						projectId: this.projectId,
 						userId: getApp().globalData.userId
 					}
+					this.getSingle();
 					this.createUserProjectRlat();
 					this.getRegistTask();
 					let res = await this.$myRequest({