feat:完善功能
This commit is contained in:
@@ -1,220 +0,0 @@
|
||||
<template>
|
||||
<div class="z-dialog">
|
||||
<el-dialog v-model="modelValue" align-center :modal="false" :show-close="false">
|
||||
<img class="close" src="@/assets/images/close.png" @click="handleClose" />
|
||||
<title2 title="核心景区监控" />
|
||||
<ul class="list">
|
||||
<li
|
||||
class="item"
|
||||
:style="{ backgroundImage: `url(${primary})` }"
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
@click="handleItem(item)"
|
||||
>
|
||||
<div class="item-unfollow" @click.stop="handleCollect(item.id, index)">取消关注</div>
|
||||
<video class="item-video" :id="'video' + index" muted autoplay :controls="false">
|
||||
<source type="application/x-mpegURL" />
|
||||
</video>
|
||||
<p>
|
||||
<span> {{ item.cameraName || item.cameraIndexCode }}</span>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="pagination">
|
||||
<el-pagination
|
||||
v-model:current-page="params.pageNum"
|
||||
:page-size="params.pageSize"
|
||||
:total="total"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
@current-change="pageNumChange"
|
||||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<video-dialog v-model="videoShow" :src="src" :cameraIndexCode="cameraIndexCode" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getVideoListApi } from '@/api/home'
|
||||
import { postVideoCollectApi } from '@/api/monitor'
|
||||
|
||||
import primary from '@/assets/images/item-primary.png'
|
||||
|
||||
import Hls from 'hls.js'
|
||||
import pubSub from 'pubsub-js'
|
||||
|
||||
let modelValue = defineModel()
|
||||
|
||||
let list = ref([])
|
||||
let hlsRefs = []
|
||||
let total = ref(0)
|
||||
let src = ref('')
|
||||
let cameraIndexCode = ref('')
|
||||
let videoShow = ref(false)
|
||||
let params = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 6,
|
||||
isCollect: 1
|
||||
})
|
||||
|
||||
watch(
|
||||
() => modelValue.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
setTimeout(() => {
|
||||
getVideoList()
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
)
|
||||
const handleItem = (item) => {
|
||||
src.value = item.hlsUrl
|
||||
cameraIndexCode.value = item.cameraIndexCode
|
||||
videoShow.value = true
|
||||
}
|
||||
const handleCollect = async (id, index) => {
|
||||
await postVideoCollectApi({
|
||||
id,
|
||||
isCollect: 0
|
||||
})
|
||||
clearHlsRefs()
|
||||
params.pageNum = 1
|
||||
getVideoList()
|
||||
pubSub.publish('videoCollect')
|
||||
}
|
||||
const handleClose = () => {
|
||||
clearHlsRefs()
|
||||
modelValue.value = false
|
||||
}
|
||||
const clearHlsRefs = () => {
|
||||
if (hlsRefs.length > 0) {
|
||||
hlsRefs.map((item) => {
|
||||
item.destroy()
|
||||
})
|
||||
hlsRefs = []
|
||||
}
|
||||
}
|
||||
const pageNumChange = () => {
|
||||
clearHlsRefs()
|
||||
list.value = []
|
||||
getVideoList()
|
||||
}
|
||||
const getVideoList = async () => {
|
||||
let res = await getVideoListApi(params)
|
||||
list.value = res.data
|
||||
total.value = res.total
|
||||
nextTick(() => {
|
||||
list.value.forEach(async (item, index) => {
|
||||
var video = document.getElementById(`video${index}`)
|
||||
const hls = new Hls({
|
||||
enableWorker: false, // 禁用 Worker 来避免额外的线程
|
||||
enableSoftwareAES: true, // 使用软件解码器以避免硬件解码的额外请求
|
||||
cache: true, // 启用缓存
|
||||
maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||
maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||
maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节)
|
||||
})
|
||||
hls.loadSource(item.hlsUrl)
|
||||
hls.attachMedia(video)
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
video.play()
|
||||
})
|
||||
hlsRefs.push(hls)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {})
|
||||
onUnmounted(() => {})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.z-dialog {
|
||||
:deep(.el-dialog) {
|
||||
width: vw(1864);
|
||||
padding: vw(8);
|
||||
background-image: url('@/assets/images/dialog-bg.png') !important;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
:deep(.el-dialog__header) {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
gap: vw(8);
|
||||
height: vw(840);
|
||||
margin-top: vw(30);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
.item {
|
||||
position: relative;
|
||||
width: vw(610);
|
||||
height: vw(420);
|
||||
padding: vw(12);
|
||||
box-sizing: border-box;
|
||||
background-image: url('@/assets/images/item-primary.png');
|
||||
background-size: 100% 100%;
|
||||
|
||||
&-video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
> p {
|
||||
position: absolute;
|
||||
bottom: vw(12);
|
||||
width: calc(100% - vw(24));
|
||||
padding: vw(10) 0;
|
||||
background: rgba(4, 30, 69, 0.72);
|
||||
> span {
|
||||
padding-left: vw(10);
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
line-height: vw(14);
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
&-unfollow {
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: vw(4);
|
||||
top: vw(4);
|
||||
z-index: 99;
|
||||
width: vw(64);
|
||||
height: vw(30);
|
||||
text-align: center;
|
||||
line-height: vw(30);
|
||||
font-weight: 400;
|
||||
font-size: vw(12);
|
||||
color: #ffffff;
|
||||
background-image: url('@/assets/images/unfollow.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
&:hover {
|
||||
.item-unfollow {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.pagination {
|
||||
padding-top: vw(20);
|
||||
margin-right: vw(20);
|
||||
padding-bottom: vw(20);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.close {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: vw(20);
|
||||
top: vw(20);
|
||||
width: vw(60);
|
||||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
@@ -1,236 +0,0 @@
|
||||
<template>
|
||||
<div class="core-video">
|
||||
<div class="title">核心景区视频</div>
|
||||
<div class="btn-all" @click="allShow = true" />
|
||||
<ul class="list">
|
||||
<li
|
||||
class="item"
|
||||
:style="{ backgroundImage: `url(${primary})` }"
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
@click="handleItem(item)"
|
||||
>
|
||||
<HlsPlayer :url="item.hlsUrl" />
|
||||
<div class="item-unfollow" @click.stop="handleUnfollow(item.id, index)">取消关注</div>
|
||||
<!-- <div>
|
||||
<p class="item-title--primary">
|
||||
{{ item.cameraName || item.cameraIndexCode }}
|
||||
</p>
|
||||
|
||||
<video
|
||||
class="item-img"
|
||||
:id="'video' + index"
|
||||
muted
|
||||
autoplay
|
||||
:controls="false"
|
||||
controlsList="nodownload"
|
||||
>
|
||||
<source src="" type="application/x-mpegURL" />
|
||||
</video>
|
||||
</div> -->
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<video-dialog v-model="videoShow" :src="src" :cameraIndexCode="cameraIndexCode" />
|
||||
<all-list v-model="allShow" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import allList from './allList'
|
||||
|
||||
import primary from '@/assets/images/item-primary.png'
|
||||
import error from '@/assets/images/item-error.png'
|
||||
|
||||
import { getVideoListApi } from '@/api/home'
|
||||
import { postVideoCollectApi } from '@/api/monitor'
|
||||
|
||||
import Hls from 'hls.js'
|
||||
import pubSub from 'pubsub-js'
|
||||
|
||||
let list = ref([])
|
||||
let src = ref('')
|
||||
let cameraIndexCode = ref('')
|
||||
let videoShow = ref(false)
|
||||
let allShow = ref(false)
|
||||
let hlsRefs = []
|
||||
|
||||
const handleItem = (item) => {
|
||||
src.value = item.hlsUrl
|
||||
cameraIndexCode.value = item.cameraIndexCode
|
||||
videoShow.value = true
|
||||
}
|
||||
|
||||
const getVideoList = async () => {
|
||||
let res = await getVideoListApi({
|
||||
isCollect: 1,
|
||||
pageNum: 1,
|
||||
pageSize: 5
|
||||
})
|
||||
list.value = res.data
|
||||
// nextTick(() => {
|
||||
// list.value.forEach(async (item, index) => {
|
||||
// var video = document.getElementById(`video${index}`)
|
||||
// const hls = new Hls({
|
||||
// enableWorker: false, // 禁用 Worker 来避免额外的线程
|
||||
// enableSoftwareAES: true, // 使用软件解码器以避免硬件解码的额外请求
|
||||
// cache: true, // 启用缓存
|
||||
// maxBufferLength: 10, // 最大缓冲长度(秒)
|
||||
// maxMaxBufferLength: 15, // 缓冲区长度的上限
|
||||
// maxBufferSize: 20 * 1000 * 1000 // 最大缓冲大小(字节)
|
||||
// })
|
||||
// hls.loadSource(item.hlsUrl)
|
||||
// hls.attachMedia(video)
|
||||
// hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
||||
// video.play()
|
||||
// })
|
||||
// hlsRefs.push(hls)
|
||||
// })
|
||||
// })
|
||||
}
|
||||
|
||||
// 释放hls实例
|
||||
const clearHlsRefs = () => {
|
||||
if (hlsRefs.length > 0) {
|
||||
hlsRefs.map((item) => {
|
||||
item.destroy()
|
||||
})
|
||||
hlsRefs = []
|
||||
}
|
||||
getVideoList()
|
||||
}
|
||||
const onVideoCollect = () => {
|
||||
pubSub.subscribe('videoCollect', () => {
|
||||
clearHlsRefs()
|
||||
})
|
||||
}
|
||||
|
||||
const handleUnfollow = async (id, index) => {
|
||||
await postVideoCollectApi({
|
||||
id,
|
||||
isCollect: 0
|
||||
})
|
||||
clearHlsRefs()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onVideoCollect()
|
||||
getVideoList()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-loading-mask) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
.core-video {
|
||||
position: relative;
|
||||
margin: vw(8);
|
||||
width: vw(300);
|
||||
border-radius: vw(2);
|
||||
background-image: url('@/assets/images/bg-1.png');
|
||||
background-size: 100% 100%;
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
height: vh(26);
|
||||
text-align: center;
|
||||
line-height: vh(26);
|
||||
font-size: vw(16);
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-all {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
right: vw(0);
|
||||
top: vw(0);
|
||||
z-index: 999;
|
||||
width: vw(60);
|
||||
height: vw(24);
|
||||
background-image: url('@/assets/images/all.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.list {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
height: vh(1026);
|
||||
padding: vw(8);
|
||||
/* 滚动条整体样式 */
|
||||
&::-webkit-scrollbar {
|
||||
width: vw(0); /* 滚动条的宽度 */
|
||||
}
|
||||
|
||||
/* 滚动条轨道 */
|
||||
&::-webkit-scrollbar-track {
|
||||
background: #f1f1f1; /* 轨道的背景色 */
|
||||
}
|
||||
|
||||
/* 滚动条滑块 */
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: #888; /* 滑块的背景色 */
|
||||
border-radius: 5px; /* 滑块的圆角 */
|
||||
}
|
||||
|
||||
/* 当鼠标悬停在滚动条上时滑块的样式 */
|
||||
&::-webkit-scrollbar-thumb:hover {
|
||||
background: #555; /* 滑块的背景色 */
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
position: relative;
|
||||
margin-bottom: vh(10);
|
||||
padding: vw(10);
|
||||
background-size: 100% 100%;
|
||||
&-unfollow {
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
position: absolute;
|
||||
right: vw(4);
|
||||
top: vw(4);
|
||||
z-index: 99999;
|
||||
width: vw(64);
|
||||
height: vw(30);
|
||||
text-align: center;
|
||||
line-height: vw(30);
|
||||
font-weight: 400;
|
||||
font-size: vw(12);
|
||||
color: #ffffff;
|
||||
background-image: url('@/assets/images/unfollow.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
&:hover {
|
||||
.item-unfollow {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
&-title {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: vw(10);
|
||||
color: #fff;
|
||||
font-size: vw(14);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
z-index: 999;
|
||||
}
|
||||
&-title--error {
|
||||
@extend .item-title;
|
||||
background-color: rgba(226, 27, 27, 0.72);
|
||||
}
|
||||
&-title--primary {
|
||||
@extend .item-title;
|
||||
background-color: rgba(4, 30, 69, 0.72);
|
||||
}
|
||||
&-img {
|
||||
width: 100%;
|
||||
height: vh(164);
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,232 +0,0 @@
|
||||
<template>
|
||||
<div class="correspondence">
|
||||
<div class="top-box">
|
||||
<div class="title">融合通信(调试中)</div>
|
||||
<div class="icon-box flex">
|
||||
<div
|
||||
class="item"
|
||||
v-for="item in deptsList"
|
||||
:key="item.id"
|
||||
@click="handleDepsUser(item.id, item)"
|
||||
>
|
||||
<img src="/src/assets/images/r-icon-1.png" />
|
||||
<view class="item-name">{{ item.name }}</view>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bom-box">
|
||||
<Title2 title="最近联系(调试中)" />
|
||||
<div class="table">
|
||||
<div class="header">
|
||||
<div>人员姓名</div>
|
||||
<div>部门</div>
|
||||
<div>时间</div>
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="item" v-for="(item, index) in recordList" :key="index">
|
||||
<div>{{ item.nickname }}</div>
|
||||
<div>{{ item.department }}</div>
|
||||
<div>{{ item.time }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<el-dialog :title="gridTitle" center v-model="dialogTableVisible">
|
||||
<div class="bom-box">
|
||||
<div class="table">
|
||||
<div class="header">
|
||||
<div>姓名</div>
|
||||
<div>部门</div>
|
||||
<div>职位</div>
|
||||
<div>电话号码</div>
|
||||
<div>操作</div>
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="item" v-for="(item, index) in gridData" :key="index">
|
||||
<div>{{ item.nickName }}</div>
|
||||
<div>{{ item.depthName }}</div>
|
||||
<div>{{ item.postName }}</div>
|
||||
<div>{{ item.phoneNumber }}</div>
|
||||
<div>
|
||||
<img class="sp-ico" src="@/assets/images/sp-icom.png" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getComDeptsApi, getComDeptUsersApi, getComRecordApi } from '@/api/common'
|
||||
let deptsList = ref([])
|
||||
let dialogTableVisible = ref(false)
|
||||
const getComDepts = async () => {
|
||||
let res = await getComDeptsApi()
|
||||
deptsList.value = res.data
|
||||
}
|
||||
let recordList = ref([])
|
||||
const getComRecord = async () => {
|
||||
let res = await getComRecordApi()
|
||||
recordList.value = res.data
|
||||
}
|
||||
let gridData = ref([])
|
||||
let gridTitle = ref('')
|
||||
const handleDepsUser = async (id, item) => {
|
||||
gridTitle.value = item.name
|
||||
dialogTableVisible.value = true
|
||||
let res = await getComDeptUsersApi({ id })
|
||||
gridData.value = res.data
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getComDepts()
|
||||
getComRecord()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-dialog) {
|
||||
background: url('/src/assets/images/map-bg-2.png') no-repeat top center;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
:deep(.el-dialog__title) {
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
.sp-ico {
|
||||
width: vw(40);
|
||||
}
|
||||
.item-name {
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
}
|
||||
.sp-img {
|
||||
width: vw(100);
|
||||
}
|
||||
.correspondence {
|
||||
margin: vw(8);
|
||||
width: vw(300);
|
||||
height: vh(1070);
|
||||
background-image: url('@/assets/images/bg-1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.bom-box {
|
||||
.table {
|
||||
width: 100%;
|
||||
margin-top: vh(5);
|
||||
.header {
|
||||
height: vh(28);
|
||||
font-weight: 400;
|
||||
font-size: vw(12);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
background: linear-gradient(180deg, rgba(0, 99, 255, 0) 0%, #0063ff 100%);
|
||||
& > div {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
.list {
|
||||
overflow-y: auto;
|
||||
height: vh(490);
|
||||
/* 滚动条整体样式 */
|
||||
&::-webkit-scrollbar {
|
||||
width: vw(4); /* 滚动条的宽度 */
|
||||
}
|
||||
/* 滚动条轨道 */
|
||||
&::-webkit-scrollbar-track {
|
||||
background: 'transparent'; /* 轨道的背景色 */
|
||||
}
|
||||
/* 滚动条滑块 */
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 150, 255, 0.63); /* 滑块的背景色 */
|
||||
border-radius: 5px; /* 滑块的圆角 */
|
||||
}
|
||||
.item {
|
||||
height: vh(50);
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
color: #f1f7ff;
|
||||
display: flex;
|
||||
&:nth-child(2n + 1) {
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(0, 150, 255, 0) 0%,
|
||||
rgba(0, 150, 255, 0.22) 100%
|
||||
);
|
||||
}
|
||||
& > div {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
white-space: nowrap; /* 保证文本在一行内显示 */
|
||||
overflow: hidden; /* 隐藏溢出的内容 */
|
||||
text-overflow: ellipsis; /* 使用省略号表示文本溢出 */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.title {
|
||||
span {
|
||||
margin-left: vw(30);
|
||||
font-weight: 800;
|
||||
font-size: vw(15);
|
||||
line-height: vh(26);
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
background: linear-gradient(90deg, #ffffff 0%, #5cb5ff 100%);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
.top-box {
|
||||
width: 100%;
|
||||
height: vh(500);
|
||||
.icon-box {
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
color: #ffffff;
|
||||
line-height: vh(16);
|
||||
flex-wrap: wrap;
|
||||
.item {
|
||||
cursor: pointer;
|
||||
width: 50%;
|
||||
margin-top: vh(40);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
&:nth-child(3n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
& > img {
|
||||
width: vw(54);
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
.title {
|
||||
width: vw(260);
|
||||
height: vh(26);
|
||||
text-align: center;
|
||||
line-height: vh(26);
|
||||
margin-left: vw(32.5);
|
||||
font-size: vw(16);
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
background-image: url('@/assets/images/title-1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,399 +0,0 @@
|
||||
<template>
|
||||
<div class="header">
|
||||
<ul class="nav-left">
|
||||
<li
|
||||
class="nav-left-item"
|
||||
:style="{
|
||||
backgroundImage: `url(${current === index && !isSkip ? title2Select : title2})`
|
||||
}"
|
||||
v-for="(item, index) in navLeft"
|
||||
:key="index"
|
||||
@click="handleNav(item, index)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</li>
|
||||
<!-- v-if="navLeft.length > 3" -->
|
||||
<el-dropdown
|
||||
v-if="router.currentRoute.value.path == '/scenic'"
|
||||
trigger="click"
|
||||
@command="handleCommand"
|
||||
>
|
||||
<li
|
||||
class="nav-left-item"
|
||||
:style="{
|
||||
backgroundImage: `url(${title2})`
|
||||
}"
|
||||
>
|
||||
{{ otherScenic || '其他景区' }}
|
||||
<img class="icon" src="@/assets/images/arrow-down-1.png" />
|
||||
</li>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-for="(item, index) in otherNav" :key="index" :command="item">
|
||||
<span class="label"> {{ item.name }}</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</ul>
|
||||
<div class="title">
|
||||
<span>{{ title }}</span>
|
||||
</div>
|
||||
<ul class="nav-right">
|
||||
<li
|
||||
class="nav-right-item"
|
||||
@click="handleNav(item, index)"
|
||||
v-for="(item, index) in navRight"
|
||||
:key="index"
|
||||
>
|
||||
{{ item.name }}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="weather">
|
||||
<span>{{ weatherData?.temperature }}-{{ weatherData?.skycon }}</span>
|
||||
<span class="line">|</span>
|
||||
<span>风速:{{ weatherData?.windSpeed }}</span>
|
||||
<span class="line">|</span>
|
||||
<span>空气质量:{{ weatherData?.airQuality }}</span>
|
||||
</div>
|
||||
<p class="date">{{ currentDate }}</p>
|
||||
<div v-if="isBack" class="back" @click="handleBack">
|
||||
<img class="icon" src="@/assets/images/back.png" alt="" /> 返回
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import title2 from '@/assets/images/title-2.png'
|
||||
import title2Select from '@/assets/images/title-2-select.png'
|
||||
|
||||
import { getWeatherApi } from '@/api/home'
|
||||
import { getSpotListApi } from '@/api/sentiment'
|
||||
|
||||
import pubSub from 'pubsub-js'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
let currentDate = ref('')
|
||||
let weatherData = ref({})
|
||||
let title = ref('')
|
||||
let navLeft = ref([])
|
||||
let navRight = ref([])
|
||||
let isSkip = ref(true)
|
||||
let isBack = ref(false)
|
||||
let current = ref(0)
|
||||
let otherScenic = ref('')
|
||||
let otherNav = ref([
|
||||
{
|
||||
name: '大窝景区'
|
||||
},
|
||||
{
|
||||
name: '天坑景区'
|
||||
},
|
||||
{
|
||||
name: '旅游环线'
|
||||
}
|
||||
])
|
||||
let spotList = ref([])
|
||||
|
||||
// 补零
|
||||
const fillZero = (value) => {
|
||||
return value < 10 ? `0${value}` : value
|
||||
}
|
||||
|
||||
// 获取当前日期
|
||||
const getCurrentDate = () => {
|
||||
var time = new Date()
|
||||
var year = time.getFullYear()
|
||||
var month = time.getMonth() + 1
|
||||
var day = time.getDate()
|
||||
var second = time.getSeconds()
|
||||
var hour = time.getHours()
|
||||
var minute = time.getMinutes()
|
||||
var second = time.getSeconds()
|
||||
currentDate.value = `${year}-${fillZero(month)}-${fillZero(day)} ${hour}:${fillZero(
|
||||
minute
|
||||
)}:${fillZero(second)}`
|
||||
}
|
||||
// 返回首页
|
||||
const handleBack = () => {
|
||||
router.push('/home')
|
||||
}
|
||||
const handleCommand = () => {}
|
||||
// 点击导航
|
||||
const handleNav = (item, index) => {
|
||||
if (isSkip.value) {
|
||||
router.push(item.path)
|
||||
} else {
|
||||
if (current.value === index) return
|
||||
otherScenic.value = ''
|
||||
current.value = index
|
||||
title.value = item.name
|
||||
switch (router.currentRoute.value.path) {
|
||||
case '/scenic':
|
||||
pubSub.publish('scenicChange', item)
|
||||
break
|
||||
case '/monitor':
|
||||
pubSub.publish('monitorChange', item)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取天气数据
|
||||
const getWeather = async () => {
|
||||
let res = await getWeatherApi()
|
||||
weatherData.value = res.data
|
||||
}
|
||||
// 获取景区列表
|
||||
const getSpotList = async () => {
|
||||
let res = await getSpotListApi()
|
||||
spotList.value = res.data
|
||||
}
|
||||
// 设置当前路由导航栏
|
||||
const setNav = async () => {
|
||||
navLeft.value = []
|
||||
navRight.value = []
|
||||
switch (router.currentRoute.value.path) {
|
||||
case '/home':
|
||||
title.value = '奉节县旅游指挥调度中心'
|
||||
isSkip.value = true
|
||||
isBack.value = false
|
||||
navLeft.value = [
|
||||
{ name: '监控', path: '/monitor' },
|
||||
{ name: '景区', path: '/scenic' },
|
||||
{ name: '交通', path: '/traffic' }
|
||||
]
|
||||
navRight.value = [
|
||||
{ name: '工单', path: '/workOrder' },
|
||||
{ name: '舆情', path: '/sentiment' },
|
||||
{ name: '酒店', path: '/hotel' }
|
||||
]
|
||||
break
|
||||
case '/scenic':
|
||||
isSkip.value = false
|
||||
isBack.value = true
|
||||
let res = await getSpotListApi()
|
||||
navLeft.value = res.data
|
||||
current.value = 0
|
||||
title.value = navLeft.value[current.value].name
|
||||
pubSub.publish('scenicChange', navLeft.value[current.value])
|
||||
break
|
||||
case '/sentiment':
|
||||
title.value = '舆情监测'
|
||||
isBack.value = true
|
||||
break
|
||||
case '/workOrder':
|
||||
title.value = '工单消息'
|
||||
isBack.value = true
|
||||
break
|
||||
case '/traffic':
|
||||
title.value = '交通大屏'
|
||||
isBack.value = true
|
||||
break
|
||||
case '/monitor':
|
||||
title.value = '监控大屏'
|
||||
isSkip.value = false
|
||||
current.vlaue = ''
|
||||
isBack.value = true
|
||||
let res1 = await getSpotListApi()
|
||||
navLeft.value = [
|
||||
{
|
||||
name: '奉节县',
|
||||
scenicSpotId: ''
|
||||
},
|
||||
...res1.data
|
||||
]
|
||||
break
|
||||
case '/sceneTesting':
|
||||
title.value = '三峡之巅-安全检测'
|
||||
navLeft.value = [
|
||||
{
|
||||
name: '奉节县',
|
||||
path: '/sceneTesting'
|
||||
},
|
||||
{
|
||||
name: '三峡之巅',
|
||||
path: '/sceneTesting'
|
||||
},
|
||||
{
|
||||
name: '白帝城',
|
||||
path: '/sceneTesting'
|
||||
},
|
||||
{
|
||||
name: '龙河桥',
|
||||
path: '/sceneTesting'
|
||||
}
|
||||
]
|
||||
navRight.value = [
|
||||
{
|
||||
name: '路段',
|
||||
path: '/roadTesting'
|
||||
},
|
||||
{
|
||||
name: '路段',
|
||||
path: '/roadTesting'
|
||||
},
|
||||
{
|
||||
name: '路段',
|
||||
path: '/roadTesting'
|
||||
},
|
||||
{
|
||||
name: '路段',
|
||||
path: '/roadTesting'
|
||||
}
|
||||
]
|
||||
isBack.value = true
|
||||
break
|
||||
|
||||
case '/hotel':
|
||||
title.value = '酒店管理'
|
||||
isSkip.value = false
|
||||
current.vlaue = ''
|
||||
isBack.value = true
|
||||
navLeft.value = [
|
||||
{
|
||||
name: '酒店一'
|
||||
},
|
||||
{
|
||||
name: '酒店二'
|
||||
},
|
||||
{
|
||||
name: '酒店三'
|
||||
},
|
||||
{
|
||||
name: '酒店四'
|
||||
}
|
||||
]
|
||||
break
|
||||
}
|
||||
}
|
||||
watch(
|
||||
() => router.currentRoute.value,
|
||||
() => {
|
||||
setNav()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
onMounted(() => {
|
||||
getWeather()
|
||||
getSpotList()
|
||||
getCurrentDate()
|
||||
setInterval(() => {
|
||||
getCurrentDate()
|
||||
}, 1000)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header {
|
||||
position: absolute;
|
||||
left: vw(326);
|
||||
.weather {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: vh(10);
|
||||
font-weight: 400;
|
||||
font-size: vw(18);
|
||||
color: #ffffff;
|
||||
.line {
|
||||
margin: 0 vw(10);
|
||||
}
|
||||
}
|
||||
.date {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: vh(10);
|
||||
font-weight: 400;
|
||||
font-size: vw(18);
|
||||
color: #ffffff;
|
||||
}
|
||||
.back {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: vh(50);
|
||||
width: vw(130);
|
||||
height: vh(36);
|
||||
font-weight: 600;
|
||||
font-size: vw(20);
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: vw(60);
|
||||
border: 1px solid rgba(0, 114, 220, 0.3);
|
||||
background: linear-gradient(270deg, rgba(8, 41, 86, 0.16) 0%, #0b61b4 100%);
|
||||
.icon {
|
||||
margin-right: vw(10);
|
||||
width: vw(24);
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
width: vw(3170);
|
||||
height: vh(120);
|
||||
line-height: vh(90);
|
||||
text-align: center;
|
||||
letter-spacing: vw(10);
|
||||
box-sizing: border-box;
|
||||
background-image: url('@/assets/images/title.png');
|
||||
background-size: 100% 100%;
|
||||
& > span {
|
||||
font-size: vw(48);
|
||||
font-weight: 800;
|
||||
font-family: 'MicrosoftYaHeiBold';
|
||||
color: transparent;
|
||||
letter-spacing: vw(10);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
text-shadow: 0 4px 7px rgba(0, 150, 255, 0.75);
|
||||
background-image: linear-gradient(to bottom, #ffffff 0%, #87c9ff 100%);
|
||||
}
|
||||
}
|
||||
.nav-left {
|
||||
position: absolute;
|
||||
right: vw(2120);
|
||||
top: vh(34);
|
||||
display: flex;
|
||||
&-item {
|
||||
cursor: pointer;
|
||||
margin-left: vh(-16);
|
||||
width: vw(210);
|
||||
height: vh(56);
|
||||
line-height: vh(46);
|
||||
font-weight: 600;
|
||||
font-size: vw(28);
|
||||
text-align: center;
|
||||
color: rgba(208, 236, 255, 0.9);
|
||||
background-size: 100% 100%;
|
||||
.icon {
|
||||
width: vw(18);
|
||||
height: vw(18);
|
||||
}
|
||||
}
|
||||
}
|
||||
.nav-right {
|
||||
position: absolute;
|
||||
left: vw(2130);
|
||||
top: vh(34);
|
||||
display: flex;
|
||||
&-item {
|
||||
cursor: pointer;
|
||||
margin-right: vh(-16);
|
||||
width: vw(210);
|
||||
height: vh(56);
|
||||
line-height: vh(46);
|
||||
font-weight: 600;
|
||||
font-size: vw(28);
|
||||
text-align: center;
|
||||
color: rgba(208, 236, 255, 0.9);
|
||||
background-image: url('@/assets/images/title-3.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -227,7 +227,7 @@
|
||||
},
|
||||
|
||||
handleHlsError(data) {
|
||||
console.error('HLS Error:', data)
|
||||
// console.error('HLS Error:', data)
|
||||
if (data.fatal) {
|
||||
switch (data.type) {
|
||||
case Hls.ErrorTypes.NETWORK_ERROR:
|
||||
|
||||
Reference in New Issue
Block a user