StudentMonitorRecord.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div class="student-monitor-record">
  3. <div class="record-header">
  4. <div class="header-info">
  5. <span class="header-info-name">
  6. <i class="icon icon-user-act"></i>
  7. {{ info.examStudentName }}
  8. </span>
  9. <span class="header-info-item"> 证件号:{{ info.identity }} </span>
  10. <span class="header-info-item"> 课程:{{ info.courseName }} </span>
  11. <span class="header-info-item">
  12. 批次名称:{{ info.examBatchName }}
  13. </span>
  14. <span class="header-info-item"> 考试时间:{{ info.examTime }} </span>
  15. </div>
  16. <div>
  17. <el-button
  18. v-for="source in videoSources"
  19. :key="source.monitorKey"
  20. :type="
  21. curSource.monitorKey === source.monitorKey ? 'primary' : 'info'
  22. "
  23. @click="switchVideo(source)"
  24. >{{ videoSourceInfo[source.monitorKey] }}</el-button
  25. >
  26. </div>
  27. </div>
  28. <div class="record-body">
  29. <div class="record-video">
  30. <video
  31. :src="curSourceUrl"
  32. controls
  33. controlslist="nodownload"
  34. disablePictureInPicture
  35. @error="videoError"
  36. @loadeddata="videoLoad($event)"
  37. ></video>
  38. </div>
  39. </div>
  40. <div class="record-footer">
  41. <i class="icon icon-error"></i>
  42. <span
  43. >提示:无法正常播放,请<i
  44. class="color-primary record-qr"
  45. @click="modalIsShow = true"
  46. >扫描二维码</i
  47. >。</span
  48. >
  49. </div>
  50. <!-- qr-code -->
  51. <el-dialog
  52. custom-class="record-code-dialog"
  53. :visible.sync="modalIsShow"
  54. width="280px"
  55. :close-on-click-modal="false"
  56. :close-on-press-escape="false"
  57. append-to-body
  58. destroy-on-close
  59. >
  60. <div class="record-close" @click="modalIsShow = false">
  61. <i class="el-icon-close"></i>
  62. </div>
  63. <div class="record-qrcode">
  64. <vue-qrcode
  65. :value="curSourceUrl"
  66. :options="{ width: 200, margin: 0 }"
  67. tag="img"
  68. ></vue-qrcode>
  69. <p class="record-tips">请扫描二维码</p>
  70. </div>
  71. </el-dialog>
  72. </div>
  73. </template>
  74. <script>
  75. import VueQrcode from "@chenfengyuan/vue-qrcode";
  76. export default {
  77. name: "StudentMonitorRecord",
  78. components: { VueQrcode },
  79. data() {
  80. return {
  81. info: {
  82. examStudentName: "夏燕",
  83. },
  84. videoSources: [
  85. {
  86. monitorKey: "MOBILE_FIRST",
  87. monitorKeyName: "",
  88. urls: [],
  89. },
  90. {
  91. monitorKey: "MOBILE_SECOND",
  92. monitorKeyName: "",
  93. urls: [],
  94. },
  95. {
  96. monitorKey: "CLIENT_CAMERA",
  97. monitorKeyName: "",
  98. urls: [],
  99. },
  100. {
  101. monitorKey: "CLIENT_SCREEN",
  102. monitorKeyName: "",
  103. urls: [],
  104. },
  105. ],
  106. videoSourceInfo: {
  107. CLIENT_CAMERA: "电脑摄像头",
  108. CLIENT_SCREEN: "电脑录屏",
  109. MOBILE_FIRST: "手机主机位",
  110. MOBILE_SECOND: "手机辅机位",
  111. },
  112. curSource: {},
  113. curSourceUrl: "http://localhost:8176/files/big_buck_bunny.mp4",
  114. modalIsShow: false,
  115. };
  116. },
  117. methods: {
  118. switchVideo(source) {
  119. this.curSource = source;
  120. },
  121. videoError() {
  122. this.$message.error("视频解析错误,您可以尝试扫描二维码,通过手机观看。");
  123. },
  124. videoLoad(event) {
  125. console.log(event);
  126. },
  127. },
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. .student-monitor-record {
  132. position: absolute;
  133. width: 100%;
  134. height: 100%;
  135. z-index: auto;
  136. top: 0;
  137. left: 0;
  138. background-color: #f0f4f9;
  139. color: #626a82;
  140. font-weight: bold;
  141. }
  142. .record-header {
  143. position: absolute;
  144. height: 56px;
  145. width: 100%;
  146. left: 0;
  147. top: 0;
  148. background-color: #fff;
  149. z-index: 9;
  150. padding: 12px 20px;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. .header-info-name {
  155. font-size: 18px;
  156. vertical-align: middle;
  157. }
  158. .icon-user-act {
  159. margin-top: -3px;
  160. margin-right: 8px;
  161. }
  162. .header-info-item {
  163. padding: 0 12px;
  164. vertical-align: middle;
  165. &:not(:last-child) {
  166. border-right: 1px solid #abb8c9;
  167. }
  168. }
  169. .el-button--info {
  170. border-color: #f0f4f9;
  171. background: #f0f4f9;
  172. border-radius: 6px;
  173. color: #273a62;
  174. &:hover {
  175. border-color: #1886fe;
  176. background: #1886fe;
  177. color: #fff;
  178. }
  179. }
  180. }
  181. .record-body {
  182. padding: 76px 20px 70px;
  183. height: 100%;
  184. }
  185. .record-video {
  186. background: #000000;
  187. border-radius: 6px;
  188. height: 100%;
  189. overflow: hidden;
  190. > video {
  191. display: block;
  192. width: 100%;
  193. height: 100%;
  194. }
  195. }
  196. .record-footer {
  197. position: absolute;
  198. width: 100%;
  199. left: 0;
  200. bottom: 34px;
  201. text-align: center;
  202. .icon {
  203. margin-right: 10px;
  204. margin-top: -1px;
  205. }
  206. .record-qr {
  207. color: #1886fe;
  208. text-decoration: underline;
  209. font-style: normal;
  210. cursor: pointer;
  211. &:hover {
  212. color: mix(#333, #1886fe, 20%);
  213. }
  214. }
  215. }
  216. </style>
  217. <style lang="scss">
  218. .record-code-dialog {
  219. position: absolute;
  220. left: 50%;
  221. top: 50%;
  222. transform: translate(-50%, -50%);
  223. margin: 0 !important;
  224. .el-dialog__header,
  225. .el-dialog__footer {
  226. display: none;
  227. }
  228. .el-dialog__body {
  229. position: relative;
  230. padding: 40px 40px 30px 40px;
  231. text-align: center;
  232. font-size: 12px;
  233. }
  234. .record-close {
  235. position: absolute;
  236. height: 20px;
  237. width: 20px;
  238. font-size: 16px;
  239. line-height: 20px;
  240. top: 8px;
  241. right: 8px;
  242. z-index: 9;
  243. color: #959fb1;
  244. cursor: pointer;
  245. &:hover {
  246. color: #fe5863;
  247. }
  248. }
  249. .record-tips {
  250. margin: 20px 0 0;
  251. }
  252. }
  253. </style>