仲裁视频会议H5

homeh5.vue 2.9KB

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