|
@@ -28,13 +28,25 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<h4 class="student-name">{{ item.examStudentName }}</h4>
|
|
|
- <el-button round type="success" @click="answer(item, 0)"
|
|
|
- >语音通话</el-button
|
|
|
- >
|
|
|
- <br />
|
|
|
- <el-button round type="primary" @click="answer(item, 1)"
|
|
|
- >视频通话</el-button
|
|
|
- >
|
|
|
+ <div v-if="callStatus === 'START'">
|
|
|
+ <el-button round type="success" @click="answer(item, 0)"
|
|
|
+ >语音通话</el-button
|
|
|
+ >
|
|
|
+ <br />
|
|
|
+ <el-button round type="primary" @click="answer(item, 1)"
|
|
|
+ >视频通话</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="student-call-info" v-else>
|
|
|
+ <p>
|
|
|
+ 通话时间段:
|
|
|
+ <span>{{ item.startTime }} ~ </span>
|
|
|
+ <span>{{ item.endTime }}</span>
|
|
|
+ </p>
|
|
|
+ <p v-if="item.durationTime">
|
|
|
+ 持续时长约:{{ item.durationTime }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -84,10 +96,12 @@
|
|
|
import { createClient, createStream } from "@/plugins/trtc";
|
|
|
import {
|
|
|
communicationList,
|
|
|
+ communicationCalling,
|
|
|
communicationOver,
|
|
|
getUserMonitorKey,
|
|
|
} from "@/api/invigilation";
|
|
|
import SecondTimer from "../common/SecondTimer";
|
|
|
+import { formatDate, timeNumberToText } from "@/utils/utils";
|
|
|
|
|
|
export default {
|
|
|
name: "video-communication",
|
|
@@ -98,6 +112,7 @@ export default {
|
|
|
callStatus: "START",
|
|
|
dialogVisible: false,
|
|
|
students: [],
|
|
|
+ curStudent: {},
|
|
|
current: 1,
|
|
|
total: 0,
|
|
|
size: 100,
|
|
@@ -123,7 +138,18 @@ export default {
|
|
|
pageNumber: this.current,
|
|
|
pageSize: this.size,
|
|
|
}).catch(() => {});
|
|
|
- this.students = res.data.data.records;
|
|
|
+ this.students = res.data.data.records.map((item) => {
|
|
|
+ item.durationTime = timeNumberToText(item.endTime - item.startTime);
|
|
|
+ item.startTime = formatDate(
|
|
|
+ "YYYY-MM-DD HH:mm:ss",
|
|
|
+ new Date(item.startTime)
|
|
|
+ );
|
|
|
+ item.endTime = formatDate(
|
|
|
+ "YYYY-MM-DD HH:mm:ss",
|
|
|
+ new Date(item.endTime)
|
|
|
+ );
|
|
|
+ return item;
|
|
|
+ });
|
|
|
this.total = res.data.data.total;
|
|
|
// 当前页没有数据,同时当前页不是第一页,则自动跳到前一页。
|
|
|
if (!this.students.length && this.current > 1) {
|
|
@@ -150,9 +176,10 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
async answer(student, isVideo) {
|
|
|
+ this.curStudent = student;
|
|
|
await this.initClient(student.examRecordId);
|
|
|
- // 结束学生的通话申请
|
|
|
- await communicationOver({
|
|
|
+ // 更改学生的通话申请状态
|
|
|
+ await communicationCalling({
|
|
|
recordId: student.examRecordId,
|
|
|
source: student.source,
|
|
|
});
|
|
@@ -227,6 +254,12 @@ export default {
|
|
|
},
|
|
|
async hangup() {
|
|
|
this.$refs.SecondTimer.end();
|
|
|
+ // 结束学生的通话
|
|
|
+ await communicationOver({
|
|
|
+ recordId: this.curStudent.examRecordId,
|
|
|
+ source: this.curStudent.source,
|
|
|
+ });
|
|
|
+ this.curStudent = {};
|
|
|
|
|
|
// 取消发布本地视频
|
|
|
let unpublishStreamResult = true;
|
|
@@ -291,5 +324,11 @@ export default {
|
|
|
line-height: 25px;
|
|
|
color: #202b4b;
|
|
|
}
|
|
|
+ .student-call-info {
|
|
|
+ p {
|
|
|
+ margin: 0;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|