index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="phone-ycms-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">远程面试</text>
  6. </view>
  7. <view class="ycms-body-box">
  8. <view class="ycms-card-box">
  9. <view class="card-title-row">
  10. <text>远程面试</text>
  11. <view @click="handleClose" class="colse-btn" v-if="data.room">关闭房间</view>
  12. </view>
  13. <view class="room-box">
  14. <view class="room-info-box" v-if="data.room">
  15. <view class="room-num">{{ data.room }}</view>
  16. <view class="room-text">房间号</view>
  17. </view>
  18. <view class="room-info-box flex-info" v-else>
  19. <view class="room-wcj">未创建</view>
  20. <view class="room-text">房间号</view>
  21. </view>
  22. <button @click="openUrl(1)" type="default" class="phone-white-btn jr-btn"
  23. v-if="data.room">进入房间</button>
  24. <!-- <button @click="openUrl2">进入房间2</button> -->
  25. </view>
  26. <!-- phone-white-btn -->
  27. <button @click="yqBtn(3)" type="default" class="phone-green-btn yqkh-btn" v-if="data.room">邀请阿姨</button>
  28. <button @click="yqBtn(2)" type="default" class="phone-green-btn yqkh-btn"
  29. v-if="data.room">邀请客户1</button>
  30. <button @click="yqBtn(4)" type="default" class="phone-green-btn yqkh-btn"
  31. v-if="data.room">邀请客户2</button>
  32. <button @click="handleCreate" type="default" class="phone-green-btn" v-else>创建面试房间</button>
  33. <view class="ycms-tip-box">
  34. <view class="tip-title"><text>小贴士</text>
  35. <icon></icon>
  36. </view>
  37. <view class="tip-text">1.创建房间后会生成房间号,生成房间号后,可进入房间,也可以直接分享给客户进入房间。</view>
  38. <view class="tip-text">2. 关闭房间后,面试人员将无法再进入房间,需要重新创建房间。</view>
  39. </view>
  40. </view>
  41. <uni-popup ref="popupShareRef" type="bottom">
  42. <view class="share-options">
  43. <!-- 微信好友 -->
  44. <view class="share-item" @click="selectShare('weixinHaoyou')">
  45. <text class="share-text">微信好友1231231231231231231231231</text>
  46. </view>
  47. <!-- 微信朋友圈 -->
  48. <view class="share-item" @click="selectShare('pengyouquan')">
  49. <text class="share-text">朋友圈</text>
  50. </view>
  51. <text class="share-text" @click="closePopup">取消</text>
  52. </view>
  53. </uni-popup>
  54. </view>
  55. </view>
  56. </template>
  57. <script setup>
  58. import * as httpApi from '@/api/mianshi.js'
  59. import {
  60. ref,
  61. reactive
  62. } from "vue"
  63. import {
  64. onLoad
  65. } from "@dcloudio/uni-app";
  66. import config from "../../../config"
  67. const data = reactive({
  68. room: '',
  69. })
  70. const roomUrl = ref('')
  71. const popupShareRef = ref(null)
  72. function closePopup() {
  73. popupShareRef.value.close()
  74. }
  75. function selectShare(data) {
  76. let sceneType
  77. if (data == 'weixinhaoyou') {
  78. sceneType = 'WXSceneSession'
  79. } else {
  80. sceneType = 'WXSceneTimeline'
  81. }
  82. console.log('sceneType', sceneType);
  83. uni.share({
  84. provider: "weixin",
  85. scene: sceneType,
  86. type: 0,
  87. href: roomUrl.value,
  88. title: "uni-app分享",
  89. summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
  90. imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
  91. success: function(res) {
  92. console.log("success:" + JSON.stringify(res));
  93. },
  94. fail: function(err) {
  95. console.log("fail:" + JSON.stringify(err));
  96. }
  97. });
  98. }
  99. function goUpPage() {
  100. uni.redirectTo({
  101. url: `/pages/admin/ShouYe/shouye`
  102. })
  103. }
  104. function handleMianshiInfo() {
  105. httpApi.getMianshiInfo().then(res => {
  106. data.room = res.data.room;
  107. })
  108. }
  109. function handleCreate() {
  110. httpApi.getMianshiCreate().then(res => {
  111. data.room = res.data.room;
  112. uni.showToast({
  113. title: '创建成功',
  114. icon: 'none'
  115. });
  116. })
  117. .catch(err => {
  118. console.error('创建失败:', err);
  119. uni.showToast({
  120. title: '创建失败,请重试',
  121. icon: 'none'
  122. });
  123. });
  124. }
  125. function yqBtn(code) {
  126. roomUrl.value = `${config.mianshiUrl}?roomId=900803&index=${code}`
  127. popupShareRef.value.open()
  128. // 分享地址
  129. //const url = `${config.mianshiUrl}?roomId=900803&index=${code}`
  130. }
  131. function handleClose() {
  132. httpApi.getMianshiClose().then(res => {
  133. if (res.data) {
  134. data.room = null;
  135. uni.showToast({
  136. title: '房间已关闭',
  137. icon: 'none'
  138. });
  139. }
  140. })
  141. }
  142. function openUrl(code) {
  143. const url = `${config.mianshiUrl}?roomId=${data.room}&index=${code}`
  144. plus.runtime.openURL(url, (err) => {
  145. if (err) {
  146. console.error('打开浏览器失败: ', err);
  147. uni.showToast({
  148. title: '打开链接失败',
  149. icon: 'none'
  150. });
  151. }
  152. });
  153. }
  154. onLoad(() => {
  155. handleMianshiInfo()
  156. })
  157. </script>