wangguoyu před 3 dny
rodič
revize
df3cfaf691
1 změnil soubory, kde provedl 102 přidání a 34 odebrání
  1. 102 34
      pages/admin/mianshi/index.vue

+ 102 - 34
pages/admin/mianshi/index.vue

@@ -19,78 +19,146 @@
 						<view class="room-wcj">未创建</view>
 						<view class="room-text">房间号</view>
 					</view>
-					<button @click="openUrl(1)" type="default" class="phone-white-btn jr-btn" v-if="data.room">进入房间</button>
+					<button @click="openUrl(1)" type="default" class="phone-white-btn jr-btn"
+						v-if="data.room">进入房间</button>
 					<!-- <button @click="openUrl2">进入房间2</button> -->
 				</view>
 				<!-- phone-white-btn -->
-        <button @click="yqBtn(3)" type="default" class="phone-green-btn yqkh-btn"  v-if="data.room">邀请阿姨</button>
-        <button @click="yqBtn(2)" type="default" class="phone-green-btn yqkh-btn"  v-if="data.room">邀请客户1</button>
-        <button @click="yqBtn(4)" type="default" class="phone-green-btn yqkh-btn"  v-if="data.room">邀请客户2</button>
+				<button @click="yqBtn(3)" type="default" class="phone-green-btn yqkh-btn" v-if="data.room">邀请阿姨</button>
+				<button @click="yqBtn(2)" type="default" class="phone-green-btn yqkh-btn"
+					v-if="data.room">邀请客户1</button>
+				<button @click="yqBtn(4)" type="default" class="phone-green-btn yqkh-btn"
+					v-if="data.room">邀请客户2</button>
 				<button @click="handleCreate" type="default" class="phone-green-btn" v-else>创建面试房间</button>
-				
+
 				<view class="ycms-tip-box">
-					<view class="tip-title"><text>小贴士</text><icon></icon></view>
+					<view class="tip-title"><text>小贴士</text>
+						<icon></icon>
+					</view>
 					<view class="tip-text">1.创建房间后会生成房间号,生成房间号后,可进入房间,也可以直接分享给客户进入房间。</view>
 					<view class="tip-text">2. 关闭房间后,面试人员将无法再进入房间,需要重新创建房间。</view>
 				</view>
 			</view>
-			
-			
+			<uni-popup ref="popupShareRef" type="bottom">
+				<view class="share-options">
+					<!-- 微信好友 -->
+					<view class="share-item" @click="selectShare('weixinHaoyou')">
+
+						<text class="share-text">微信好友1231231231231231231231231</text>
+					</view>
+					<!-- 微信朋友圈 -->
+					<view class="share-item" @click="selectShare('pengyouquan')">
+
+						<text class="share-text">朋友圈</text>
+					</view>
+					<text class="share-text" @click="closePopup">取消</text>
+				</view>
+			</uni-popup>
+
 		</view>
 	</view>
 </template>
 
 <script setup>
 	import * as httpApi from '@/api/mianshi.js'
-	import { ref, reactive } from "vue"
-	import {onLoad} from "@dcloudio/uni-app";
-  import config from "../../../config"
-	
+	import {
+		ref,
+		reactive
+	} from "vue"
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import config from "../../../config"
+
 	const data = reactive({
 		room: '',
 	})
-	
+	const roomUrl = ref('')
+	const popupShareRef = ref(null)
+
+	function closePopup() {
+		popupShareRef.value.close()
+	}
+
+	function selectShare(data) {
+		let sceneType
+		if (data == 'weixinhaoyou') {
+			sceneType = 'WXSceneSession'
+		} else {
+			sceneType = 'WXSceneTimeline'
+		}
+		console.log('sceneType', sceneType);
+		uni.share({
+			provider: "weixin",
+			scene: sceneType,
+			type: 0,
+			href: roomUrl.value,
+			title: "uni-app分享",
+			summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
+			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));
+			}
+		});
+	}
+
 	function goUpPage() {
 		uni.redirectTo({
 			url: `/pages/admin/ShouYe/shouye`
 		})
 	}
-	
+
 	function handleMianshiInfo() {
-		httpApi.getMianshiInfo().then(res =>{
+		httpApi.getMianshiInfo().then(res => {
 			data.room = res.data.room;
 		})
 	}
-	function handleCreate(){
+
+	function handleCreate() {
 		httpApi.getMianshiCreate().then(res => {
-			data.room = res.data.room;
-			uni.showToast({ title: '创建成功', icon: 'none' });
-		  })
-		  .catch(err => {
-			console.error('创建失败:', err);
-			uni.showToast({ title: '创建失败,请重试', icon: 'none' });
-		  });
+				data.room = res.data.room;
+				uni.showToast({
+					title: '创建成功',
+					icon: 'none'
+				});
+			})
+			.catch(err => {
+				console.error('创建失败:', err);
+				uni.showToast({
+					title: '创建失败,请重试',
+					icon: 'none'
+				});
+			});
 	}
-	function yqBtn(code){
-    // 分享地址
-    const url = `${config.mianshiUrl}?roomId=900803&index=${code}`
+
+	function yqBtn(code) {
+		roomUrl.value = `${config.mianshiUrl}?roomId=900803&index=${code}`
+		popupShareRef.value.open()
+		// 分享地址
+		//const url = `${config.mianshiUrl}?roomId=900803&index=${code}`
 	}
-	
+
 	function handleClose() {
-		httpApi.getMianshiClose().then(res =>{
+		httpApi.getMianshiClose().then(res => {
 			if (res.data) {
 				data.room = null;
-				uni.showToast({ title: '房间已关闭', icon: 'none' });
+				uni.showToast({
+					title: '房间已关闭',
+					icon: 'none'
+				});
 			}
 		})
 	}
-	
-	
-	
+
+
+
 
 
 	function openUrl(code) {
-    const url = `${config.mianshiUrl}?roomId=${data.room}&index=${code}`
+		const url = `${config.mianshiUrl}?roomId=${data.room}&index=${code}`
 		plus.runtime.openURL(url, (err) => {
 			if (err) {
 				console.error('打开浏览器失败: ', err);
@@ -101,7 +169,7 @@
 			}
 		});
 	}
-	
+
 	onLoad(() => {
 		handleMianshiInfo()
 	})