speechTest.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <s-layout
  3. title="话术测试"
  4. navbar="inner"
  5. :bgStyle="state.page"
  6. :navbarStyle="state.navigationBar"
  7. showBackButton
  8. >
  9. <view v-if="state.isTest" class="test_tips call_test_tips">将在30秒内拨电话给您<br>请耐心等待……</view>
  10. <view v-else class="test_tips">
  11. 点击下方按钮<br>
  12. AI智能体将拨打带有话术内容的电话给您<br>
  13. 请您注意接听<br>
  14. </view>
  15. <button v-if="!(state.isTest&&!state.isNext)" class="submit_btn" :loading="state.loading" @click="submitForm">{{state.isNext?'下一步':'接听测试电话'}}</button>
  16. </s-layout>
  17. </template>
  18. <script setup>
  19. import { reactive, computed } from 'vue'
  20. import { onLoad } from '@dcloudio/uni-app'
  21. import taskApi from '@/common/api/member/task'
  22. import sheep from '@/common'
  23. const state = reactive({
  24. navigationBar: {},
  25. page: {
  26. backgroundColor: '#FFFFFF',
  27. backgroundImage: '/static/homeTopBg.png'
  28. },
  29. isTest: false,
  30. isNext: false,
  31. loading: false
  32. })
  33. const taskFormInfo = computed(() => sheep.$store('task').taskFormInfo)
  34. onLoad((options) => {
  35. if(options.isTest){
  36. submitForm()
  37. }
  38. })
  39. async function submitForm(){
  40. if(state.isTest){
  41. sheep.$router.go('/pages/task/speechConfirm')
  42. state.isTest = false
  43. return
  44. }
  45. // if(taskFormInfo.value.callPlatform==='YI_WISE'){
  46. state.isNext = false
  47. state.isTest = true
  48. state.loading = true
  49. const { code, data } = await taskApi.addTest({
  50. typeId:taskFormInfo.value.typeId,
  51. taskName:taskFormInfo.value.name
  52. })
  53. if (code === 1) {
  54. sheep.$store('task').updateTaskFormInfo({
  55. callUserTestId:data.id
  56. })
  57. state.isTest = true
  58. setTimeout(()=>{
  59. state.isNext = true
  60. },15*1000)
  61. }else{
  62. state.isTest = false
  63. }
  64. state.loading = false
  65. // }else{
  66. // sheep.$router.go('/pages/public/webview', {
  67. // url:encodeURIComponent(`/webphone.html?ws=wss&ip=test.webphone.noai.top&port=1360&extnumber=${sheep.$store('user').userInfo.phone}`),
  68. // webphone:true
  69. // })
  70. // }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .test_tips{
  75. font-weight: 400;
  76. font-size: 32rpx;
  77. color: #222222;
  78. line-height: 80rpx;
  79. text-align: center;
  80. padding-top: 344rpx;
  81. }
  82. .call_test_tips{
  83. padding-top: 344rpx;
  84. }
  85. .submit_btn{
  86. width: 630rpx;
  87. height: 104rpx;
  88. line-height: 104rpx;
  89. background: #35E89A;
  90. border-radius: 40rpx;
  91. font-weight: bold;
  92. font-size: 32rpx;
  93. color: #222222;
  94. text-align: center;
  95. position: fixed;
  96. left: calc(50%);
  97. transform: translateX(-50%);
  98. bottom: 40rpx;
  99. }
  100. </style>