|
|
@@ -1,12 +1,12 @@
|
|
|
<template>
|
|
|
<el-row class="movie-list">
|
|
|
- <el-col :md="16">
|
|
|
+ <el-col v-if="camDetail !== null" :md="16">
|
|
|
<el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
- <h3 v-html="video.title" />
|
|
|
+ <h3 v-html="camDetail.camName" />
|
|
|
</div>
|
|
|
- <div class="text item">
|
|
|
+ <div id="videoplayer" class="text item">
|
|
|
<div id="dplayer" ref="dplayer" style="height: 480px;" />
|
|
|
</div>
|
|
|
</el-card>
|
|
|
@@ -17,7 +17,7 @@
|
|
|
<el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
- <el-select v-model="cam" placeholder="选择摄像头" @change="onSelect">
|
|
|
+ <el-select v-model="camNameModel" placeholder="选择摄像头" @change="onSelect">
|
|
|
<el-option
|
|
|
v-for="item in camList"
|
|
|
:key="item.value"
|
|
|
@@ -25,52 +25,7 @@
|
|
|
:value="item.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
- </div>
|
|
|
- <div class="text item">
|
|
|
- <el-calendar v-if="showCalender" v-model="calendarDate">
|
|
|
- <div
|
|
|
- slot="dateCell"
|
|
|
- slot-scope="{ date, data }"
|
|
|
- @click="handleCellClick(date, data)"
|
|
|
- >
|
|
|
- <p>{{ data.day.split("-").slice(2).join() }}</p>
|
|
|
- <p v-if="dealMyDate(data.day)" class="blue budge" />
|
|
|
- </div>
|
|
|
- </el-calendar>
|
|
|
- </div>
|
|
|
- </el-card>
|
|
|
- </el-row>
|
|
|
- <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
- <el-card v-if="showRecordList" class="box-card">
|
|
|
- <div slot="header" class="clearfix">
|
|
|
- <el-row>
|
|
|
- <h3>列表</h3>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
- <div class="text item">
|
|
|
- <el-table
|
|
|
- :data="recordList"
|
|
|
- :show-header="false"
|
|
|
- height="480"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- prop="title"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <router-link :to="`/vidlist/${scope.row.videoId}`">
|
|
|
- <span>{{ scope.row.title | ellipsis }}</span>
|
|
|
- </router-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="duration"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.duration }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <el-button style="float: right; padding: 3px 0" type="text" @click="goToCamRecord">历史录像</el-button>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-row>
|
|
|
@@ -82,7 +37,7 @@
|
|
|
<script>
|
|
|
import flvjs from 'flv.js'
|
|
|
import DPlayer from 'dplayer'
|
|
|
-import { getCamDetail, getCamList, getCamRecord, getCamRecordByMonth, getCamRecordByDay } from '@/api/cam'
|
|
|
+import { getCamDetail, getCamList } from '@/api/cam'
|
|
|
|
|
|
export default {
|
|
|
name: 'LivePage',
|
|
|
@@ -109,7 +64,7 @@ export default {
|
|
|
dateMap: new Map(),
|
|
|
showRecordList: false,
|
|
|
camList: [],
|
|
|
- cam: null,
|
|
|
+ camNameModel: null,
|
|
|
camDetail: null,
|
|
|
form: {},
|
|
|
recordList: [],
|
|
|
@@ -118,26 +73,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- calendarDate: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- const oldMonth = this.getYearMonth(oldValue)
|
|
|
- const newMonth = this.getYearMonth(newValue)
|
|
|
- if (oldMonth !== newMonth) {
|
|
|
- this.showCalender = false
|
|
|
- this.form.yearMonth = this.getYearMonth(newValue)
|
|
|
- getCamRecordByMonth(this.form).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.dateMap.clear()
|
|
|
- for (const item of resp.data) {
|
|
|
- const date1 = new Date(item)
|
|
|
- const dayStr = this.getYearMonthDay(date1)
|
|
|
- this.dateMap.set(dayStr, date1)
|
|
|
- }
|
|
|
- }
|
|
|
- this.showCalender = true
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ $route() {
|
|
|
+ this.$router.go()
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -146,29 +83,23 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- this.cam = camId
|
|
|
- this.form.camId = camId
|
|
|
- this.form.yearMonth = this.getYearMonth(new Date())
|
|
|
- getCamRecordByMonth(this.form).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.dateMap.clear()
|
|
|
- for (const item of resp.data) {
|
|
|
- const date1 = new Date(item)
|
|
|
- const dayStr = this.getYearMonthDay(date1)
|
|
|
- console.log(date1)
|
|
|
- console.log(dayStr)
|
|
|
- this.dateMap.set(dayStr, date1)
|
|
|
- }
|
|
|
- this.showCalender = true
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
getCamDetail(camId).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
|
var camDetail = resp.data
|
|
|
- // console.log(camDetail)
|
|
|
- // const url = camDetail.url
|
|
|
- // this.initFlvPlayer(camId, null, url)
|
|
|
+ this.camDetail = camDetail
|
|
|
+ this.camNameModel = camDetail.camName
|
|
|
+ document.title = camDetail.camName + '实时录像'
|
|
|
+
|
|
|
+ if (!camDetail.state) {
|
|
|
+ const msg = camDetail.camName + '离线'
|
|
|
+ console.log(msg)
|
|
|
+ var container = document.getElementById('videoplayer')
|
|
|
+ console.log(container)
|
|
|
+ // container.innerHTML = msg
|
|
|
+ } else {
|
|
|
+ const pullUrl = camDetail.pullUrl
|
|
|
+ this.initFlvPlayer(camId, null, pullUrl)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -177,90 +108,15 @@ export default {
|
|
|
this.camList = resp.data
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- const recordId = '857500422144'
|
|
|
- getCamRecord(recordId).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- const respData = resp.data
|
|
|
- this.initMp4Player(respData.coverUrl, respData.videoUrl)
|
|
|
- }
|
|
|
- })
|
|
|
},
|
|
|
methods: {
|
|
|
onSelect(value) {
|
|
|
- this.form.camId = value
|
|
|
- this.form.yearMonth = this.getYearMonth(this.calendarDate)
|
|
|
- this.showCalender = false
|
|
|
- getCamRecordByMonth(this.form).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- for (const item of resp.data) {
|
|
|
- const date1 = new Date(item)
|
|
|
- const dayStr = this.getYearMonthDay(date1)
|
|
|
- this.dateMap.set(dayStr, date1)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.showCalender = true
|
|
|
- })
|
|
|
- },
|
|
|
- handleCellClick(date, data) {
|
|
|
- /* this.form.yearMonthDay = this.getYearMonthDay(date)
|
|
|
- getCamRecordByDay(this.form).then(resp => {
|
|
|
- if (resp.code === 0) {
|
|
|
- this.showRecordList = true
|
|
|
- this.recordList = resp.data
|
|
|
- }
|
|
|
- })*/
|
|
|
- },
|
|
|
- dealMyDate(val) {
|
|
|
- let res = ''
|
|
|
-
|
|
|
- /* this.potDate = [
|
|
|
- { date: '2024-02-02', hasRecord: true },
|
|
|
- { date: '2024-02-01', hasRecord: true }
|
|
|
- ]
|
|
|
- for (let i = 0; i < this.potDate.length; i++) {
|
|
|
- if (this.potDate[i].date === val) {
|
|
|
- res = this.potDate[i].hasRecord
|
|
|
- break
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
- if (this.dateMap.get(val) != null) {
|
|
|
- res = true
|
|
|
+ const path = '/my/cam/live/' + value
|
|
|
+ if (this.$route.path === path) {
|
|
|
+ this.$router.go(0)
|
|
|
+ return
|
|
|
}
|
|
|
- return res
|
|
|
- },
|
|
|
- getYearMonth(date) {
|
|
|
- const year = date.getFullYear().toString().padStart(4, '0')
|
|
|
- const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
|
|
- // const day = date.getDate().toString().padStart(2, '0')
|
|
|
- // const hour = date.getHours().toString().padStart(2, '0')
|
|
|
- // const minute = date.getMinutes().toString().padStart(2, '0')
|
|
|
- // const second = date.getSeconds().toString().padStart(2, '0')
|
|
|
- // 2023-02-16 08:25:05
|
|
|
- // console.log(`${year}-${month}-${day} ${hour}:${minute}:${second}`)
|
|
|
- return year + '-' + month
|
|
|
- },
|
|
|
- getYearMonthDay(date) {
|
|
|
- const year = date.getFullYear().toString().padStart(4, '0')
|
|
|
- const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
|
|
- const day = date.getDate().toString().padStart(2, '0')
|
|
|
- return year + '-' + month + '-' + day
|
|
|
- },
|
|
|
- initMp4Player(coverUrl, videoUrl) {
|
|
|
- new DPlayer({
|
|
|
- container: document.getElementById('dplayer'),
|
|
|
- lang: 'zh-cn',
|
|
|
- autoplay: true,
|
|
|
- volume: 0.1,
|
|
|
- mutex: true,
|
|
|
- video: {
|
|
|
- pic: coverUrl,
|
|
|
- url: videoUrl,
|
|
|
- hotkey: true
|
|
|
- }
|
|
|
- })
|
|
|
+ this.$router.push(path)
|
|
|
},
|
|
|
initFlvPlayer(videoId, coverUrl, videoUrl) {
|
|
|
new DPlayer({
|
|
|
@@ -281,6 +137,14 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ goToCamRecord() {
|
|
|
+ const path = '/my/cam/record/' + this.camDetail.camId
|
|
|
+ if (this.$route.path === path) {
|
|
|
+ this.$router.go(0)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$router.push(path)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -321,5 +185,4 @@ export default {
|
|
|
.blue{
|
|
|
background-color: #409eff;
|
|
|
}
|
|
|
-
|
|
|
</style>
|