From 3483980ada72793318e5c3509320d3069af95b2c Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 17 七月 2023 16:42:16 +0800
Subject: [PATCH] Merge pull request #956 from xiaoQQya/develop
---
web_src/src/components/CloudRecordDetail.vue | 106 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 75 insertions(+), 31 deletions(-)
diff --git a/web_src/src/components/CloudRecordDetail.vue b/web_src/src/components/CloudRecordDetail.vue
index a8d8224..6983b54 100644
--- a/web_src/src/components/CloudRecordDetail.vue
+++ b/web_src/src/components/CloudRecordDetail.vue
@@ -1,12 +1,15 @@
<template>
<div id="recordDetail">
<el-container>
- <el-aside width="300px">
+ <el-aside width="260px">
<div class="record-list-box-box">
- <el-date-picker size="mini" v-model="chooseDate" :picker-options="pickerOptions" type="date" value-format="yyyy-MM-dd" placeholder="鏃ユ湡" @change="dateChange()"></el-date-picker>
+ <div style="margin-top: 20px">
+ <el-date-picker size="mini" style="width: 160px" v-model="chooseDate" :picker-options="pickerOptions" type="date" value-format="yyyy-MM-dd" placeholder="鏃ユ湡" @change="dateChange()"></el-date-picker>
+ <el-button size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; margin-left: 12px " title="瑁佸壀鍚堝苟" @click="drawerOpen"></el-button>
+ </div>
<div class="record-list-box" :style="recordListStyle">
<ul v-if="detailFiles.length >0" class="infinite-list record-list" v-infinite-scroll="infiniteScroll" >
- <li v-for="item in detailFiles" class="infinite-list-item record-list-item" >
+ <li v-for="(item,index) in detailFiles" :key="index" class="infinite-list-item record-list-item" >
<el-tag v-if="choosedFile != item" @click="chooseFile(item)">
<i class="el-icon-video-camera" ></i>
{{ item.substring(0,17)}}
@@ -15,21 +18,18 @@
<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>
<div v-if="detailFiles.length ==0" class="record-list-no-val" >鏆傛棤鏁版嵁</div>
</div>
- <div class="record-list-option">
- <el-button size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; " title="瑁佸壀鍚堝苟" @click="drawerOpen"></el-button>
- </div>
+
</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
@@ -44,7 +44,7 @@
:marks="playTimeSliderMarks">
</el-slider>
<div class="slider-val-box">
- <div class="slider-val" v-for="item of detailFiles" :style="'width:' + getDataWidth(item) + '%; left:' + getDataLeft(item) + '%'"></div>
+ <div class="slider-val" v-for="(item,index) of detailFiles" :key="index" :style="'width:' + getDataWidth(item) + '%; left:' + getDataLeft(item) + '%'"></div>
</div>
</div>
@@ -61,7 +61,7 @@
<el-tab-pane name="running">
<span slot="label"><i class="el-icon-scissors"></i>杩涜涓�</span>
<ul class="task-list">
- <li class="task-list-item" v-for="item in taskListForRuning">
+ <li class="task-list-item" v-for="(item,index) in taskListForRuning" :key="index">
<div class="task-list-item-box">
<span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span>
<el-progress :percentage="(parseFloat(item.percentage)*100).toFixed(1)"></el-progress>
@@ -73,10 +73,10 @@
<el-tab-pane name="ended">
<span slot="label"><i class="el-icon-finished"></i>宸插畬鎴�</span>
<ul class="task-list">
- <li class="task-list-item" v-for="item in taskListEnded">
+ <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="basePath + '/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>
@@ -104,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}`,
dateFilesObj: [],
detailFiles: [],
chooseDate: null,
@@ -146,6 +146,7 @@
"margin-bottom": "20px",
"height": this.winHeight + "px",
},
+ timeFormat:'00:00:00',
winHeight: window.innerHeight - 240,
playTime: 0,
playTimeSliderMarks: {
@@ -212,21 +213,25 @@
this.currentPage = 1;
this.sliderMIn= 0;
this.sliderMax= 86400;
- let chooseFullDate = new Date(this.chooseDate + " " + "00:00:00");
+ let chooseFullDate = new Date(this.chooseDate +" " + this.timeFormat);
if (chooseFullDate.getFullYear() !== this.queryDate.getFullYear()
|| chooseFullDate.getMonth() !== this.queryDate.getMonth()){
// this.getDateInYear()
}
this.queryRecordDetails(()=>{
if (this.detailFiles.length > 0){
+ console.log(this.detailFiles)
let timeForFile = this.getTimeForFile(this.detailFiles[0]);
let lastTimeForFile = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1]);
- let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + "00:00:00").getTime()
- let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + "00:00:00").getTime()
+ let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
+ console.log(timeNum)
+ let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
this.playTime = parseInt(timeNum/1000)
this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60))
+ console.log(this.sliderMIn )
this.sliderMax = parseInt(lastTimeNum/1000 - lastTimeNum/1000%(60*60)) + 60*60
+ console.log(this.sliderMax )
}
});
},
@@ -250,8 +255,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) {
@@ -264,11 +271,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){
@@ -278,14 +295,14 @@
},
getDataLeft(item){
let timeForFile = this.getTimeForFile(item);
- let differenceTime = timeForFile[0].getTime() - new Date(this.chooseDate + " 00:00:00").getTime()
+ let differenceTime = timeForFile[0].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
return parseFloat((differenceTime - this.sliderMIn * 1000)/((this.sliderMax - this.sliderMIn)*1000))*100 ;
},
playTimeChange(val){
let minTime = this.getTimeForFile(this.detailFiles[0])[0]
let maxTime = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1])[1];
this.chooseFile(null);
- let timeMilli = new Date(this.chooseDate + " 00:00:00").getTime() + val*1000
+ let timeMilli = new Date(this.chooseDate + " " + this.timeFormat).getTime() + val*1000
if (timeMilli >= minTime.getTime() && timeMilli <= maxTime.getTime()){
for (let i = 0; i < this.detailFiles.length; i++) {
let timeForFile = this.getTimeForFile(this.detailFiles[i]);
@@ -298,16 +315,40 @@
}
},
getTimeForFile(file){
+ console.log(file)
let timeStr = file.substring(0,17);
- let starTime = new Date(this.chooseDate + " " + timeStr.split("-")[0]);
- let endTime = new Date(this.chooseDate + " " + timeStr.split("-")[1]);
+ if(timeStr.indexOf("~") > 0){
+ timeStr = timeStr.replaceAll("-",":")
+ }
+ let timeArr = timeStr.split("-");
+ let starTime = new Date(this.chooseDate + " " + timeArr[0]);
+ let endTime = new Date(this.chooseDate + " " + timeArr[1]);
+ if(this.checkIsOver24h(starTime,endTime)){
+ endTime = new Date(this.chooseDate + " " + "23:59:59");
+ }
return [starTime, endTime, endTime.getTime() - starTime.getTime()];
+ },
+ checkIsOver24h(starTime,endTime){
+ return starTime > endTime;
},
playTimeFormat(val){
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
@@ -320,7 +361,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;
}
@@ -390,7 +431,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 {
@@ -412,7 +453,7 @@
isEnd: isEnd,
}
}).then(function (res) {
- if (res.data.code == 0) {
+ if (res.data.code === 0) {
if (isEnd){
that.taskListEnded = res.data.data;
}else {
@@ -422,6 +463,9 @@
}).catch(function (error) {
console.log(error);
});
+ },
+ goBack(){
+ this.$router.push('/cloudRecord');
}
}
};
--
Gitblit v1.8.0