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