wangguoyu 8 hours ago
parent
commit
f5763b4f2d
1 changed files with 30 additions and 13 deletions
  1. 30 13
      pages/admin/mianshi/index.vue

+ 30 - 13
pages/admin/mianshi/index.vue

@@ -40,15 +40,8 @@
 					<view class="tip-text">2. 关闭房间后,面试人员将无法再进入房间,需要重新创建房间。</view>
 				</view>
 			</view>
-			 <share-popup 
-			      ref="sharePopupRef"
-				  :image="roomImageUrl"
-			      title="远程面试邀请"
-			      desc="请点击链接参加面试"
-			      :link=roomUrl
-			      type="0"
-			      @success="onShareSuccess"
-			    />
+			<share-popup ref="sharePopupRef" :image="roomImageUrl" title="远程面试邀请" desc="请点击链接参加面试" :link=roomUrl
+				type="0" @success="onShareSuccess" />
 		</view>
 	</view>
 </template>
@@ -71,13 +64,14 @@
 		room: '',
 	})
 	const roomUrl = 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/ShouYe/shouye`
@@ -109,11 +103,34 @@
 
 	function yqBtn(code) {
 		roomUrl.value = `${config.mianshiUrl}?roomId=${data.room}&index=${code}`
-		sharePopupRef.value.open()
+		//sharePopupRef.value.open()
 		// 分享地址
 		//const url = `${config.mianshiUrl}?roomId=900803&index=${code}`
+		//固定为微信好友 不使用组件
+		directShare()
+	}
+
+	function directShare() {
+		const shareConfig = {
+			provider: 'weixin',
+			scene: 'WXSceneSession', // 固定为微信好友
+			type: 0, // 图文分享
+			title: '远程面试邀请',
+			summary: '请点击链接参加面试',
+			href: roomUrl.value,
+			imageUrl: roomImageUrl.value,
+			success: function(res) {
+				console.log('分享成功')
+			},
+			fail: function(err) {
+				console.error('分享失败:', err)
+				// 错误处理...
+			}
+		}
+		uni.share(shareConfig)
 	}
 
+
 	function handleClose() {
 		httpApi.getMianshiClose().then(res => {
 			if (res.data) {