Commit b0cc14051c84af562cee794cef0f0a9551e23b9c

Authored by chenlw
1 parent 0c10e8d9

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

web_src/src/components/CloudRecordDetail.vue
1 1 <template>
2 2 <div id="recordDetail">
3 3 <el-container>
4   - <el-aside width="300px">
  4 + <el-aside width="260px">
5 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 10 <div class="record-list-box" :style="recordListStyle">
8 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 13 <el-tag v-if="choosedFile != item" @click="chooseFile(item)">
11 14 <i class="el-icon-video-camera" ></i>
12 15 {{ item.substring(0,17)}}
... ... @@ -23,9 +26,7 @@
23 26 <div v-if="detailFiles.length ==0" class="record-list-no-val" >暂无数据</div>
24 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 30 </el-aside>
30 31 <el-main style="padding: 22px">
31 32 <div class="playBox" :style="playerStyle">
... ... @@ -44,7 +45,7 @@
44 45 :marks="playTimeSliderMarks">
45 46 </el-slider>
46 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 49 </div>
49 50 </div>
50 51  
... ... @@ -61,7 +62,7 @@
61 62 <el-tab-pane name="running">
62 63 <span slot="label"><i class="el-icon-scissors"></i>进行中</span>
63 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 66 <div class="task-list-item-box">
66 67 <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span>
67 68 <el-progress :percentage="(parseFloat(item.percentage)*100).toFixed(1)"></el-progress>
... ... @@ -73,10 +74,10 @@
73 74 <el-tab-pane name="ended">
74 75 <span slot="label"><i class="el-icon-finished"></i>已完成</span>
75 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 78 <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;">
78 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 81 </a>
81 82 </div>
82 83 </li>
... ... @@ -115,7 +116,7 @@
115 116 props: ['recordFile', 'mediaServerId', 'dateFiles', 'mediaServerPath'],
116 117 data() {
117 118 return {
118   - basePath: `${this.mediaServerPath}`,
  119 + basePath: `${this.mediaServerPath}/record`,
119 120 dateFilesObj: [],
120 121 detailFiles: [],
121 122 chooseDate: null,
... ... @@ -146,6 +147,7 @@
146 147 "margin-bottom": "20px",
147 148 "height": this.winHeight + "px",
148 149 },
  150 + timeFormat:'00:00:00',
149 151 winHeight: window.innerHeight - 240,
150 152 playTime: 0,
151 153 playTimeSliderMarks: {
... ... @@ -212,7 +214,7 @@
212 214 this.currentPage = 1;
213 215 this.sliderMIn= 0;
214 216 this.sliderMax= 86400;
215   - let chooseFullDate = new Date(this.chooseDate + " " + "00:00:00");
  217 + let chooseFullDate = new Date(this.chooseDate +" " + this.timeFormat);
216 218 if (chooseFullDate.getFullYear() !== this.queryDate.getFullYear()
217 219 || chooseFullDate.getMonth() !== this.queryDate.getMonth()){
218 220 // this.getDateInYear()
... ... @@ -221,8 +223,8 @@
221 223 if (this.detailFiles.length > 0){
222 224 let timeForFile = this.getTimeForFile(this.detailFiles[0]);
223 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 229 this.playTime = parseInt(timeNum/1000)
228 230 this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60))
... ... @@ -278,14 +280,14 @@
278 280 },
279 281 getDataLeft(item){
280 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 284 return parseFloat((differenceTime - this.sliderMIn * 1000)/((this.sliderMax - this.sliderMIn)*1000))*100 ;
283 285 },
284 286 playTimeChange(val){
285 287 let minTime = this.getTimeForFile(this.detailFiles[0])[0]
286 288 let maxTime = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1])[1];
287 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 291 if (timeMilli >= minTime.getTime() && timeMilli <= maxTime.getTime()){
290 292 for (let i = 0; i < this.detailFiles.length; i++) {
291 293 let timeForFile = this.getTimeForFile(this.detailFiles[i]);
... ... @@ -299,10 +301,20 @@
299 301 },
300 302 getTimeForFile(file){
301 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 313 return [starTime, endTime, endTime.getTime() - starTime.getTime()];
305 314 },
  315 + checkIsOver24h(starTime,endTime){
  316 + return starTime > endTime;
  317 + },
306 318 playTimeFormat(val){
307 319 let h = parseInt(val/3600);
308 320 let m = parseInt((val - h*3600)/60);
... ...