wangguoyu 1 week ago
parent
commit
5c7953f66d
1 changed files with 19 additions and 8 deletions
  1. 19 8
      pages/admin/haibao/haibaoInfo.vue

+ 19 - 8
pages/admin/haibao/haibaoInfo.vue

@@ -3,7 +3,7 @@
 		<view class="phone-navBar-box">
 			<view @click="goUpPage" class="nav-bar-icon"></view>
 			<text class="nav-bar-title">职业海报</text>
-			<view @click="getUUid" class="text-btn">分享</view>
+			<view @click="getHaibaoImg" class="text-btn">分享</view>
 		</view>
 		<view class="haibao-info-body-box">
 			<view v-if="data.img" class="img-box">
@@ -47,9 +47,10 @@
 	const haibaoUrl = ref('')
 	const sharePopupRef = ref(null)
 
-	function onShareSuccess(e){
-		 console.log('分享成功', e.scene)
+	function onShareSuccess(e) {
+		console.log('分享成功', e.scene)
 	}
+
 	function goUpPage() {
 		uni.redirectTo({
 			url: `/pages/admin/haibao/index?menuId=${data.menuId}`
@@ -73,24 +74,34 @@
 		})
 	}
 
-	function getUUid() {
+	function getHaibaoImg() {
 		httpApi.haibaoShare({
 			id: data.id
 		}).then(res => {
 			if (res.code == 0) {
-				data.uuid = res.data.uuid
-				haibaoUrl.value = `${config.haibaoUrl}?uuid=${data.uuid}`
-				sharePopupRef.value.open()
+				uni.share({
+					provider: "weixin",
+					scene: "WXSceneTimeline",
+					type: 2,
+					imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
+					success: function(res) {
+						console.log("success:" + JSON.stringify(res));
+					},
+					fail: function(err) {
+						console.log("fail:" + JSON.stringify(err));
+					}
+				});
 			}
 		}).catch(err => {
 			uni.showToast({
-				title: '获得uuid失败',
+				title: '获得海报图片失败',
 				icon: 'none'
 			})
 		})
 	}
 
 
+
 	onLoad((options) => {
 		data.id = options.cardId || ''
 		data.menuId = options.menuId || ''