From 909113b3c4ae113b60793f7f5ba22af0bd3165cc Mon Sep 17 00:00:00 2001
From: cshenfu <men883234@gmail.com>
Date: 星期三, 17 五月 2023 11:14:26 +0800
Subject: [PATCH] add shar

---
 pages/index/home.vue |   62 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 1 deletions(-)

diff --git a/pages/index/home.vue b/pages/index/home.vue
index 4d62de1..87654b6 100755
--- a/pages/index/home.vue
+++ b/pages/index/home.vue
@@ -14,10 +14,12 @@
 			<button @click="toChat" style="width: calc(100vw - 60rpx); height: 100rpx;" class="cu-btn text-bold chat-button">
 				寮�濮嬪挩璇� (浣檣{num}}娆�) </button>
 		</view>
+		
 		<view class="tool padding-top-xl">
 			<view class="header">
 				<view class="title text-bold">鍔熻兘鐗规��</view>
 			</view>
+			<!-- <text>{{ user_data }}</text> -->
 			<u-transition :show="true" mode="slide-up">
 				<view class="grid">
 					<view class="item">
@@ -97,7 +99,8 @@
 			return {
 				showTab: false,
 				tabIndex: 0,
-				setting_data:'null'
+				setting_data:'null',
+				user_data:'null'
 			}
 		},
 		computed: {
@@ -112,6 +115,63 @@
 			this.setting_data = setting
 			
 			
+			
+			
+		},
+		created() {
+			var url_local = location.href.split("#")[0]
+			this.$request("/api/Member/wxH5ShareId",'POST',{
+				url:url_local
+			}).then((res) => {
+				this.user_data = res.data
+					wx.config({
+					  debug: false, // 寮�鍚皟璇曟ā寮�,璋冪敤鐨勬墍鏈� api 鐨勮繑鍥炲�间細鍦ㄥ鎴风 alert 鍑烘潵锛岃嫢瑕佹煡鐪嬩紶鍏ョ殑鍙傛暟锛屽彲浠ュ湪 pc 绔墦寮�锛屽弬鏁颁俊鎭細閫氳繃 log 鎵撳嚭锛屼粎鍦� pc 绔椂鎵嶄細鎵撳嵃銆�
+					  appId: this.user_data.appId, // 蹇呭~锛屽叕浼楀彿鐨勫敮涓�鏍囪瘑
+					  timestamp: this.user_data.timestamp, // 蹇呭~锛岀敓鎴愮鍚嶇殑鏃堕棿鎴�
+					  nonceStr: this.user_data.nonceStr, // 蹇呭~锛岀敓鎴愮鍚嶇殑闅忔満涓�
+					  signature: this.user_data.signature, // 蹇呭~锛岀鍚�
+					  jsApiList: [
+						'updateAppMessageShareData',
+						'updateTimelineShareData',
+						'onMenuShareTimeline',
+						'onMenuShareAppMessage',
+						'onMenuShareQQ',
+						'onMenuShareQZone'
+					  ] // 蹇呭~锛岄渶瑕佷娇鐢ㄧ殑JS鎺ュ彛鍒楄〃
+					})
+			
+					wx.ready(function () {
+					  //鍒嗕韩鍒板ソ鍙�
+					  wx.updateAppMessageShareData({
+						title: "ChatFox", // 鍒嗕韩鏍囬
+						desc: "ChatFox", // 鍒嗕韩鎻忚堪
+						link: location.href, // 鍒嗕韩閾炬帴锛岃閾炬帴鍩熷悕鎴栬矾寰勫繀椤讳笌褰撳墠椤甸潰瀵瑰簲鐨勫叕浼楀彿 JS 瀹夊叏鍩熷悕涓�鑷�
+						imgUrl: "@/static/h5/download-app/ios.png", // 鍒嗕韩鍥炬爣
+						success: function () {
+						  // 璁剧疆鎴愬姛
+						  console.log('鎴愬姛')
+						},
+						cancel: function () {
+						  // 鐢ㄦ埛鍙栨秷鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟
+						  console.log('鍙栨秷')
+						},
+						fail: function () {
+						  // 鐢ㄦ埛鍒嗕韩澶辫触鍚庢墽琛岀殑鍥炶皟鍑芥暟
+						  console.log('澶辫触')
+						}
+					  })
+					  //鍒嗕韩鍒版湅鍙嬪湀
+					  wx.updateTimelineShareData({
+					   title: "ChatFox", // 鍒嗕韩鏍囬
+					   link: location.href, // 鍒嗕韩閾炬帴锛岃閾炬帴鍩熷悕鎴栬矾寰勫繀椤讳笌褰撳墠椤甸潰瀵瑰簲鐨勫叕浼楀彿 JS 瀹夊叏鍩熷悕涓�鑷�
+					   imgUrl: "@/static/h5/download-app/ios.png", // 鍒嗕韩鍥炬爣
+						success: function () {
+						  // 璁剧疆鎴愬姛
+						}
+					  })
+					})
+					
+			});
 		},
 		onShareAppMessage() {
 			console.log('杞彂+1')

--
Gitblit v1.9.1