Commit fb4336c5e01e3cff19064945fdb47a0b4e1f9bab

Authored by 648540858
Committed by GitHub
2 parents 2d492c5b 2b1f7a47

Merge pull request #276 from brokge/fix-269

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