123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <div class="student-monitor-record">
- <div class="record-header">
- <div class="header-info">
- <span class="header-info-name">
- <i class="icon icon-user-act"></i>
- {{ info.examStudentName }}
- </span>
- <span class="header-info-item"> 证件号:{{ info.identity }} </span>
- <span class="header-info-item"> 课程:{{ info.courseName }} </span>
- <span class="header-info-item">
- 批次名称:{{ info.examBatchName }}
- </span>
- <span class="header-info-item"> 考试时间:{{ info.examTime }} </span>
- </div>
- <div>
- <el-button
- v-for="source in videoSources"
- :key="source.monitorKey"
- :type="
- curSource.monitorKey === source.monitorKey ? 'primary' : 'info'
- "
- @click="switchVideo(source)"
- >{{ videoSourceInfo[source.monitorKey] }}</el-button
- >
- </div>
- </div>
- <div class="record-body">
- <div class="record-video">
- <video
- :src="curSourceUrl"
- controls
- controlslist="nodownload"
- disablePictureInPicture
- @error="videoError"
- @loadeddata="videoLoad($event)"
- ></video>
- </div>
- </div>
- <div class="record-footer">
- <i class="icon icon-error"></i>
- <span
- >提示:无法正常播放,请<i
- class="color-primary record-qr"
- @click="modalIsShow = true"
- >扫描二维码</i
- >。</span
- >
- </div>
- <!-- qr-code -->
- <el-dialog
- custom-class="record-code-dialog"
- :visible.sync="modalIsShow"
- width="280px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- destroy-on-close
- >
- <div class="record-close" @click="modalIsShow = false">
- <i class="el-icon-close"></i>
- </div>
- <div class="record-qrcode">
- <vue-qrcode
- :value="curSourceUrl"
- :options="{ width: 200, margin: 0 }"
- tag="img"
- ></vue-qrcode>
- <p class="record-tips">请扫描二维码</p>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import VueQrcode from "@chenfengyuan/vue-qrcode";
- export default {
- name: "StudentMonitorRecord",
- components: { VueQrcode },
- data() {
- return {
- info: {
- examStudentName: "夏燕",
- },
- videoSources: [
- {
- monitorKey: "MOBILE_FIRST",
- monitorKeyName: "",
- urls: [],
- },
- {
- monitorKey: "MOBILE_SECOND",
- monitorKeyName: "",
- urls: [],
- },
- {
- monitorKey: "CLIENT_CAMERA",
- monitorKeyName: "",
- urls: [],
- },
- {
- monitorKey: "CLIENT_SCREEN",
- monitorKeyName: "",
- urls: [],
- },
- ],
- videoSourceInfo: {
- CLIENT_CAMERA: "电脑摄像头",
- CLIENT_SCREEN: "电脑录屏",
- MOBILE_FIRST: "手机主机位",
- MOBILE_SECOND: "手机辅机位",
- },
- curSource: {},
- curSourceUrl: "http://localhost:8176/files/big_buck_bunny.mp4",
- modalIsShow: false,
- };
- },
- methods: {
- switchVideo(source) {
- this.curSource = source;
- },
- videoError() {
- this.$message.error("视频解析错误,您可以尝试扫描二维码,通过手机观看。");
- },
- videoLoad(event) {
- console.log(event);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .student-monitor-record {
- position: absolute;
- width: 100%;
- height: 100%;
- z-index: auto;
- top: 0;
- left: 0;
- background-color: #f0f4f9;
- color: #626a82;
- font-weight: bold;
- }
- .record-header {
- position: absolute;
- height: 56px;
- width: 100%;
- left: 0;
- top: 0;
- background-color: #fff;
- z-index: 9;
- padding: 12px 20px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .header-info-name {
- font-size: 18px;
- vertical-align: middle;
- }
- .icon-user-act {
- margin-top: -3px;
- margin-right: 8px;
- }
- .header-info-item {
- padding: 0 12px;
- vertical-align: middle;
- &:not(:last-child) {
- border-right: 1px solid #abb8c9;
- }
- }
- .el-button--info {
- border-color: #f0f4f9;
- background: #f0f4f9;
- border-radius: 6px;
- color: #273a62;
- &:hover {
- border-color: #1886fe;
- background: #1886fe;
- color: #fff;
- }
- }
- }
- .record-body {
- padding: 76px 20px 70px;
- height: 100%;
- }
- .record-video {
- background: #000000;
- border-radius: 6px;
- height: 100%;
- overflow: hidden;
- > video {
- display: block;
- width: 100%;
- height: 100%;
- }
- }
- .record-footer {
- position: absolute;
- width: 100%;
- left: 0;
- bottom: 34px;
- text-align: center;
- .icon {
- margin-right: 10px;
- margin-top: -1px;
- }
- .record-qr {
- color: #1886fe;
- text-decoration: underline;
- font-style: normal;
- cursor: pointer;
- &:hover {
- color: mix(#333, #1886fe, 20%);
- }
- }
- }
- </style>
- <style lang="scss">
- .record-code-dialog {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- margin: 0 !important;
- .el-dialog__header,
- .el-dialog__footer {
- display: none;
- }
- .el-dialog__body {
- position: relative;
- padding: 40px 40px 30px 40px;
- text-align: center;
- font-size: 12px;
- }
- .record-close {
- position: absolute;
- height: 20px;
- width: 20px;
- font-size: 16px;
- line-height: 20px;
- top: 8px;
- right: 8px;
- z-index: 9;
- color: #959fb1;
- cursor: pointer;
- &:hover {
- color: #fe5863;
- }
- }
- .record-tips {
- margin: 20px 0 0;
- }
- }
- </style>
|