仲裁视频会议H5

homepc.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div class="homepage">
  3. <div id="video"></div>
  4. <div class="enterRoom">
  5. <div class="title">仲裁会议室</div>
  6. <div class="enterForm">
  7. <el-form :model="enterRoomFrom" ref="enterRoomFrom">
  8. <el-form-item>
  9. <el-input placeholder="请输入房间号" v-model="enterRoomFrom.roomId">
  10. <template slot="append">
  11. <el-button type="primary" @click="enterRoom" icon="el-icon-right">进入</el-button>
  12. </template>
  13. </el-input>
  14. </el-form-item>
  15. </el-form>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { reserveConferenceList } from "@/api/home.js";
  22. import TRTC from "trtc-sdk-v5";
  23. let trtc = null;
  24. export default {
  25. name: "App",
  26. data() {
  27. return {
  28. formLabelAlign: {},
  29. enterRoomFrom: {},
  30. trtc: null,
  31. userId: null,
  32. userCode: null,
  33. caseId: null,
  34. roleFlag: false
  35. };
  36. },
  37. methods: {
  38. async enterRoom() {
  39. // if (this.roomId != this.enterRoomFrom.roomId) {
  40. // this.$message({
  41. // message: "房间号不是对应案件的房间号",
  42. // type: 'error'
  43. // });
  44. // return
  45. // }
  46. this.$router.push({
  47. name: "Room",
  48. query: {
  49. userId: this.userId,
  50. roomId: this.roomId,
  51. flag: this.roleFlag,
  52. caseId: this.caseId,
  53. id: this.userCode
  54. }
  55. });
  56. },
  57. submitRoom() {
  58. this.$refs["formLabelAlign"].validate(valid => {});
  59. },
  60. // 根据案件id查询主持人信息
  61. async reserveConferenceListFn(data) {
  62. await reserveConferenceList(data).then(res => {
  63. if (res.data.length >= 1) {
  64. if (this.userCode == res.data[0].userId) {
  65. this.roleFlag = true;
  66. } else {
  67. this.roleFlag = false;
  68. }
  69. }else{
  70. this.roleFlag = false;
  71. }
  72. });
  73. }
  74. },
  75. async mounted() {
  76. let routeParams = this.$route.query;
  77. this.userId = routeParams.name;
  78. this.roomId = routeParams.roomId;
  79. this.userCode = routeParams.userId;
  80. this.caseId = routeParams.id;
  81. if (this.caseId) {
  82. await this.reserveConferenceListFn(this.caseId);
  83. await this.enterRoom();
  84. }
  85. trtc = TRTC.create();
  86. const config = {
  87. view: document.getElementById("video"),
  88. publish: false
  89. };
  90. await trtc.startLocalVideo(config);
  91. }
  92. };
  93. </script>
  94. <style scoped>
  95. .homepage {
  96. width: 100%;
  97. height: 100vh;
  98. background-color: #302e2e;
  99. display: flex;
  100. align-items: center;
  101. justify-content: space-around;
  102. }
  103. #video {
  104. width: 40%;
  105. height: 50%;
  106. }
  107. .enterRoom {
  108. width: 20%;
  109. height: 50%;
  110. background-color: #1c1b1b;
  111. }
  112. .reservation {
  113. width: 20%;
  114. height: 50%;
  115. background-color: #1c1b1b;
  116. }
  117. .title {
  118. width: 100%;
  119. text-align: center;
  120. color: #3f1ab7;
  121. line-height: 30px;
  122. font-size: 18px;
  123. margin-bottom: 20px;
  124. }
  125. .enterForm {
  126. width: 100%;
  127. display: flex;
  128. justify-content: center;
  129. }
  130. </style>