Commit b0cc14051c84af562cee794cef0f0a9551e23b9c

Authored by chenlw
1 parent 0c10e8d9

1.修复录像合并文件下载链接问题;2.时间滑道,endTime超出24小时问题。3.录像文件格式命名 startTime~endTime~duration.mp4

web_src/src/components/CloudRecordDetail.vue
1 <template> 1 <template>
2 <div id="recordDetail"> 2 <div id="recordDetail">
3 <el-container> 3 <el-container>
4 - <el-aside width="300px"> 4 + <el-aside width="260px">
5 <div class="record-list-box-box"> 5 <div class="record-list-box-box">
6 - <el-date-picker size="mini" v-model="chooseDate" :picker-options="pickerOptions" type="date" value-format="yyyy-MM-dd" placeholder="日期" @change="dateChange()"></el-date-picker> 6 + <div style="margin-top: 20px">
  7 + <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>
  8 + <el-button size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; margin-left: 12px " title="裁剪合并" @click="drawerOpen"></el-button>
  9 + </div>
7 <div class="record-list-box" :style="recordListStyle"> 10 <div class="record-list-box" :style="recordListStyle">
8 <ul v-if="detailFiles.length >0" class="infinite-list record-list" v-infinite-scroll="infiniteScroll" > 11 <ul v-if="detailFiles.length >0" class="infinite-list record-list" v-infinite-scroll="infiniteScroll" >
9 - <li v-for="item in detailFiles" class="infinite-list-item record-list-item" > 12 + <li v-for="(item,index) in detailFiles" :key="index" class="infinite-list-item record-list-item" >
10 <el-tag v-if="choosedFile != item" @click="chooseFile(item)"> 13 <el-tag v-if="choosedFile != item" @click="chooseFile(item)">
11 <i class="el-icon-video-camera" ></i> 14 <i class="el-icon-video-camera" ></i>
12 {{ item.substring(0,17)}} 15 {{ item.substring(0,17)}}
@@ -23,9 +26,7 @@ @@ -23,9 +26,7 @@
23 <div v-if="detailFiles.length ==0" class="record-list-no-val" >暂无数据</div> 26 <div v-if="detailFiles.length ==0" class="record-list-no-val" >暂无数据</div>
24 </div> 27 </div>
25 28
26 - <div class="record-list-option">  
27 - <el-button size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; " title="裁剪合并" @click="drawerOpen"></el-button>  
28 - </div> 29 +
29 </el-aside> 30 </el-aside>
30 <el-main style="padding: 22px"> 31 <el-main style="padding: 22px">
31 <div class="playBox" :style="playerStyle"> 32 <div class="playBox" :style="playerStyle">
@@ -44,7 +45,7 @@ @@ -44,7 +45,7 @@
44 :marks="playTimeSliderMarks"> 45 :marks="playTimeSliderMarks">
45 </el-slider> 46 </el-slider>
46 <div class="slider-val-box"> 47 <div class="slider-val-box">
47 - <div class="slider-val" v-for="item of detailFiles" :style="'width:' + getDataWidth(item) + '%; left:' + getDataLeft(item) + '%'"></div> 48 + <div class="slider-val" v-for="(item,index) of detailFiles" :key="index" :style="'width:' + getDataWidth(item) + '%; left:' + getDataLeft(item) + '%'"></div>
48 </div> 49 </div>
49 </div> 50 </div>
50 51
@@ -61,7 +62,7 @@ @@ -61,7 +62,7 @@
61 <el-tab-pane name="running"> 62 <el-tab-pane name="running">
62 <span slot="label"><i class="el-icon-scissors"></i>进行中</span> 63 <span slot="label"><i class="el-icon-scissors"></i>进行中</span>
63 <ul class="task-list"> 64 <ul class="task-list">
64 - <li class="task-list-item" v-for="item in taskListForRuning"> 65 + <li class="task-list-item" v-for="(item,index) in taskListForRuning" :key="index">
65 <div class="task-list-item-box"> 66 <div class="task-list-item-box">
66 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span> 67 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span>
67 <el-progress :percentage="(parseFloat(item.percentage)*100).toFixed(1)"></el-progress> 68 <el-progress :percentage="(parseFloat(item.percentage)*100).toFixed(1)"></el-progress>
@@ -73,10 +74,10 @@ @@ -73,10 +74,10 @@
73 <el-tab-pane name="ended"> 74 <el-tab-pane name="ended">
74 <span slot="label"><i class="el-icon-finished"></i>已完成</span> 75 <span slot="label"><i class="el-icon-finished"></i>已完成</span>
75 <ul class="task-list"> 76 <ul class="task-list">
76 - <li class="task-list-item" v-for="item in taskListEnded"> 77 + <li class="task-list-item" v-for="(item, index) in taskListEnded" :key="index">
77 <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;"> 78 <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;">
78 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span> 79 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span>
79 - <a class="el-icon-download download-btn" :href="basePath + '/download.html?url=../' + item.recordFile" target="_blank"> 80 + <a class="el-icon-download download-btn" :href="mediaServerPath + '/download.html?url=../' + item.recordFile" target="_blank">
80 </a> 81 </a>
81 </div> 82 </div>
82 </li> 83 </li>
@@ -115,7 +116,7 @@ @@ -115,7 +116,7 @@
115 props: ['recordFile', 'mediaServerId', 'dateFiles', 'mediaServerPath'], 116 props: ['recordFile', 'mediaServerId', 'dateFiles', 'mediaServerPath'],
116 data() { 117 data() {
117 return { 118 return {
118 - basePath: `${this.mediaServerPath}`, 119 + basePath: `${this.mediaServerPath}/record`,
119 dateFilesObj: [], 120 dateFilesObj: [],
120 detailFiles: [], 121 detailFiles: [],
121 chooseDate: null, 122 chooseDate: null,
@@ -146,6 +147,7 @@ @@ -146,6 +147,7 @@
146 "margin-bottom": "20px", 147 "margin-bottom": "20px",
147 "height": this.winHeight + "px", 148 "height": this.winHeight + "px",
148 }, 149 },
  150 + timeFormat:'00:00:00',
149 winHeight: window.innerHeight - 240, 151 winHeight: window.innerHeight - 240,
150 playTime: 0, 152 playTime: 0,
151 playTimeSliderMarks: { 153 playTimeSliderMarks: {
@@ -212,7 +214,7 @@ @@ -212,7 +214,7 @@
212 this.currentPage = 1; 214 this.currentPage = 1;
213 this.sliderMIn= 0; 215 this.sliderMIn= 0;
214 this.sliderMax= 86400; 216 this.sliderMax= 86400;
215 - let chooseFullDate = new Date(this.chooseDate + " " + "00:00:00"); 217 + let chooseFullDate = new Date(this.chooseDate +" " + this.timeFormat);
216 if (chooseFullDate.getFullYear() !== this.queryDate.getFullYear() 218 if (chooseFullDate.getFullYear() !== this.queryDate.getFullYear()
217 || chooseFullDate.getMonth() !== this.queryDate.getMonth()){ 219 || chooseFullDate.getMonth() !== this.queryDate.getMonth()){
218 // this.getDateInYear() 220 // this.getDateInYear()
@@ -221,8 +223,8 @@ @@ -221,8 +223,8 @@
221 if (this.detailFiles.length > 0){ 223 if (this.detailFiles.length > 0){
222 let timeForFile = this.getTimeForFile(this.detailFiles[0]); 224 let timeForFile = this.getTimeForFile(this.detailFiles[0]);
223 let lastTimeForFile = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1]); 225 let lastTimeForFile = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1]);
224 - let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + "00:00:00").getTime()  
225 - let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + "00:00:00").getTime() 226 + let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
  227 + let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
226 228
227 this.playTime = parseInt(timeNum/1000) 229 this.playTime = parseInt(timeNum/1000)
228 this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60)) 230 this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60))
@@ -278,14 +280,14 @@ @@ -278,14 +280,14 @@
278 }, 280 },
279 getDataLeft(item){ 281 getDataLeft(item){
280 let timeForFile = this.getTimeForFile(item); 282 let timeForFile = this.getTimeForFile(item);
281 - let differenceTime = timeForFile[0].getTime() - new Date(this.chooseDate + " 00:00:00").getTime() 283 + let differenceTime = timeForFile[0].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
282 return parseFloat((differenceTime - this.sliderMIn * 1000)/((this.sliderMax - this.sliderMIn)*1000))*100 ; 284 return parseFloat((differenceTime - this.sliderMIn * 1000)/((this.sliderMax - this.sliderMIn)*1000))*100 ;
283 }, 285 },
284 playTimeChange(val){ 286 playTimeChange(val){
285 let minTime = this.getTimeForFile(this.detailFiles[0])[0] 287 let minTime = this.getTimeForFile(this.detailFiles[0])[0]
286 let maxTime = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1])[1]; 288 let maxTime = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1])[1];
287 this.chooseFile(null); 289 this.chooseFile(null);
288 - let timeMilli = new Date(this.chooseDate + " 00:00:00").getTime() + val*1000 290 + let timeMilli = new Date(this.chooseDate + " " + this.timeFormat).getTime() + val*1000
289 if (timeMilli >= minTime.getTime() && timeMilli <= maxTime.getTime()){ 291 if (timeMilli >= minTime.getTime() && timeMilli <= maxTime.getTime()){
290 for (let i = 0; i < this.detailFiles.length; i++) { 292 for (let i = 0; i < this.detailFiles.length; i++) {
291 let timeForFile = this.getTimeForFile(this.detailFiles[i]); 293 let timeForFile = this.getTimeForFile(this.detailFiles[i]);
@@ -299,10 +301,20 @@ @@ -299,10 +301,20 @@
299 }, 301 },
300 getTimeForFile(file){ 302 getTimeForFile(file){
301 let timeStr = file.substring(0,17); 303 let timeStr = file.substring(0,17);
302 - let starTime = new Date(this.chooseDate + " " + timeStr.split("-")[0]);  
303 - let endTime = new Date(this.chooseDate + " " + timeStr.split("-")[1]); 304 + if(timeStr.indexOf("~") > 0){
  305 + timeStr = timeStr.replaceAll("-",":")
  306 + }
  307 + let timeArr = timeStr.split("~");
  308 + let starTime = new Date(this.chooseDate + " " + timeArr[0]);
  309 + let endTime = new Date(this.chooseDate + " " + timeArr[1]);
  310 + if(this.checkIsOver24h(starTime,endTime)){
  311 + endTime = new Date(this.chooseDate + " " + "23:59:59");
  312 + }
304 return [starTime, endTime, endTime.getTime() - starTime.getTime()]; 313 return [starTime, endTime, endTime.getTime() - starTime.getTime()];
305 }, 314 },
  315 + checkIsOver24h(starTime,endTime){
  316 + return starTime > endTime;
  317 + },
306 playTimeFormat(val){ 318 playTimeFormat(val){
307 let h = parseInt(val/3600); 319 let h = parseInt(val/3600);
308 let m = parseInt((val - h*3600)/60); 320 let m = parseInt((val - h*3600)/60);