Browse Source

feat: 通话组件去掉详情接口

chenhao 2 years ago
parent
commit
98316d9593

+ 8 - 5
src/features/invigilation/RealtimeMonitoring/RealtimeMonitoringFull.vue

@@ -72,6 +72,7 @@
     <InvigilationStudentTalk
       ref="talkDialog"
       :record-id="operationStudent['talk'].examRecordId"
+      :data="operationStudent['talk']"
       @talking="onTalking"
       @muted-change="videoAllMuted"
     />
@@ -240,15 +241,15 @@ export default {
     },
 
     onOperation({ type, data }) {
-      if (type === "video" || type === "back-call") {
-        this.operationStudent["talk"] = data;
+      const newData = { ...data, examStudentName: data.name };
+      if (type === "video") {
+        this.operationStudent["talk"] = newData;
       }
-      this.operationStudent[type] = data;
+      this.operationStudent[type] = newData;
       const operationMap = {
         message: this.toSendTextMsg,
         voice: this.toSendAudioMsg,
         talk: () => this.toTalk(),
-        "back-call": () => this.toTalk(),
         video: () => this.toTalk(true),
       };
       this.$nextTick(() => {
@@ -292,7 +293,9 @@ export default {
 
     /** 回拨 */
     onBackCall(data) {
-      this.onOperation({ type: "back-call", data });
+      this.operationStudent["back-call"] = data;
+      this.operationStudent["talk"] = data;
+      this.toTalk();
     },
 
     /** 通话中事件... */

+ 13 - 12
src/features/invigilation/RealtimeMonitoring/components/InvigilationStudentTalk.vue

@@ -18,13 +18,10 @@
     <div class="communication-wait" v-show="isWaiting">
       <p class="communication-wait-tips">等待接听…</p>
       <div class="communication-wait-avatar">
-        <img
-          :src="detailInfo.basePhotoPath"
-          :alt="detailInfo.examStudentName"
-        />
+        <img :src="data.basePhotoPath" :alt="data.examStudentName" />
       </div>
       <p class="communication-wait-username">
-        {{ detailInfo.examStudentName }}
+        {{ data.examStudentName }}
       </p>
       <div class="communication-wait-action" @mousedown.stop>
         <el-button round type="danger" @click="hangup">取消通话</el-button>
@@ -34,7 +31,7 @@
 </template>
 
 <script>
-import { invigilateDetail, getUserMonitorKey } from "@/api/invigilation";
+import { getUserMonitorKey } from "@/api/invigilation";
 import {
   checkSystemRequirements,
   createClient,
@@ -59,10 +56,14 @@ export default {
     recordId: {
       type: String,
     },
+    data: {
+      type: Object,
+      default: () => ({}),
+    },
   },
   data() {
     return {
-      detailInfo: {},
+      // detailInfo: {},
       dialogVisible: false,
       isWaiting: false,
       isHandUp: false,
@@ -80,13 +81,13 @@ export default {
   },
   methods: {
     async initData() {
-      await this.getInvigilateDetail().catch(() => {});
+      // await this.getInvigilateDetail().catch(() => {});
       this.holding = false;
     },
-    async getInvigilateDetail() {
-      const res = await invigilateDetail(this.recordId);
-      this.detailInfo = res.data.data;
-    },
+    // async getInvigilateDetail() {
+    //   const res = await invigilateDetail(this.recordId);
+    //   this.detailInfo = res.data.data;
+    // },
     async initClient(recordId) {
       const res = await getUserMonitorKey(recordId);
       this.userMonitor = res.data.data;