From 3b1516afe54cfa95a37b3356e7910c7ad57b32db Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期六, 25 三月 2023 18:40:29 +0800 Subject: [PATCH] 优化录像配置。不再使用zlm默认的http服务器 --- web_src/src/components/CloudRecordDetail.vue | 57 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 15 deletions(-) diff --git a/web_src/src/components/CloudRecordDetail.vue b/web_src/src/components/CloudRecordDetail.vue index fd4e439..bacd96f 100644 --- a/web_src/src/components/CloudRecordDetail.vue +++ b/web_src/src/components/CloudRecordDetail.vue @@ -18,8 +18,7 @@ <i class="el-icon-video-camera" ></i> {{ item.substring(0,17)}} </el-tag> -<!-- <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/${mediaServerId}/record/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" download />--> - <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${basePath}/download.html?url=${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" /> + <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${getFileBasePath()}/download.html?url=download/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" /> </li> </ul> </div> @@ -30,7 +29,7 @@ </el-aside> <el-main style="padding: 22px"> <div class="playBox" :style="playerStyle"> - <player ref="recordVideoPlayer" :videoUrl="videoUrl" fluent autoplay :height="true" ></player> + <player ref="recordVideoPlayer" :videoUrl="videoUrl" :height="true" style="width: 100%" ></player> </div> <div class="player-option-box" > <el-slider @@ -77,7 +76,7 @@ <li class="task-list-item" v-for="(item, index) in taskListEnded" :key="index"> <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;"> <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span> - <a class="el-icon-download download-btn" :href="mediaServerPath + '/download.html?url=../' + item.recordFile" target="_blank"> + <a class="el-icon-download download-btn" :href="getFileBasePath() + '/download.html?url=download/' + item.recordFile" target="_blank"> </a> </div> </li> @@ -105,18 +104,18 @@ <script> // TODO 鏍规嵁鏌ヨ鐨勬椂闂村垪琛ㄨ缃粦杞ㄧ殑鏈�澶у�间笌鏈�灏忓�硷紝 - import uiHeader from './UiHeader.vue' + import uiHeader from '../layout/UiHeader.vue' import player from './dialog/easyPlayer.vue' import moment from 'moment' + import axios from "axios"; export default { name: 'app', components: { uiHeader, player }, - props: ['recordFile', 'mediaServerId', 'dateFiles', 'mediaServerPath'], + props: ['recordFile', 'mediaServerId', 'dateFiles'], data() { return { - basePath: `${this.mediaServerPath}/record`, dateFilesObj: [], detailFiles: [], chooseDate: null, @@ -252,8 +251,10 @@ count: that.count } }).then(function (res) { - that.total = res.data.data.total; - that.detailFiles = that.detailFiles.concat(res.data.data.list); + if (res.data.code === 0) { + that.total = res.data.data.total; + that.detailFiles = that.detailFiles.concat(res.data.data.list); + } that.loading = false; if (callback) callback(); }).catch(function (error) { @@ -266,11 +267,21 @@ if (file == null) { this.videoUrl = ""; }else { - // TODO 鎺у埗鍒楄〃婊氬姩鏉� - this.videoUrl = `${this.basePath}/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}` + this.videoUrl = `${this.getFileBasePath()}/download/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}` + console.log(this.videoUrl) } + }, + + getFileBasePath(){ + let basePath = "" + if (axios.defaults.baseURL.startsWith("http")) { + basePath = `${axios.defaults.baseURL}/record_proxy/${this.mediaServerId}` + }else { + basePath = `${window.location.origin}${axios.defaults.baseURL}/record_proxy/${this.mediaServerId}` + } + return basePath; }, getDataWidth(item){ @@ -319,7 +330,20 @@ let h = parseInt(val/3600); let m = parseInt((val - h*3600)/60); let s = parseInt(val - h*3600 - m*60); - return h + ":" + m + ":" + s + + let hStr = h; + let mStr = m; + let sStr = s; + if (h < 10) { + hStr = "0" + hStr; + } + if (m < 10) { + mStr = "0" + mStr;s + } + if (s < 10) { + sStr = "0" + sStr; + } + return hStr + ":" + mStr + ":" + sStr }, deleteRecord(){ // TODO @@ -332,7 +356,7 @@ count: that.count } }).then(function (res) { - if (res.data.code == 0) { + if (res.data.code === 0) { that.total = res.data.data.total; that.recordList = res.data.data.list; } @@ -402,7 +426,7 @@ endTime: moment(this.taskTimeRange[1]).format('YYYY-MM-DD HH:mm:ss'), } }).then(function (res) { - if (res.data.code === 0 && res.data.msg === "success") { + if (res.data.code === 0 ) { that.showTaskBox = false that.getTaskList(false); }else { @@ -424,7 +448,7 @@ isEnd: isEnd, } }).then(function (res) { - if (res.data.code == 0) { + if (res.data.code === 0) { if (isEnd){ that.taskListEnded = res.data.data; }else { @@ -434,6 +458,9 @@ }).catch(function (error) { console.log(error); }); + }, + goBack(){ + this.$router.push('/cloudRecord'); } } }; -- Gitblit v1.8.0