|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<el-row class="movie-list">
|
|
|
- <el-col :md="15">
|
|
|
+ <el-col :md="16">
|
|
|
<el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
@@ -12,10 +12,67 @@
|
|
|
</el-card>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
- <el-col :md="9">
|
|
|
+ <el-col :md="8">
|
|
|
<el-row>
|
|
|
<el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
- <user-avatar-card :user-avatar="user" />
|
|
|
+ <el-card class="box-card">
|
|
|
+ <div slot="header" class="clearfix">
|
|
|
+ <el-select v-model="cam" placeholder="选择摄像头" @change="onSelect">
|
|
|
+ <el-option
|
|
|
+ v-for="item in camList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.name"
|
|
|
+ :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="dateMap.get(data.day) != null">{{ '✔️' }}</p>
|
|
|
+ </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>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
</el-row>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
@@ -23,16 +80,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import flvjs from 'flv.js'
|
|
|
+import DPlayer from 'dplayer'
|
|
|
import LivePlayer from 'components/LivePlayer'
|
|
|
-import UserAvatarCard from '@/components/card/UserAvatarCard'
|
|
|
+import { getCamList, getCamRecordDay, getCamRecordList } from '@/api/cam'
|
|
|
|
|
|
export default {
|
|
|
name: 'LivePage',
|
|
|
- components: { LivePlayer, UserAvatarCard },
|
|
|
+ components: { LivePlayer },
|
|
|
data() {
|
|
|
return {
|
|
|
+ flvjs,
|
|
|
+ DPlayer,
|
|
|
video: {
|
|
|
- videoId: 'jk1024',
|
|
|
+ videoId: 110120119,
|
|
|
title: '我的直播',
|
|
|
description: '我的直播',
|
|
|
view: 10,
|
|
|
@@ -50,24 +111,120 @@ export default {
|
|
|
autoPlay: false,
|
|
|
playlist: []
|
|
|
},
|
|
|
- similarVideos: [],
|
|
|
- isCollected: false,
|
|
|
- showErrorReportDialog: false,
|
|
|
- errorReportForm: {
|
|
|
- videoId: null,
|
|
|
- errorCode: null
|
|
|
- },
|
|
|
showPlaylist: false,
|
|
|
- autoPlay: false
|
|
|
+ autoPlay: false,
|
|
|
+ playList: {
|
|
|
+ current: 0,
|
|
|
+ list: [
|
|
|
+ 'eyNXaDnmN3',
|
|
|
+ 'WkYNYzDePp',
|
|
|
+ 'a8Vx9EGDbA',
|
|
|
+ 'a8V3D88NJK',
|
|
|
+ '4m7qMXapp1'
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ calendarDate: new Date(),
|
|
|
+ dateList: [],
|
|
|
+ dateMap: new Map(),
|
|
|
+ showCalender: false,
|
|
|
+ showRecordList: false,
|
|
|
+ camList: [],
|
|
|
+ cam: null,
|
|
|
+ form: {},
|
|
|
+ recordList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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)
|
|
|
+ getCamRecordDay(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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ getCamList().then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.camList = resp.data
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
- // 用户点击收藏
|
|
|
- collection(videoId) {
|
|
|
+ onSelect(value) {
|
|
|
+ this.showCalender = false
|
|
|
+ this.form.camId = value
|
|
|
+ this.form.yearMonth = this.getYearMonth(this.calendarDate)
|
|
|
+ getCamRecordDay(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)
|
|
|
+ getCamRecordList(this.form).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.showRecordList = true
|
|
|
+ this.recordList = resp.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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
|
|
|
},
|
|
|
- getDownloadUrl(videoId) {
|
|
|
+ initFlvPlayer(videoId, coverUrl, videoUrl) {
|
|
|
+ new DPlayer({
|
|
|
+ container: document.getElementById('dplayer'),
|
|
|
+ live: true,
|
|
|
+ video: {
|
|
|
+ url: videoUrl,
|
|
|
+ type: 'customFlv',
|
|
|
+ customType: {
|
|
|
+ customFlv: function(video, player) {
|
|
|
+ const flvPlayer = flvjs.createPlayer({
|
|
|
+ type: 'flv',
|
|
|
+ url: video.src
|
|
|
+ })
|
|
|
+ flvPlayer.attachMediaElement(video)
|
|
|
+ flvPlayer.load()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|