index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 onShareSuccess(e){
  69. console.log('分享成功', e.scene)
  70. }
  71. function goUpPage() {
  72. uni.redirectTo({
  73. url: `/pages/admin/ShouYe/shouye`
  74. })
  75. }
  76. function handleMianshiInfo() {
  77. httpApi.getMianshiInfo().then(res => {
  78. data.room = res.data.room;
  79. })
  80. }
  81. function handleCreate() {
  82. httpApi.getMianshiCreate().then(res => {
  83. data.room = res.data.room;
  84. uni.showToast({
  85. title: '创建成功',
  86. icon: 'none'
  87. });
  88. })
  89. .catch(err => {
  90. console.error('创建失败:', err);
  91. uni.showToast({
  92. title: '创建失败,请重试',
  93. icon: 'none'
  94. });
  95. });
  96. }
  97. function yqBtn(code) {
  98. roomUrl.value = `${config.mianshiUrl}?roomId=900803&index=${code}`
  99. sharePopupRef.value.open()
  100. // 分享地址
  101. //const url = `${config.mianshiUrl}?roomId=900803&index=${code}`
  102. }
  103. function handleClose() {
  104. httpApi.getMianshiClose().then(res => {
  105. if (res.data) {
  106. data.room = null;
  107. uni.showToast({
  108. title: '房间已关闭',
  109. icon: 'none'
  110. });
  111. }
  112. })
  113. }
  114. function openUrl(code) {
  115. const url = `${config.mianshiUrl}?roomId=${data.room}&index=${code}`
  116. plus.runtime.openURL(url, (err) => {
  117. if (err) {
  118. console.error('打开浏览器失败: ', err);
  119. uni.showToast({
  120. title: '打开链接失败',
  121. icon: 'none'
  122. });
  123. }
  124. });
  125. }
  126. onLoad(() => {
  127. handleMianshiInfo()
  128. })
  129. </script>