This commit is contained in:
hanchaobo
2024-04-16 09:53:41 +08:00
+29 -11
View File
@@ -7,7 +7,9 @@
<el-form-item> <el-form-item>
<el-input placeholder="请输入房间号" v-model="enterRoomFrom.roomId"> <el-input placeholder="请输入房间号" v-model="enterRoomFrom.roomId">
<template slot="append"> <template slot="append">
<el-button type="primary" @click="enterRoom" icon="el-icon-right">进入</el-button> <el-button type="primary" @click="enterRoom" icon="el-icon-right"
>进入</el-button
>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@@ -17,7 +19,7 @@
</template> </template>
<script> <script>
import { reserveConferenceList } from "@/api/home.js"; import { reserveConferenceList, getEncryptInfoByid } from "@/api/home.js";
import TRTC from "trtc-sdk-v5"; import TRTC from "trtc-sdk-v5";
let trtc = null; let trtc = null;
export default { export default {
@@ -31,10 +33,17 @@ export default {
userCode: null, userCode: null,
caseId: null, caseId: null,
roleFlag: false, roleFlag: false,
token:"" token: "",
queryObj: {},
}; };
}, },
methods: { methods: {
/**获取链接参数 */
async getEncryptInfoByidFn(data) {
await getEncryptInfoByid(data).then((res) => {
this.queryObj = res;
});
},
async enterRoom() { async enterRoom() {
// if (this.roomId != this.enterRoomFrom.roomId) { // if (this.roomId != this.enterRoomFrom.roomId) {
// this.$message({ // this.$message({
@@ -51,35 +60,44 @@ export default {
flag: this.roleFlag, flag: this.roleFlag,
caseId: this.caseId, caseId: this.caseId,
id: this.userCode, id: this.userCode,
token: this.token token: this.token,
} },
}); });
}, },
submitRoom() { submitRoom() {
this.$refs["formLabelAlign"].validate(valid => {}); this.$refs["formLabelAlign"].validate((valid) => {});
}, },
// 根据案件id查询主持人信息 // 根据案件id查询主持人信息
async reserveConferenceListFn(data) { async reserveConferenceListFn(data) {
await reserveConferenceList(data).then(res => { await reserveConferenceList(data).then((res) => {
if (res.data.length >= 1) { if (res.data.length >= 1) {
if (this.userCode == res.data[0].userId) { if (this.userCode == res.data[0].userId) {
this.roleFlag = true; this.roleFlag = true;
} else { } else {
this.roleFlag = false; this.roleFlag = false;
} }
}else{ } else {
this.roleFlag = false; this.roleFlag = false;
} }
}); });
} },
}, },
async mounted() { async mounted() {
let routeParams = this.$route.query; let routeParams = this.$route.query;
await this.getEncryptInfoByidFn(routeParams.authId);
if (routeParams.authId) {
this.userId = this.queryObj.userName;
this.roomId = this.queryObj.roomId;
this.userCode = this.queryObj.userId;
this.caseId = this.queryObj.caseId;
this.token = this.queryObj.token;
} else {
this.userId = routeParams.name; this.userId = routeParams.name;
this.roomId = routeParams.roomId; this.roomId = routeParams.roomId;
this.userCode = routeParams.userId; this.userCode = routeParams.userId;
this.caseId = routeParams.id; this.caseId = routeParams.id;
this.token = routeParams.token; this.token = routeParams.token;
}
if (this.caseId) { if (this.caseId) {
await this.reserveConferenceListFn(this.caseId); await this.reserveConferenceListFn(this.caseId);
await this.enterRoom(); await this.enterRoom();
@@ -87,10 +105,10 @@ export default {
trtc = TRTC.create(); trtc = TRTC.create();
const config = { const config = {
view: document.getElementById("video"), view: document.getElementById("video"),
publish: false publish: false,
}; };
await trtc.startLocalVideo(config); await trtc.startLocalVideo(config);
} },
}; };
</script> </script>