[部标1078] 适配新UI

This commit is contained in:
648540858
2025-05-11 08:01:45 +08:00
parent 10c75036f5
commit c4ab55a456
11 changed files with 2403 additions and 0 deletions

50
web/src/api/jtDevice.js Normal file
View File

@@ -0,0 +1,50 @@
import request from '@/utils/request'
// 部标设备API
export function queryDevices(params) {
const { page, count } = params
return request({
method: 'get',
url: `/api/jt1078/terminal/list`,
params: {
page: page,
count: count
}
})
}
export function queryDeviceById(deviceId) {
return request({
method: 'get',
url: `/api/jt1078/terminal/query`,
params: {
deviceId: deviceId
}
})
}
export function deleteDeviceById(deviceId) {
return request({
method: 'delete',
url: '/api/jt1078/terminal/delete',
params: {
deviceId: deviceId
}
})
}
export function queryChannels(params) {
const { page, count, query, deviceId } = params
return request({
method: 'get',
url: `/api/jt1078/terminal/channel/list`,
params: {
page: page,
count: count,
query: query,
deviceId: deviceId
}
})
}

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1746918194106" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9149" xmlns:xlink="http://www.w3.org/1999/xlink" ><path d="M893.612371 819.374576l-21.278629-614.998839c0-55.031361-47.635927-99.639325-106.394169-99.639325L255.245312 104.736413c-58.759265 0-106.393145 44.608987-106.393145 99.639325L127.572514 819.374576l73.747631 0c-0.535189 2.812045-0.873903 5.697769-0.873903 8.667404l0 20.224624c0 25.529443 20.695345 46.225811 46.225811 46.225811l66.451458 0c25.532513 0 46.227858-20.697391 46.227858-46.225811L359.351368 828.04198c0-2.968611-0.338714-5.854335-0.873903-8.667404l304.232003 0c-0.535189 2.812045-0.873903 5.697769-0.873903 8.667404l0 20.224624c0 25.529443 20.696368 46.225811 46.227858 46.225811l66.451458 0c25.530466 0 46.227858-20.697391 46.227858-46.225811L820.742736 828.04198c0-2.968611-0.338714-5.854335-0.873903-8.667404L893.612371 819.374576zM258.868839 723.007785c-32.264844 0-58.422597-26.157753-58.422597-58.424644 0-32.266891 26.157753-58.424644 58.422597-58.424644 32.268938 0 58.424644 26.157753 58.424644 58.424644C317.293483 696.850032 291.137777 723.007785 258.868839 723.007785zM217.490429 510.921435l7.91732-252.475222c0-55.682183 20.277836-77.706803 71.538313-77.706803l427.009304 0c51.260477 0 71.538313 22.024619 71.538313 77.706803l8.201799 252.475222L217.490429 510.921435zM762.316046 723.007785c-32.266891 0-58.424644-26.157753-58.424644-58.424644 0-32.266891 26.157753-58.424644 58.424644-58.424644 32.266891 0 58.424644 26.157753 58.424644 58.424644C820.74069 696.850032 794.582937 723.007785 762.316046 723.007785z" p-id="9150"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -86,6 +86,26 @@ export const constantRoutes = [
}
]
},
{
path: '/jtDevice',
component: Layout,
redirect: '/jtDevice',
onlyIndex: 0,
children: [
{
path: '',
name: 'JTDevice',
component: () => import('@/views/jtDevice/index'),
meta: { title: '部标设备', icon: 'jtDevice' }
},
{
path: '/jtDevice/record/:deviceId/:channelDeviceId',
name: 'JTDeviceRecord',
component: () => import('@/views/jtDevice/channel/record'),
meta: { title: '部标录像' }
}
]
},
{
path: '/push',
component: Layout,

View File

@@ -0,0 +1,50 @@
import { deleteDeviceById, queryChannels, queryDeviceById, queryDevices } from '@/api/jtDevice'
const actions = {
queryDevices({ commit }, params) {
return new Promise((resolve, reject) => {
queryDevices(params).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
},
queryDeviceById({ commit }, deviceId) {
return new Promise((resolve, reject) => {
queryDeviceById(deviceId).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
},
deleteDeviceById({ commit }, deviceId) {
return new Promise((resolve, reject) => {
deleteDeviceById(deviceId).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
},
queryChannels({ commit }, params) {
return new Promise((resolve, reject) => {
queryChannels(params).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
}
}
export default {
namespaced: true,
actions
}

View File

@@ -0,0 +1,94 @@
<template>
<div id="channelList" style="width: 100%">
<div class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
<el-divider direction="vertical"></el-divider>
编辑推流信息
</div>
<div class="page-header-btn">
<div style="display: inline;">
<el-button icon="el-icon-close" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
</div>
</div>
</div>
<el-tabs tab-position="left">
<el-tab-pane label="推流信息编辑" style="background-color: #FFFFFF; padding: 1rem">
<el-form ref="form" :rules="rules" :model="jtChannel" label-width="240px" style="display: grid; grid-template-columns: 1fr 1fr 1fr ">
<el-form-item label="编号" prop="channelId">
<el-input v-model="jtChannel.channelId" clearable></el-input>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="jtChannel.name" clearable></el-input>
</el-form-item>
</el-form>
<el-form style="text-align: right">
<el-form-item >
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button @click="close">取消</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="国标通道配置" v-if="jtChannel.id">
<CommonChannelEdit ref="commonChannelEdit" :dataForm="jtChannel" :cancel="close"></CommonChannelEdit>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import CommonChannelEdit from './common/CommonChannelEdit'
export default {
name: 'channelList',
props: [ 'jtChannel', 'closeEdit'],
components: {
CommonChannelEdit
},
data() {
return {
version: 3,
rules: {
deviceId: [{ required: true, message: "请输入设备编号", trigger: "blur" }]
},
winHeight: window.innerHeight - 200,
isLoading: false,
loadSnap: {},
};
},
mounted() {},
methods: {
onSubmit: function () {
console.log(this.jtChannel)
let isEdit = typeof (this.jtChannel.id) !== "undefined"
this.$axios({
method: 'post',
url:`/api/jt1078/terminal/channel/${isEdit?'update':'add'}/`,
params: this.jtChannel
}).then((res) => {
console.log(res.data)
if (res.data.code === 0) {
this.$message({
showClose: true,
message: "保存成功",
type: "success",
});
this.jtChannel = res.data.data
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
}).catch(function (error) {
console.log(error);
});
},
close: function () {
this.closeEdit()
},
}
};
</script>

View File

@@ -0,0 +1,326 @@
<template>
<div id="channelList" style="width: 100%">
<div v-if="!jtChannel">
<div class="page-header" >
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" ></el-button>
<el-divider direction="vertical"></el-divider>
通道列表
</div>
<div class="page-header-btn">
<div style="display: inline;">
搜索:
<el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="add">添加通道</el-button>
<el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
</div>
</div>
</div>
<el-container v-loading="isLoging" style="height: 82vh;">
<el-main style="padding: 5px;">
<el-table ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%"
header-row-class-name="table-header">
<el-table-column prop="channelId" label="通道编号" min-width="180">
</el-table-column>
<el-table-column prop="name" label="名称" min-width="180">
</el-table-column>
<el-table-column label="快照" min-width="100">
<template v-slot:default="scope">
<el-image
:src="getSnap(scope.row)"
:preview-src-list="getBigSnap(scope.row)"
@error="getSnapErrorEvent(scope.row.deviceId, scope.row.channelId)"
:fit="'contain'"
style="width: 60px">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</template>
</el-table-column>
<el-table-column label="开启音频" min-width="100">
<template slot-scope="scope">
<el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" min-width="340" fixed="right">
<template slot-scope="scope">
<el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-video-play"
type="text" @click="sendDevicePush(scope.row)">播放
</el-button>
<el-button size="medium" v-bind:disabled="device == null || device.online === 0"
icon="el-icon-switch-button"
type="text" style="color: #f56c6c" v-if="!!scope.row.stream"
@click="stopDevicePush(scope.row)">停止
</el-button>
<el-divider direction="vertical"></el-divider>
<el-button
size="medium"
type="text"
icon="el-icon-edit"
@click="handleEdit(scope.row)"
>
编辑
</el-button>
<el-divider direction="vertical"></el-divider>
<el-dropdown @command="(command)=>{moreClick(command, scope.row)}">
<el-button size="medium" type="text" >
更多功能<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="records" v-bind:disabled="device == null || device.online === 0">
设备录像</el-dropdown-item>
<el-dropdown-item command="cloudRecords" v-bind:disabled="device == null || device.online === 0" >
云端录像</el-dropdown-item>
<!-- <el-dropdown-item command="shooting" v-bind:disabled="device == null || device.online === 0" >-->
<!-- 立即拍摄</el-dropdown-item>-->
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-pagination
style="float: right"
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="currentPage"
:page-size="count"
:page-sizes="[15, 25, 35, 50]"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</el-main>
</el-container>
</div>
<devicePlayer ref="devicePlayer"></devicePlayer>
<channelEdit v-if="jtChannel" ref="channelEdit" :jtChannel="jtChannel" :closeEdit="closeEdit"></channelEdit>
<!--设备列表-->
</div>
</template>
<script>
import devicePlayer from './dialog/jtDevicePlayer.vue'
import uiHeader from '../layout/UiHeader.vue'
import DeviceTree from "./common/DeviceTree";
import channelEdit from "./JTChannelEdit.vue";
import JTDeviceService from "./service/JTDeviceService";
export default {
name: 'channelList',
components: {
channelEdit,
devicePlayer,
uiHeader,
DeviceTree
},
data() {
return {
deviceService: new JTDeviceService(),
device: null,
deviceId: this.$route.params.deviceId,
deviceChannelList: [],
updateLooper: 0, //数据刷新轮训标志
searchSrt: "",
channelType: "",
online: "",
winHeight: window.innerHeight - 200,
currentPage: 1,
count: 15,
total: 0,
beforeUrl: "/jtDeviceList",
isLoging: false,
loadSnap: {},
jtChannel: null,
};
},
mounted() {
this.initParam();
this.initData();
},
destroyed() {
this.$destroy('videojs');
clearTimeout(this.updateLooper);
},
methods: {
initData: function () {
this.getDeviceChannelList();
},
initParam: function () {
this.deviceId = this.$route.params.deviceId;
this.currentPage = 1;
this.count = 15;
this.deviceService.getDevice(this.deviceId, (result) => {
if (result.code === 0) {
this.device = result.data;
}
}, (error) => {
console.log("获取设备信息失败")
console.error(error)
})
},
currentChange: function (val) {
this.currentPage = val;
this.initData();
},
handleSizeChange: function (val) {
this.count = val;
this.getDeviceChannelList();
},
getDeviceChannelList: function () {
if (typeof (this.deviceId) == "undefined") return;
this.deviceService.getAllChannel(this.currentPage, this.count, this.searchSrt, this.deviceId, (data)=>{
console.log(data)
if (data.code === 0) {
this.total = data.data.total;
this.deviceChannelList = data.data.list;
// 防止出现表格错位
this.$nextTick(() => {
this.$refs.channelListTable.doLayout();
})
}
})
},
//通知设备上传媒体流
sendDevicePush: function (itemData) {
this.isLoging = true;
let channelId = itemData.channelId;
console.log("通知设备推流1" + this.device.phoneNumber + " : " + channelId);
this.$axios({
method: 'get',
url: '/api/jt1078/live/start',
params: {
phoneNumber: this.device.phoneNumber,
channelId: channelId,
type: 0,
}
}).then((res)=> {
this.isLoging = false;
if (res.data.code === 0) {
setTimeout(() => {
let snapId = this.device.phoneNumber + "_" + channelId;
this.loadSnap[this.device.phoneNumber + channelId] = 0;
this.getSnapErrorEvent(snapId)
}, 5000)
itemData.streamId = res.data.data.stream;
this.$refs.devicePlayer.openDialog("media", this.device.phoneNumber, channelId, {
streamInfo: res.data.data,
hasAudio: itemData.hasAudio
});
setTimeout(() => {
this.initData();
}, 1000)
} else {
this.$message.error(res.data.msg);
}
}).catch((e)=> {
console.error(e)
this.isLoging = false;
// that.$message.error("请求超时");
});
},
moreClick: function (command, itemData) {
if (command === "records") {
this.queryRecords(itemData)
}else if (command === "cloudRecords") {
this.queryCloudRecords(itemData)
}else {
this.$message.info("尚不支持");
}
},
queryRecords: function (itemData) {
this.$router.push(`/jtRecordDetail/${this.device.phoneNumber}/${itemData.channelId}`)
},
queryCloudRecords: function (itemData) {
let deviceId = this.deviceId;
let channelId = itemData.channelId;
this.$router.push(`/cloudRecordDetail/rtp/${deviceId}_${channelId}`)
},
stopDevicePush: function (itemData) {
this.$axios({
method: 'get',
url: '/api/jt1078/live/stop',
params: {
phoneNumber: this.device.phoneNumber,
channelId: itemData.channelId,
}
}).then((res)=> {
console.log(res)
if (res.data.code === 0) {
this.initData();
}else {
this.$message.error(res.data.msg);
}
}).catch(function (error) {
console.error(error)
});
},
getSnap: function (row) {
let baseUrl = window.baseUrl ? window.baseUrl : "";
return ((process.env.NODE_ENV === 'development') ? process.env.BASE_API : baseUrl) + '/api/device/query/snap/' + this.device.phoneNumber + '/' + row.channelId;
},
getBigSnap: function (row) {
return [this.getSnap(row)]
},
getSnapErrorEvent: function (deviceId, channelId) {
if (typeof (this.loadSnap[deviceId + channelId]) != "undefined") {
console.log("下载截图" + this.loadSnap[deviceId + channelId])
if (this.loadSnap[deviceId + channelId] > 5) {
delete this.loadSnap[deviceId + channelId];
return;
}
setTimeout(() => {
let url = (process.env.NODE_ENV === 'development' ? "debug" : "") + '/api/device/query/snap/' + deviceId + '/' + channelId
this.loadSnap[deviceId + channelId]++
document.getElementById(deviceId + channelId).setAttribute("src", url + '?' + new Date().getTime())
}, 1000)
}
},
showDevice: function () {
this.$router.push(this.beforeUrl).then(() => {
this.initParam();
this.initData();
})
},
search: function () {
this.currentPage = 1;
this.total = 0;
this.initData();
},
updateChannel: function (row) {
this.$axios({
method: 'post',
url: `/api/jt1078/terminal/channel/update`,
params: row
}).then(function (res) {
console.log(JSON.stringify(res));
});
},
refresh: function () {
this.initData();
},
add: function () {
this.jtChannel = {
terminalDbId: this.deviceId
};
},
// 编辑
handleEdit(row) {
this.jtChannel = row;
},
// 编辑
closeEdit(row) {
this.jtChannel = null;
}
}
};
</script>

View File

@@ -0,0 +1,536 @@
<template>
<div style="width: 100%">
<div class="page-header" >
<div class="page-title">
<el-page-header @back="goBack" content="部标录像"></el-page-header>
</div>
</div>
<el-container>
<el-aside width="300px">
<div class="record-list-box-box">
<el-date-picker size="mini" v-model="chooseDate" type="date" value-format="yyyy-MM-dd" placeholder="日期" @change="dateChange()"></el-date-picker>
<div class="record-list-box" v-loading="recordsLoading" :style="recordListStyle">
<ul v-if="detailFiles.length >0" class="infinite-list record-list" >
<li v-for="item in detailFiles" class="infinite-list-item record-list-item" >
<el-tag v-if="chooseFile !== item" @click="checkedFile(item)">
<i class="el-icon-video-camera" ></i>
{{ moment(item.startTime).format('HH:mm:ss')}}-{{ moment(item.endTime).format('HH:mm:ss')}}
</el-tag>
<el-tag v-if="chooseFile === item" type="danger" >
<i class="el-icon-video-camera" ></i>
{{ moment(item.startTime).format('HH:mm:ss')}}-{{ moment(item.endTime).format('HH:mm:ss')}}
</el-tag>
<i style="color: #409EFF;margin-left: 5px;" class="el-icon-download" @click="downloadRecord(item)" ></i>
</li>
</ul>
</div>
<div size="mini" v-if="detailFiles.length ==0" class="record-list-no-val" >暂无数据</div>
</div>
</el-aside>
<el-main style="padding-bottom: 10px;">
<div class="playBox" :style="playerStyle">
<player ref="recordVideoPlayer"
:videoUrl="videoUrl"
:error="videoError"
:message="videoError"
:hasAudio="hasAudio"
style="max-height: 100%"
fluent autoplay live ></player>
</div>
<div class="player-option-box">
<div>
<el-button-group >
<el-time-picker
size="mini"
is-range
align="left"
v-model="timeRange"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator=""
start-placeholder="开始时间"
end-placeholder="结束时间"
@change="timePickerChange"
placeholder="选择时间范围">
</el-time-picker>
</el-button-group>
<el-button-group >
<el-button size="mini" class="iconfont icon-zanting" title="开始" @click="control(0, 0)"></el-button>
<el-button size="mini" class="iconfont icon-kaishi" title="暂停" @click="control(1, 0)"></el-button>
<el-button size="mini" class="iconfont icon-stop" title="结束" @click="control(2, 0)"></el-button>
<el-dropdown size="mini" title="播放倍速" @command="scale">
<el-button size="mini">
快进/快退 <i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="[3, 1]">正常快进</el-dropdown-item>
<el-dropdown-item :command="[3, 2]">2倍速快进</el-dropdown-item>
<el-dropdown-item :command="[3, 4]">4倍速快进</el-dropdown-item>
<el-dropdown-item :command="[3, 8]">8倍速快进</el-dropdown-item>
<el-dropdown-item :command="[3, 16]">16倍速快进</el-dropdown-item>
<el-dropdown-item :command="[4, 1]">正常快退</el-dropdown-item>
<el-dropdown-item :command="[4, 2]">2倍速快退</el-dropdown-item>
<el-dropdown-item :command="[4, 4]">4倍速快退</el-dropdown-item>
<el-dropdown-item :command="[4, 8]">8倍速快退</el-dropdown-item>
<el-dropdown-item :command="[4, 16]">16倍速快退</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button size="mini" class="iconfont icon-xiazai1" title="下载选定录像" @click="downloadRecord()"></el-button>
<el-button v-if="sliderMIn === 0 && sliderMax === 86400" size="mini" class="iconfont icon-slider" title="放大滑块" @click="setSliderFit()"></el-button>
<el-button v-if="sliderMIn !== 0 || sliderMax !== 86400" size="mini" class="iconfont icon-slider-right" title="恢复滑块" @click="setSliderFit()"></el-button>
</el-button-group>
</div>
<el-slider
class="playtime-slider"
v-model="playTime"
id="playtimeSlider"
:disabled="detailFiles.length === 0"
:min="sliderMIn"
:max="sliderMax"
:range="true"
:format-tooltip="playTimeFormat"
@change="playTimeChange"
:marks="playTimeSliderMarks">
</el-slider>
<div class="slider-val-box">
<div class="slider-val" v-for="item of detailFiles" :style="'width:' + getDataWidth(item) + '%; left:' + getDataLeft(item) + '%'"></div>
</div>
</div>
</el-main>
</el-container>
</div>
</template>
<script>
import uiHeader from '../layout/UiHeader.vue'
import player from './common/jessibuca.vue'
import moment from 'moment'
import JTDeviceService from "./service/JTDeviceService";
export default {
name: 'app',
components: {
uiHeader, player
},
data() {
return {
phoneNumber: this.$route.params.phoneNumber,
channelId: this.$route.params.channelId,
deviceService: new JTDeviceService(),
recordsLoading: false,
streamId: "",
hasAudio: false,
detailFiles: [],
chooseDate: null,
videoUrl: null,
chooseFile: null,
streamInfo: null,
app: null,
mediaServerId: null,
ssrc: null,
sliderMIn: 0,
sliderMax: 86400,
autoPlay: true,
taskUpdate: null,
tabVal: "running",
recordListStyle: {
height: this.winHeight + "px",
overflow: "auto",
margin: "10px auto 10px auto"
},
playerStyle: {
"margin": "0 auto 20px auto",
"height": this.winHeight + "px",
},
winHeight: window.innerHeight - 240,
playTime: null,
timeRange: null,
startTime: null,
endTime: null,
playTimeSliderMarks: {
0: "00:00",
3600: "01:00",
7200: "02:00",
10800: "03:00",
14400: "04:00",
18000: "05:00",
21600: "06:00",
25200: "07:00",
28800: "08:00",
32400: "09:00",
36000: "10:00",
39600: "11:00",
43200: "12:00",
46800: "13:00",
50400: "14:00",
54000: "15:00",
57600: "16:00",
61200: "17:00",
64800: "18:00",
68400: "19:00",
72000: "20:00",
75600: "21:00",
79200: "22:00",
82800: "23:00",
86400: "24:00",
},
};
},
computed: {
},
mounted() {
this.recordListStyle.height = this.winHeight + "px";
this.playerStyle["height"] = this.winHeight + "px";
this.chooseDate = moment().format('YYYY-MM-DD')
this.dateChange();
window.addEventListener('beforeunload', this.stopPlayRecord)
},
destroyed() {
this.$destroy('recordVideoPlayer');
window.removeEventListener('beforeunload', this.stopPlayRecord)
},
methods: {
dateChange(){
if (!this.chooseDate) {
return;
}
this.setTime(this.chooseDate + " 00:00:00", this.chooseDate + " 23:59:59");
this.recordsLoading = true;
this.detailFiles = [];
this.$axios({
method: 'get',
url: '/api/jt1078/record/list',
params: {
phoneNumber: this.phoneNumber,
channelId: this.channelId,
startTime: this.startTime,
endTime: this.endTime,
}
}).then((res)=>{
this.recordsLoading = false;
if(res.data.code === 0) {
// 处理时间信息
this.detailFiles = res.data.data;
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
}).catch((e)=> {
this.recordsLoading = false;
// that.videoHistory.searchHistoryResult = falsificationData.recordData;
});
},
moment: function (v) {
return moment(v)
},
setTime: function (startTime, endTime){
this.startTime = startTime;
this.endTime = endTime;
let start = (new Date(this.startTime).getTime() - new Date(this.chooseDate + " 00:00:00").getTime())/1000;
let end = (new Date(this.endTime).getTime() - new Date(this.chooseDate + " 00:00:00").getTime())/1000;
console.log(start)
console.log(end)
this.playTime = [start, end];
this.timeRange = [startTime, endTime];
},
videoError: function (e) {
console.log("播放器错误:" + JSON.stringify(e));
},
checkedFile(file){
this.chooseFile = file;
this.setTime(file.startTime, file.endTime);
// 开始回放
this.playRecord()
},
playRecord: function () {
if (this.streamId !== "") {
this.stopPlayRecord(()=> {
this.streamId = "";
this.playRecord();
})
} else {
this.$axios({
method: 'get',
url: '/api/jt1078/playback/start/',
params: {
phoneNumber: this.phoneNumber,
channelId: this.channelId,
startTime: this.startTime,
endTime: this.endTime,
type: 0,
rate: 0,
playbackType: 0,
playbackSpeed: 0
}
}).then((res)=> {
if (res.data.code === 0) {
this.streamInfo = res.data.data;
this.app = this.streamInfo.app;
this.streamId = this.streamInfo.stream;
this.mediaServerId = this.streamInfo.mediaServerId;
this.ssrc = this.streamInfo.ssrc;
this.videoUrl = this.getUrlByStreamInfo();
this.hasAudio = this.streamInfo.tracks && this.streamInfo.tracks.length > 1
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
});
}
},
gbPlay(){
console.log('前端控制:播放');
this.$axios({
method: 'get',
url: '/api/playback/resume/' + this.streamId
}).then((res)=> {
this.$refs["recordVideoPlayer"].play(this.videoUrl)
});
},
control(command, playbackSpeed, time){
this.$axios({
method: 'get',
url: '/api/jt1078/playback/control',
params: {
phoneNumber: this.phoneNumber,
channelId: this.channelId,
command: command,
playbackSpeed: playbackSpeed,
time: time
}
}).then(function (res) {});
},
scale(command){
this.control(command[0], command[1])
},
downloadRecord: function (row) {
let baseUrl = window.baseUrl ? window.baseUrl : "";
let downloadFile = ((process.env.NODE_ENV === 'development') ? process.env.BASE_API : baseUrl) +
`/api/jt1078/playback/download?phoneNumber=${this.phoneNumber}&channelId=${this.channelId}&startTime=${row.startTime}&endTime=${row.endTime}`+
`&alarmSign=${row.alarmSign}&mediaType=${row.mediaType}&streamType=${row.streamType}&storageType=${row.storageType}`
console.log(downloadFile)
let x = new XMLHttpRequest();
x.open("GET", downloadFile, true);
x.responseType = 'blob';
x.onload=(e)=> {
let url = window.URL.createObjectURL(x.response)
let a = document.createElement('a');
a.href = url
a.download = this.phoneNumber + "-" + this.channelId + ".mp4";
a.click()
}
x.send();
},
stopDownloadRecord: function (callback) {
this.$refs["recordVideoPlayer"].pause();
this.videoUrl = '';
this.$axios({
method: 'get',
url: '/api/gb_record/download/stop/' + this.deviceId + "/" + this.channelId+ "/" + this.streamId
}).then((res)=> {
if (callback) callback(res)
});
},
stopPlayRecord: function (callback) {
console.log("停止录像回放")
if (this.streamId !== "") {
this.$refs["recordVideoPlayer"].pause();
this.videoUrl = '';
this.$axios({
method: 'get',
url: '/api/jt1078/playback/stop/',
params: {
phoneNumber: this.phoneNumber,
channelId: this.channelId,
streamId: this.streamId
}
}).then(function (res) {
if (callback) callback()
});
}
},
getDataWidth(item){
let timeForFile = this.getTimeForFile(item);
let result = (timeForFile[2])/((this.sliderMax - this.sliderMIn)*1000)
return result*100
},
getDataLeft(item){
let timeForFile = this.getTimeForFile(item);
let differenceTime = timeForFile[0].getTime() - new Date(this.chooseDate + " 00:00:00").getTime()
return parseFloat((differenceTime - this.sliderMIn * 1000)/((this.sliderMax - this.sliderMIn)*1000))*100 ;
},
getUrlByStreamInfo(){
if (location.protocol === "https:") {
this.videoUrl = this.streamInfo["wss_flv"]
}else {
this.videoUrl = this.streamInfo["ws_flv"]
}
return this.videoUrl;
},
timePickerChange: function (val){
this.setTime(val[0], val[1])
},
playTimeChange(val){
console.log(val)
let startTimeStr = moment(new Date(this.chooseDate + " 00:00:00").getTime() + val[0]*1000).format("YYYY-MM-DD HH:mm:ss");
let endTimeStr = moment(new Date(this.chooseDate + " 00:00:00").getTime() + val[1]*1000).format("YYYY-MM-DD HH:mm:ss");
this.setTime(startTimeStr, endTimeStr)
this.playRecord();
},
setSliderFit() {
if (this.sliderMIn === 0 && this.sliderMax === 86400) {
if (this.detailFiles.length > 0){
let timeForFile = this.getTimeForFile(this.detailFiles[0]);
let lastTimeForFile = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1]);
let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + "00:00:00").getTime()
let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + "00:00:00").getTime()
this.playTime = parseInt(timeNum/1000)
this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60))
this.sliderMax = parseInt(lastTimeNum/1000 - lastTimeNum/1000%(60*60)) + 60*60
this.playTime = [this.sliderMIn, this.sliderMax];
}
}else {
this.sliderMIn = 0;
this.sliderMax = 86400;
}
},
getTimeForFile(file){
let startTime = new Date(file.startTime);
let endTime = new Date(file.endTime);
return [startTime, endTime, endTime.getTime() - startTime.getTime()];
},
playTimeFormat(val){
let h = parseInt(val/3600);
let m = parseInt((val - h*3600)/60);
let s = parseInt(val - h*3600 - m*60);
let hStr = h;
let mStr = m;
let sStr = s;
if (h < 10) {
hStr = "0" + hStr;
}
if (m < 10) {
mStr = "0" + mStr;s
}
if (s < 10) {
sStr = "0" + sStr;
}
return hStr + ":" + mStr + ":" + sStr
},
goBack(){
// 如果正在进行录像回放则,发送停止
if (this.streamId !== "") {
this.stopPlayRecord(()=> {
this.streamId = "";
})
}
window.history.go(-1);
},
}
};
</script>
<style>
.el-slider__runway {
background-color:rgba(206, 206, 206, 0.47) !important;
}
.el-slider__bar {
background-color: rgba(153, 153, 153, 0) !important;
}
.playtime-slider {
position: relative;
z-index: 100;
}
.data-picker-true{
}
.data-picker-true:after{
content: "";
position: absolute;
width: 4px;
height: 4px;
background-color: #606060;
border-radius: 4px;
left: 45%;
top: 74%;
}
.data-picker-false{
}
.slider-val-box{
height: 6px;
position: relative;
top: -22px;
}
.slider-val{
height: 6px;
background-color: #007CFF;
position: absolute;
}
.record-list-box-box{
width: 250px;
float: left;
}
.record-list-box{
overflow: auto;
width: 220px;
list-style: none;
padding: 0;
margin: 0;
margin-top: 0px;
padding: 1rem 0;
background-color: #FFF;
margin-top: 10px;
}
.record-list{
list-style: none;
padding: 0;
margin: 0;
background-color: #FFF;
}
.record-list-no-val {
position: absolute;
color: #9f9f9f;
top: 50%;
left: 110px;
}
.record-list-item{
padding: 0;
margin: 0;
margin: 0.5rem 0;
cursor: pointer;
}
.record-list-option {
width: 10px;
float: left;
margin-top: 39px;
}
.player-option-box{
padding: 0 20px;
}
</style>

88
web/src/views/jtDevice/edit.vue Executable file
View File

@@ -0,0 +1,88 @@
<template>
<div id="deviceEdit" v-loading="isLoging">
<el-dialog
title="设备编辑"
width="40%"
top="2rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
<el-form ref="form" :rules="rules" :model="form" label-width="200px" >
<el-form-item label="终端手机号" prop="phoneNumber">
<el-input v-model="form.phoneNumber" clearable></el-input>
</el-form-item>
<el-form-item>
<div style="float: right;">
<el-button type="primary" @click="onSubmit" >确认</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "deviceEdit",
props: {},
computed: {},
created() {},
data() {
return {
listChangeCallback: null,
showDialog: false,
isLoging: false,
form: {},
isEdit: false,
rules: {
deviceId: [{ required: true, message: "请输入设备编号", trigger: "blur" }]
},
};
},
methods: {
openDialog: function (row, callback) {
console.log(row)
this.showDialog = true;
this.isEdit = false;
if (row) {
this.isEdit = true;
}
this.form = {};
this.listChangeCallback = callback;
if (row != null) {
this.form = row;
}
},
onSubmit: function () {
console.log("onSubmit");
this.$axios({
method: 'post',
url:`/api/jt1078/terminal/${this.isEdit?'update':'add'}/`,
params: this.form
}).then((res) => {
console.log(res.data)
if (res.data.code === 0) {
this.listChangeCallback()
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
}).catch(function (error) {
console.log(error);
});
},
close: function () {
this.showDialog = false;
this.$refs.form.resetFields();
},
},
};
</script>

View File

@@ -0,0 +1,32 @@
<template>
<div id="device" class="app-container">
<deviceList v-show="deviceId === null" @show-channel="showChannelList" />
<channelList v-if="deviceId !== null" :device-id="deviceId" @show-device="showDevice" />
</div>
</template>
<script>
import deviceList from './list.vue'
import channelList from './channel/index.vue'
export default {
name: 'Device',
components: {
deviceList,
channelList
},
data() {
return {
deviceId: null
}
},
methods: {
showChannelList: function(deviceId) {
this.deviceId = deviceId
},
showDevice: function() {
this.deviceId = null
}
}
}
</script>

View File

@@ -0,0 +1,913 @@
<template>
<div id="devicePlayer" v-loading="isLoging">
<el-dialog title="视频播放" top="0" :close-on-click-modal="false" :visible.sync="showVideoDialog" @close="close()" v-if="showVideoDialog">
<div style="width: 100%; height: 100%">
<el-tabs type="card" :stretch="true" v-model="activePlayer" @tab-click="changePlayer"
v-if="Object.keys(this.player).length > 1">
<el-tab-pane label="Jessibuca" name="jessibuca">
<jessibucaPlayer v-if="activePlayer === 'jessibuca'" ref="jessibuca" :visible.sync="showVideoDialog"
:videoUrl="videoUrl" :error="videoError" :message="videoError"
:hasAudio="hasAudio" fluent autoplay live></jessibucaPlayer>
</el-tab-pane>
<el-tab-pane label="WebRTC" name="webRTC">
<rtc-player v-if="activePlayer === 'webRTC'" ref="webRTC" :visible.sync="showVideoDialog"
:videoUrl="videoUrl" :error="videoError" :message="videoError" height="100px"
:hasAudio="hasAudio" fluent autoplay live></rtc-player>
</el-tab-pane>
<el-tab-pane label="h265web">h265web敬请期待</el-tab-pane>
</el-tabs>
<jessibucaPlayer v-if="Object.keys(this.player).length == 1 && this.player.jessibuca" ref="jessibuca"
:visible.sync="showVideoDialog" :videoUrl="videoUrl" :error="videoError" :message="videoError"
:hasAudio="hasAudio" fluent autoplay live></jessibucaPlayer>
<rtc-player v-if="Object.keys(this.player).length == 1 && this.player.webRTC" ref="jessibuca"
:visible.sync="showVideoDialog" :videoUrl="videoUrl" :error="videoError" :message="videoError"
height="100px" :hasAudio="hasAudio" fluent autoplay live></rtc-player>
</div>
<div id="shared" style="text-align: right; margin-top: 1rem;">
<el-tabs v-model="tabActiveName" @tab-click="tabHandleClick">
<el-tab-pane label="实时视频" name="media">
<div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
<span style="width: 5rem; line-height: 2.5rem; text-align: right;">播放地址</span>
<el-input v-model="getPlayerShared.sharedUrl" :disabled="true">
<template slot="append">
<i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="getPlayerShared.sharedUrl"
@success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
</template>
</el-input>
</div>
<div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
<span style="width: 5rem; line-height: 2.5rem; text-align: right;">iframe</span>
<el-input v-model="getPlayerShared.sharedIframe" :disabled="true">
<template slot="append">
<i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="getPlayerShared.sharedIframe"
@success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
</template>
</el-input>
</div>
<div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
<span style="width: 5rem; line-height: 2.5rem; text-align: right;">资源地址</span>
<el-input v-model="getPlayerShared.sharedRtmp" :disabled="true">
<el-button slot="append" icon="el-icon-document-copy" title="点击拷贝"
v-clipboard="getPlayerShared.sharedRtmp"
@success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button>
<el-dropdown slot="prepend" v-if="streamInfo" trigger="click" @command="copyUrl">
<el-button>
更多地址<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="streamInfo.flv" :command="streamInfo.flv">
<el-tag>FLV:</el-tag>
<span>{{ streamInfo.flv }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.https_flv" :command="streamInfo.https_flv">
<el-tag>FLV(https):</el-tag>
<span>{{ streamInfo.https_flv }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.ws_flv" :command="streamInfo.ws_flv">
<el-tag>FLV(ws):</el-tag>
<span>{{ streamInfo.ws_flv }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.wss_flv" :command="streamInfo.wss_flv">
<el-tag>FLV(wss):</el-tag>
<span>{{ streamInfo.wss_flv }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.fmp4" :command="streamInfo.fmp4">
<el-tag>FMP4:</el-tag>
<span>{{ streamInfo.fmp4 }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.https_fmp4" :command="streamInfo.https_fmp4">
<el-tag>FMP4(https):</el-tag>
<span>{{ streamInfo.https_fmp4 }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.ws_fmp4" :command="streamInfo.ws_fmp4">
<el-tag>FMP4(ws):</el-tag>
<span>{{ streamInfo.ws_fmp4 }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.wss_fmp4" :command="streamInfo.wss_fmp4">
<el-tag>FMP4(wss):</el-tag>
<span>{{ streamInfo.wss_fmp4 }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.hls" :command="streamInfo.hls">
<el-tag>HLS:</el-tag>
<span>{{ streamInfo.hls }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.https_hls" :command="streamInfo.https_hls">
<el-tag>HLS(https):</el-tag>
<span>{{ streamInfo.https_hls }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.ws_hls" :command="streamInfo.ws_hls">
<el-tag>HLS(ws):</el-tag>
<span>{{ streamInfo.ws_hls }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.wss_hls" :command="streamInfo.wss_hls">
<el-tag>HLS(wss):</el-tag>
<span>{{ streamInfo.wss_hls }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.ts" :command="streamInfo.ts">
<el-tag>TS:</el-tag>
<span>{{ streamInfo.ts }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.https_ts" :command="streamInfo.https_ts">
<el-tag>TS(https):</el-tag>
<span>{{ streamInfo.https_ts }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.ws_ts" :command="streamInfo.ws_ts">
<el-tag>TS(ws):</el-tag>
<span>{{ streamInfo.ws_ts }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.wss_ts" :command="streamInfo.wss_ts">
<el-tag>TS(wss):</el-tag>
<span>{{ streamInfo.wss_ts }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.rtc" :command="streamInfo.rtc">
<el-tag>RTC:</el-tag>
<span>{{ streamInfo.rtc }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.rtcs" :command="streamInfo.rtcs">
<el-tag>RTCS:</el-tag>
<span>{{ streamInfo.rtcs }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.rtmp" :command="streamInfo.rtmp">
<el-tag>RTMP:</el-tag>
<span>{{ streamInfo.rtmp }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.rtmps" :command="streamInfo.rtmps">
<el-tag>RTMPS:</el-tag>
<span>{{ streamInfo.rtmps }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.rtsp" :command="streamInfo.rtsp">
<el-tag>RTSP:</el-tag>
<span>{{ streamInfo.rtsp }}</span>
</el-dropdown-item>
<el-dropdown-item v-if="streamInfo.rtsps" :command="streamInfo.rtsps">
<el-tag>RTSPS:</el-tag>
<span>{{ streamInfo.rtsps }}</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-input>
</div>
</el-tab-pane>
<!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}-->
<!--遥控界面-->
<el-tab-pane label="云台控制" name="control" v-if="showPtz">
<div style="display: grid; grid-template-columns: 240px auto; height: 180px; overflow: auto">
<div style="display: grid; grid-template-columns: 6.25rem auto;">
<div class="control-wrapper">
<div class="control-btn control-top" @mousedown="ptzCamera('up')" @mouseup="ptzCamera('stop')">
<i class="el-icon-caret-top"></i>
<div class="control-inner-btn control-inner"></div>
</div>
<div class="control-btn control-left" @mousedown="ptzCamera('left')" @mouseup="ptzCamera('stop')">
<i class="el-icon-caret-left"></i>
<div class="control-inner-btn control-inner"></div>
</div>
<div class="control-btn control-bottom" @mousedown="ptzCamera('down')" @mouseup="ptzCamera('stop')">
<i class="el-icon-caret-bottom"></i>
<div class="control-inner-btn control-inner"></div>
</div>
<div class="control-btn control-right" @mousedown="ptzCamera('right')" @mouseup="ptzCamera('stop')">
<i class="el-icon-caret-right"></i>
<div class="control-inner-btn control-inner"></div>
</div>
<div class="control-round">
<div class="control-round-inner"><i class="fa fa-pause-circle"></i></div>
</div>
<div class="contro-speed" style="position: absolute; left: 4px; top: 7rem; width: 6.25rem;">
<el-slider v-model="controSpeed" :max="100"></el-slider>
</div>
</div>
<div>
<div class="ptz-btn-box">
<div style="" @mousedown="ptzCamera('zoomin')" @mouseup="ptzCamera('stop')" title="变倍+">
<i class="el-icon-zoom-in control-zoom-btn" style="font-size: 1.5rem;"></i>
</div>
<div style="" @mousedown="ptzCamera('zoomout')" @mouseup="ptzCamera('stop')" title="变倍-">
<i class="el-icon-zoom-out control-zoom-btn" style="font-size: 1.5rem;"></i>
</div>
</div>
<div class="ptz-btn-box">
<div @mousedown="ptzCamera('focusnear')" @mouseup="ptzCamera('stop')" title="聚焦+">
<i class="iconfont icon-bianjiao-fangda control-zoom-btn" style="font-size: 1.5rem;"></i>
</div>
<div @mousedown="ptzCamera('focusfar')" @mouseup="ptzCamera('stop')" title="聚焦-">
<i class="iconfont icon-bianjiao-suoxiao control-zoom-btn" style="font-size: 1.5rem;"></i>
</div>
</div>
<div class="ptz-btn-box">
<div @mousedown="ptzCamera('irisin')" @mouseup="ptzCamera('stop')" title="光圈+">
<i class="iconfont icon-guangquan control-zoom-btn" style="font-size: 1.5rem;"></i>
</div>
<div @mousedown="ptzCamera('irisout')" @mouseup="ptzCamera('stop')" title="光圈-">
<i class="iconfont icon-guangquan- control-zoom-btn" style="font-size: 1.5rem;"></i>
</div>
</div>
</div>
</div>
<div style="text-align: left" >
<div style="width: 100%; display: grid; grid-template-rows: 1fr 1fr; grid-row-gap: 10px">
<el-button-group>
<el-button size="mini" @click="wiper('on')">开启雨刷
</el-button>
<el-button size="mini" @click="wiper('off')">关闭雨刷
</el-button>
</el-button-group>
<el-button-group>
<el-button size="mini" @click="fillLight('on')">开补光灯
</el-button>
<el-button size="mini" @click="fillLight('off')">关补光灯
</el-button>
</el-button-group>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="编码信息" name="codec" v-loading="tracksLoading">
<mediaInfo :app="app" :stream="streamId" :mediaServerId="mediaServerId"></mediaInfo>
</el-tab-pane>
<el-tab-pane label="语音对讲" name="broadcast">
<div class="trank" style="text-align: center;">
<el-button @click="broadcastStatusClick()" :type="getBroadcastStatus()" :disabled="broadcastStatus === -2"
circle icon="el-icon-microphone" style="font-size: 32px; padding: 24px;margin-top: 24px;"/>
<p>
<span v-if="broadcastStatus === -2">正在释放资源</span>
<span v-if="broadcastStatus === -1">点击开始对讲</span>
<span v-if="broadcastStatus === 0">等待接通中...</span>
<span v-if="broadcastStatus === 1">请说话</span>
</p>
</div>
</el-tab-pane>
</el-tabs>
</div>
</el-dialog>
</div>
</template>
<script>
import rtcPlayer from '../dialog/rtcPlayer.vue'
import LivePlayer from '@liveqing/liveplayer'
import crypto from 'crypto'
import jessibucaPlayer from '../common/jessibuca.vue'
import mediaInfo from '../common/mediaInfo.vue'
export default {
name: 'devicePlayer',
props: {},
components: {
mediaInfo,
LivePlayer, jessibucaPlayer, rtcPlayer,
},
computed: {
getPlayerShared: function () {
return {
sharedUrl: window.location.origin + '/#/play/wasm/' + encodeURIComponent(this.videoUrl),
sharedIframe: '<iframe src="' + window.location.origin + '/#/play/wasm/' + encodeURIComponent(this.videoUrl) + '"></iframe>',
sharedRtmp: this.videoUrl
};
}
},
created() {
console.log("created")
console.log(this.player)
this.broadcastStatus = -1;
if (Object.keys(this.player).length === 1) {
this.activePlayer = Object.keys(this.player)[0]
}
},
data() {
return {
video: 'http://lndxyj.iqilu.com/public/upload/2019/10/14/8c001ea0c09cdc59a57829dabc8010fa.mp4',
videoUrl: '',
activePlayer: "jessibuca",
// 如何你只是用一种播放器,直接注释掉不用的部分即可
player: {
jessibuca: ["ws_flv", "wss_flv"],
webRTC: ["rtc", "rtcs"],
},
showVideoDialog: false,
streamId: '',
app: '',
mediaServerId: '',
deviceId: '',
channelId: '',
tabActiveName: 'media',
hasAudio: false,
loadingRecords: false,
recordsLoading: false,
isLoging: false,
controSpeed: 30,
timeVal: 0,
timeMin: 0,
timeMax: 1440,
presetPos: 1,
cruisingSpeed: 100,
cruisingTime: 5,
cruisingGroup: 0,
scanSpeed: 100,
scanGroup: 0,
tracks: [],
tracksLoading: false,
showPtz: true,
showRrecord: true,
tracksNotLoaded: false,
sliderTime: 0,
seekTime: 0,
recordStartTime: 0,
showTimeText: "00:00:00",
streamInfo: null,
broadcastMode: true,
broadcastRtc: null,
broadcastStatus: -1, // -2 正在释放资源 -1 默认状态 0 等待接通 1 接通成功
};
},
methods: {
tabHandleClick: function (tab, event) {
console.log(tab)
var that = this;
that.tracks = [];
that.tracksLoading = true;
that.tracksNotLoaded = false;
if (tab.name === "codec") {
this.$axios({
method: 'get',
url: '/zlm/' + this.mediaServerId + '/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtsp&app=' + this.app + '&stream=' + this.streamId
}).then(function (res) {
that.tracksLoading = false;
if (res.data.code == 0 && res.data.tracks) {
that.tracks = res.data.tracks;
} else {
that.tracksNotLoaded = true;
that.$message({
showClose: true,
message: '获取编码信息失败,',
type: 'warning'
});
}
}).catch(function (e) {
});
}
},
changePlayer: function (tab) {
console.log(this.player[tab.name][0])
this.activePlayer = tab.name;
this.videoUrl = this.getUrlByStreamInfo()
console.log(this.videoUrl)
},
openDialog: function (tab, deviceId, channelId, param) {
if (this.showVideoDialog) {
return;
}
this.tabActiveName = tab;
this.channelId = channelId;
this.deviceId = deviceId;
this.streamId = "";
this.mediaServerId = "";
this.app = "";
this.videoUrl = ""
if (!!this.$refs[this.activePlayer]) {
this.$refs[this.activePlayer].pause();
}
switch (tab) {
case "media":
this.play(param.streamInfo, param.hasAudio)
break;
case "streamPlay":
this.tabActiveName = "media";
this.showRrecord = false;
this.showPtz = false;
this.play(param.streamInfo, param.hasAudio)
break;
case "control":
break;
}
},
play: function (streamInfo, hasAudio) {
this.streamInfo = streamInfo;
this.hasAudio = hasAudio;
this.isLoging = false;
// this.videoUrl = streamInfo.rtc;
this.videoUrl = this.getUrlByStreamInfo();
this.streamId = streamInfo.stream;
this.app = streamInfo.app;
this.mediaServerId = streamInfo.mediaServerId;
this.playFromStreamInfo(false, streamInfo)
},
getUrlByStreamInfo() {
console.log(this.streamInfo)
let streamInfo = this.streamInfo
if (this.streamInfo.transcodeStream) {
streamInfo = this.streamInfo.transcodeStream;
}
if (location.protocol === "https:") {
this.videoUrl = streamInfo[this.player[this.activePlayer][1]]
} else {
this.videoUrl = streamInfo[this.player[this.activePlayer][0]]
}
return this.videoUrl;
},
playFromStreamInfo: function (realHasAudio, streamInfo) {
this.showVideoDialog = true;
this.hasaudio = realHasAudio && this.hasaudio;
if (this.$refs[this.activePlayer]) {
this.$refs[this.activePlayer].play(this.getUrlByStreamInfo(streamInfo))
}else {
this.$nextTick(() => {
this.$refs[this.activePlayer].play(this.getUrlByStreamInfo(streamInfo))
});
}
},
close: function () {
console.log('关闭视频');
if (!!this.$refs[this.activePlayer]){
this.$refs[this.activePlayer].pause();
}
this.videoUrl = '';
this.coverPlaying = false;
this.showVideoDialog = false;
this.stopBroadcast()
},
copySharedInfo: function (data) {
console.log('复制内容:' + data);
this.coverPlaying = false;
this.tracks = []
let _this = this;
this.$copyText(data).then(
function (e) {
_this.$message({
showClose: true,
message: '复制成功',
type: 'success'
});
},
function (e) {
_this.$message({
showClose: true,
message: '复制失败,请手动复制',
type: 'error'
});
}
);
},
ptzCamera: function (command) {
console.log('云台控制:' + command);
this.$axios({
method: 'get',
url: '/api/jt1078/ptz',
params: {
phoneNumber: this.deviceId,
channelId: this.channelId,
command: command,
speed: this.controSpeed,
}
}).then(function (res) {
});
},
wiper: function (command) {
console.log('雨刷控制:' + command);
this.$axios({
method: 'get',
url: '/api/jt1078/wiper',
params: {
phoneNumber: this.deviceId,
channelId: this.channelId,
command: command,
}
}).then(function (res) {
});
},
fillLight: function (command) {
console.log('补光灯开关控制:' + command);
this.$axios({
method: 'get',
url: '/api/jt1078/fill-light',
params: {
phoneNumber: this.deviceId,
channelId: this.channelId,
command: command,
}
}).then(function (res) {
});
},
//////////////////////播放器事件处理//////////////////////////
videoError: function (e) {
console.log("播放器错误:" + JSON.stringify(e));
},
presetPosition: function (cmdCode, presetPos) {
console.log('预置位控制:' + this.presetPos + ' : 0x' + cmdCode.toString(16));
let that = this;
this.$axios({
method: 'post',
url: '/api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=0&parameter2=' + presetPos + '&combindCode2=0'
}).then(function (res) {
});
},
setSpeedOrTime: function (cmdCode, groupNum, parameter) {
let that = this;
let parameter2 = parameter % 256;
let combindCode2 = Math.floor(parameter / 256) * 16;
console.log('前端控制0x' + cmdCode.toString(16) + ' 0x' + groupNum.toString(16) + ' 0x' + parameter2.toString(16) + ' 0x' + combindCode2.toString(16));
this.$axios({
method: 'post',
url: '/api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter2 + '&combindCode2=' + combindCode2
}).then(function (res) {
});
},
setCommand: function (cmdCode, groupNum, parameter) {
let that = this;
console.log('前端控制0x' + cmdCode.toString(16) + ' 0x' + groupNum.toString(16) + ' 0x' + parameter.toString(16) + ' 0x0');
this.$axios({
method: 'post',
url: '/api/ptz/front_end_command/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter + '&combindCode2=0'
}).then(function (res) {
});
},
copyUrl: function (dropdownItem) {
console.log(dropdownItem)
this.$copyText(dropdownItem).then((e) => {
this.$message.success({
showClose: true,
message: "成功拷贝到粘贴板"
})
}, (e) => {
})
},
getBroadcastStatus() {
if (this.broadcastStatus == -2) {
return "primary"
}
if (this.broadcastStatus == -1) {
return "primary"
}
if (this.broadcastStatus == 0) {
return "warning"
}
if (this.broadcastStatus == 1) {
return "danger"
}
},
broadcastStatusClick() {
if (this.broadcastStatus == -1) {
// 默认状态, 开始
this.broadcastStatus = 0
// 发起语音对讲
this.$axios({
method: 'get',
url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30&broadcastMode=" + this.broadcastMode
}).then((res) => {
if (res.data.code === 0) {
let streamInfo = res.data.data.streamInfo;
if (document.location.protocol.includes("https")) {
this.startBroadcast(streamInfo.rtcs)
} else {
this.startBroadcast(streamInfo.rtc)
}
} else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
});
} else if (this.broadcastStatus === 1) {
this.broadcastStatus = -1;
this.broadcastRtc.close()
}
},
startBroadcast(url) {
// 获取推流鉴权Key
this.$axios({
method: 'post',
url: '/api/user/userInfo',
}).then((res) => {
if (res.data.code !== 0) {
this.$message({
showClose: true,
message: "获取推流鉴权Key失败",
type: "error",
});
this.broadcastStatus = -1;
} else {
let pushKey = res.data.data.pushKey;
// 获取推流鉴权KEY
url += "&sign=" + crypto.createHash('md5').update(pushKey, "utf8").digest('hex')
console.log("开始语音喊话: " + url)
this.broadcastRtc = new ZLMRTCClient.Endpoint({
debug: true, // 是否打印日志
zlmsdpUrl: url, //流地址
simulecast: false,
useCamera: false,
audioEnable: true,
videoEnable: false,
recvOnly: false,
})
// webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//获取到了远端流,可以播放
// console.error('播放成功',e.streams)
// this.broadcastStatus = 1;
// });
//
// webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 获取到了本地流
// this.broadcastStatus = 1;
// // document.getElementById('selfVideo').srcObject=s;
// // this.eventcallbacK("LOCAL STREAM", "获取到了本地流")
// });
this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_NOT_SUPPORT, (e) => {// 获取到了本地流
console.error('不支持webrtc', e)
this.$message({
showClose: true,
message: '不支持webrtc, 无法进行语音喊话',
type: 'error'
});
this.broadcastStatus = -1;
});
this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR, (e) => {// ICE 协商出错
console.error('ICE 协商出错')
this.$message({
showClose: true,
message: 'ICE 协商出错',
type: 'error'
});
this.broadcastStatus = -1;
});
this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, (e) => {// offer anwser 交换失败
console.error('offer anwser 交换失败', e)
this.$message({
showClose: true,
message: 'offer anwser 交换失败' + e,
type: 'error'
});
this.broadcastStatus = -1;
});
this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE, (e) => {// offer anwser 交换失败
console.log('状态改变', e)
if (e === "connecting") {
this.broadcastStatus = 0;
} else if (e === "connected") {
this.broadcastStatus = 1;
} else if (e === "disconnected") {
this.broadcastStatus = -1;
}
});
this.broadcastRtc.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED, (e) => {// offer anwser 交换失败
console.log('捕获流失败', e)
this.$message({
showClose: true,
message: '捕获流失败' + e,
type: 'error'
});
this.broadcastStatus = -1;
});
}
}).catch((e) => {
this.$message({
showClose: true,
message: e,
type: 'error'
});
this.broadcastStatus = -1;
});
},
stopBroadcast() {
this.broadcastRtc.close();
this.broadcastStatus = -1;
this.$axios({
method: 'get',
url: '/api/play/broadcast/stop/' + this.deviceId + '/' + this.channelId
}).then((res) => {
if (res.data.code == 0) {
// this.broadcastStatus = -1;
// this.broadcastRtc.close()
} else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
});
}
}
};
</script>
<style>
.control-wrapper {
position: relative;
width: 6.25rem;
height: 6.25rem;
max-width: 6.25rem;
max-height: 6.25rem;
border-radius: 100%;
margin-top: 1.5rem;
margin-left: 0.5rem;
float: left;
}
.control-panel {
position: relative;
top: 0;
left: 5rem;
height: 11rem;
max-height: 11rem;
}
.control-btn {
display: flex;
justify-content: center;
position: absolute;
width: 44%;
height: 44%;
border-radius: 5px;
border: 1px solid #78aee4;
box-sizing: border-box;
transition: all 0.3s linear;
}
.control-btn:hover {
cursor: pointer
}
.control-btn i {
font-size: 20px;
color: #78aee4;
display: flex;
justify-content: center;
align-items: center;
}
.control-btn i:hover {
cursor: pointer
}
.control-zoom-btn:hover {
cursor: pointer
}
.control-round {
position: absolute;
top: 21%;
left: 21%;
width: 58%;
height: 58%;
background: #fff;
border-radius: 100%;
}
.control-round-inner {
position: absolute;
left: 13%;
top: 13%;
display: flex;
justify-content: center;
align-items: center;
width: 70%;
height: 70%;
font-size: 40px;
color: #78aee4;
border: 1px solid #78aee4;
border-radius: 100%;
transition: all 0.3s linear;
}
.control-inner-btn {
position: absolute;
width: 60%;
height: 60%;
background: #fafafa;
}
.control-top {
top: -8%;
left: 27%;
transform: rotate(-45deg);
border-radius: 5px 100% 5px 0;
}
.control-top i {
transform: rotate(45deg);
border-radius: 5px 100% 5px 0;
}
.control-top .control-inner {
left: -1px;
bottom: 0;
border-top: 1px solid #78aee4;
border-right: 1px solid #78aee4;
border-radius: 0 100% 0 0;
}
.control-top .fa {
transform: rotate(45deg) translateY(-7px);
}
.control-left {
top: 27%;
left: -8%;
transform: rotate(45deg);
border-radius: 5px 0 5px 100%;
}
.control-left i {
transform: rotate(-45deg);
}
.control-left .control-inner {
right: -1px;
top: -1px;
border-bottom: 1px solid #78aee4;
border-left: 1px solid #78aee4;
border-radius: 0 0 0 100%;
}
.control-left .fa {
transform: rotate(-45deg) translateX(-7px);
}
.control-right {
top: 27%;
right: -8%;
transform: rotate(45deg);
border-radius: 5px 100% 5px 0;
}
.control-right i {
transform: rotate(-45deg);
}
.control-right .control-inner {
left: -1px;
bottom: -1px;
border-top: 1px solid #78aee4;
border-right: 1px solid #78aee4;
border-radius: 0 100% 0 0;
}
.control-right .fa {
transform: rotate(-45deg) translateX(7px);
}
.control-bottom {
left: 27%;
bottom: -8%;
transform: rotate(45deg);
border-radius: 0 5px 100% 5px;
}
.control-bottom i {
transform: rotate(-45deg);
}
.control-bottom .control-inner {
top: -1px;
left: -1px;
border-bottom: 1px solid #78aee4;
border-right: 1px solid #78aee4;
border-radius: 0 0 100% 0;
}
.control-bottom .fa {
transform: rotate(-45deg) translateY(7px);
}
.trank {
width: 80%;
height: 180px;
text-align: left;
padding: 0 10%;
overflow: auto;
}
.trankInfo {
width: 80%;
padding: 0 10%;
}
.el-dialog__body{
padding: 10px 20px;
}
.ptz-btn-box {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
height: 3rem;
line-height: 4rem;
}
</style>

293
web/src/views/jtDevice/list.vue Executable file
View File

@@ -0,0 +1,293 @@
<template>
<div id="app" style="height: calc(100vh - 124px);">
<el-form :inline="true" size="mini">
<el-form-item>
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="add">接入新设备
</el-button>
</el-form-item>
<el-form-item style="float: right;">
<el-button
icon="el-icon-refresh-right"
circle
:loading="getListLoading"
@click="getList()"
/>
</el-form-item>
</el-form>
<!--设备列表-->
<el-table
size="small"
:data="deviceList"
height="calc(100% - 64px)"
header-row-class-name="table-header"
>
<el-table-column prop="phoneNumber" label="终端手机号" min-width="160" />
<el-table-column prop="terminalId" label="终端ID" min-width="160" />
<el-table-column prop="provinceText" label="省域" min-width="160" />
<el-table-column prop="cityText" label="市县域" min-width="160" />
<el-table-column prop="makerId" label="制造商" min-width="160" />
<el-table-column prop="model" label="型号" min-width="160" />
<el-table-column label="车牌颜色" min-width="160">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<span v-if="scope.row.plateColor === 1">蓝色</span>
<span v-else-if="scope.row.plateColor === 2">黄色</span>
<span v-else-if="scope.row.plateColor === 3">黑色</span>
<span v-else-if="scope.row.plateColor === 4">白色</span>
<span v-else-if="scope.row.plateColor === 5">绿色</span>
<span v-else-if="scope.row.plateColor === 91">农黄色</span>
<span v-else-if="scope.row.plateColor === 92">农绿色</span>
<span v-else-if="scope.row.plateColor === 93">黄绿色</span>
<span v-else-if="scope.row.plateColor === 94">渐变绿</span>
<span v-else>未上牌</span>
</div>
</template>
</el-table-column>
<el-table-column prop="plateNo" label="车牌" min-width="160" />
<el-table-column prop="registerTime" label="注册时间" min-width="160" />
<el-table-column label="状态" min-width="160">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if="scope.row.status" size="medium">在线</el-tag>
<el-tag v-if="!scope.row.status" size="medium" type="info">离线</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" min-width="340" fixed="right">
<template slot-scope="scope">
<el-divider direction="vertical" />
<el-button
type="text"
size="medium"
icon="el-icon-video-camera"
@click="showChannelList(scope.row)"
>通道
</el-button>
<el-divider direction="vertical" />
<el-button size="medium" icon="el-icon-edit" type="text" @click="edit(scope.row)">编辑</el-button>
<el-divider direction="vertical" />
<el-button
size="medium"
icon="el-icon-delete"
type="text"
style="color: #f56c6c"
@click="deleteDevice(scope.row)"
>删除
</el-button>
<el-divider direction="vertical" />
<el-dropdown @command="(command)=>{moreClick(command, scope.row)}">
<el-button size="medium" type="text">
更多功能<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="params" :disabled="!scope.row.status">
终端参数</el-dropdown-item>
<!-- <el-dropdown-item command="attribute" v-bind:disabled="!scope.row.status">-->
<!-- 终端属性</el-dropdown-item>-->
<el-dropdown-item command="connection" :disabled="!scope.row.status">
终端连接</el-dropdown-item>
<!-- <el-dropdown-item command="linkDetection" v-bind:disabled="!scope.row.status" >-->
<!-- 链路检测</el-dropdown-item>-->
<!-- <el-dropdown-item command="position" v-bind:disabled="!scope.row.status" >-->
<!-- 位置信息</el-dropdown-item>-->
<!-- <el-dropdown-item command="textMsg" v-bind:disabled="!scope.row.status" >-->
<!-- 文本信息</el-dropdown-item>-->
<!-- <el-dropdown-item command="telephoneCallback" v-bind:disabled="!scope.row.status" >-->
<!-- 电话回拨</el-dropdown-item>-->
<!-- <el-dropdown-item command="setPhoneBook" v-bind:disabled="!scope.row.status" >-->
<!-- 设置电话本</el-dropdown-item>-->
<!-- <el-dropdown-item command="tempPositionTracking" v-bind:disabled="!scope.row.status" >-->
<!-- 临时跟踪</el-dropdown-item>-->
<!-- <el-dropdown-item command="reset" v-bind:disabled="!scope.row.status" >-->
<!-- 终端复位</el-dropdown-item>-->
<!-- <el-dropdown-item command="factoryReset" v-bind:disabled="!scope.row.status" >-->
<!-- 恢复出厂</el-dropdown-item>-->
<!-- <el-dropdown-item command="door" v-bind:disabled="!scope.row.status" >-->
<!-- 车门控制</el-dropdown-item>-->
<!-- <el-dropdown-item command="driverInfo" v-bind:disabled="!scope.row.status" >-->
<!-- 驾驶员信息</el-dropdown-item>-->
<!-- <el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status" >-->
<!-- 音视频属性</el-dropdown-item>-->
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-pagination
style="float: right"
:current-page="currentPage"
:page-size="count"
:page-sizes="[15, 25, 35, 50]"
layout="total, sizes, prev, pager, next"
:total="total"
@size-change="handleSizeChange"
@current-change="currentChange"
/>
<deviceEdit ref="deviceEdit" />
<syncChannelProgress ref="syncChannelProgress" />
</div>
</template>
<script>
import deviceEdit from './edit.vue'
import syncChannelProgress from '../dialog/SyncChannelProgress.vue'
export default {
name: 'App',
components: {
deviceEdit,
syncChannelProgress
},
data() {
return {
deviceList: [], // 设备列表
updateLooper: 0, // 数据刷新轮训标志
winHeight: window.innerHeight - 200,
currentPage: 1,
count: 15,
total: 0,
getListLoading: false
}
},
mounted() {
this.initData()
this.updateLooper = setInterval(this.initData, 10000)
},
destroyed() {
this.$destroy('videojs')
clearTimeout(this.updateLooper)
},
methods: {
initData: function() {
this.getList()
},
currentChange: function(val) {
this.currentPage = val
this.getList()
},
handleSizeChange: function(val) {
this.count = val
this.getList()
},
getList: function() {
this.getListLoading = true
this.$store.dispatch('jtDevice/getList', {})
this.deviceService.getDeviceList(this.currentPage, this.count, (data) => {
if (data.code === 0) {
this.total = data.data.total
this.deviceList = data.data.list
}
this.getListLoading = false
}, () => {
this.getListLoading = false
}
)
},
deleteDevice: function(row) {
this.$confirm('确定删除此设备?', '提示', {
dangerouslyUseHTMLString: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
center: true,
type: 'warning'
}).then(() => {
this.deviceService.deleteDevice(row.id, (data) => {
this.getList()
})
}).catch(() => {
})
},
edit: function(row) {
this.$refs.deviceEdit.openDialog(row, () => {
this.$refs.deviceEdit.close()
this.$message({
showClose: true,
message: '设备修改成功,通道字符集将在下次更新生效',
type: 'success'
})
setTimeout(this.getList, 200)
})
},
showChannelList: function(row) {
this.$router.push(`/jtChannelList/${row.id}`)
},
add: function() {
this.$refs.deviceEdit.openDialog(null, () => {
this.$refs.deviceEdit.close()
this.$message({
showClose: true,
message: '添加成功',
type: 'success'
})
setTimeout(this.getList, 200)
})
},
moreClick: function(command, itemData) {
if (command === 'params') {
this.$router.push(`/jtDeviceParams/${itemData.phoneNumber}`)
} else if (command === 'connection') {
// this.queryCloudRecords(itemData)
} else {
this.$message.info('尚不支持')
}
}
}
}
</script>
<style>
.videoList {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
}
.video-item {
position: relative;
width: 15rem;
height: 10rem;
margin-right: 1rem;
background-color: #000000;
}
.video-item-img {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 100%;
height: 100%;
}
.video-item-img:after {
content: "";
display: inline-block;
position: absolute;
z-index: 2;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 3rem;
height: 3rem;
background-image: url("../assets/loading.png");
background-size: cover;
background-color: #000000;
}
.video-item-title {
position: absolute;
bottom: 0;
color: #000000;
background-color: #ffffff;
line-height: 1.5rem;
padding: 0.3rem;
width: 14.4rem;
}
</style>