index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. <share-popup
  42. ref="sharePopupRef"
  43. title="远程面试邀请"
  44. desc="请点击链接参加面试"
  45. :link=roomUrl
  46. type="0"
  47. @success="onShareSuccess"
  48. />
  49. </view>
  50. </view>
  51. </template>
  52. <script setup>
  53. import * as httpApi from '@/api/mianshi.js'
  54. import {
  55. ref,
  56. reactive
  57. } from "vue"
  58. import {
  59. onLoad
  60. } from "@dcloudio/uni-app";
  61. import config from "../../../config"
  62. import SharePopup from '@/components/sharePopUp/index.vue'
  63. const data = reactive({
  64. room: '',
  65. })
  66. const roomUrl = ref('')
  67. const sharePopupRef = ref(null)
  68. function closePopup() {
  69. sharePopupRef.value.close()
  70. }
  71. function onShareSuccess(e){
  72. console.log('分享成功', e.scene)
  73. }
  74. function goUpPage() {
  75. uni.redirectTo({
  76. url: `/pages/admin/ShouYe/shouye`
  77. })
  78. }
  79. function handleMianshiInfo() {
  80. httpApi.getMianshiInfo().then(res => {
  81. data.room = res.data.room;
  82. })
  83. }
  84. function handleCreate() {
  85. httpApi.getMianshiCreate().then(res => {
  86. data.room = res.data.room;
  87. uni.showToast({
  88. title: '创建成功',
  89. icon: 'none'
  90. });
  91. })
  92. .catch(err => {
  93. console.error('创建失败:', err);
  94. uni.showToast({
  95. title: '创建失败,请重试',
  96. icon: 'none'
  97. });
  98. });
  99. }
  100. function yqBtn(code) {
  101. roomUrl.value = `${config.mianshiUrl}?roomId=900803&index=${code}`
  102. sharePopupRef.value.open()
  103. // 分享地址
  104. //const url = `${config.mianshiUrl}?roomId=900803&index=${code}`
  105. }
  106. function handleClose() {
  107. httpApi.getMianshiClose().then(res => {
  108. if (res.data) {
  109. data.room = null;
  110. uni.showToast({
  111. title: '房间已关闭',
  112. icon: 'none'
  113. });
  114. }
  115. })
  116. }
  117. function openUrl(code) {
  118. const url = `${config.mianshiUrl}?roomId=${data.room}&index=${code}`
  119. plus.runtime.openURL(url, (err) => {
  120. if (err) {
  121. console.error('打开浏览器失败: ', err);
  122. uni.showToast({
  123. title: '打开链接失败',
  124. icon: 'none'
  125. });
  126. }
  127. });
  128. }
  129. onLoad(() => {
  130. handleMianshiInfo()
  131. })
  132. </script>