feat:完善功能
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
{{ item.name }}
|
||||
</li>
|
||||
</ul>
|
||||
<div id="traffic-map" class="traffic-map" />
|
||||
<div id="traffic-map" :class="[routers.length == 0 ? 'traffic-map-big' : 'traffic-map']" />
|
||||
<div class="map-box">
|
||||
<!-- <div class="video-list">
|
||||
<div class="li">
|
||||
@@ -23,17 +23,111 @@
|
||||
<div class="menu">查看更多</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div v-if="routers.length > 0" class="list">
|
||||
<div class="item" v-for="(item, index) in routers" :key="index">
|
||||
<div class="header">
|
||||
<div class="header-left">
|
||||
<img src="@/assets/images/work-icon-xl-1.png" />
|
||||
<div class="header-left__title">{{ item.name }}</div>
|
||||
<div class="header-left__camera" @click="videoShow = true">道路监控</div>
|
||||
<!-- <div class="header-left__point" @click="videoShow = true">3号点位</div> -->
|
||||
</div>
|
||||
<div class="header-status">{{ item.congestLevelText }} </div>
|
||||
</div>
|
||||
<div class="statistics">
|
||||
<div class="statistics-item">
|
||||
<div class="statistics-item__label">
|
||||
<img src="@/assets/images/t-icon-1.png" alt="" />平均车速
|
||||
</div>
|
||||
<div class="statistics-item__value flex">
|
||||
<countup :end-val="item.speed" />
|
||||
<span>km/h</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="statistics-item">
|
||||
<div class="statistics-item__label">
|
||||
<img src="@/assets/images/t-icon-1.png" alt="" />拥堵距离
|
||||
</div>
|
||||
<div class="statistics-item__value flex">
|
||||
<countup :end-val="item.congestLength" />
|
||||
<span>km</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="statistics-item">
|
||||
<div class="statistics-item__label">
|
||||
<img src="@/assets/images/t-icon-1.png" alt="" />拥堵次数
|
||||
</div>
|
||||
<div class="statistics-item__value">
|
||||
<countup :end-val="item.congestCount" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="statistics-item">
|
||||
<div class="statistics-item__label">
|
||||
<img src="@/assets/images/t-icon-1.png" alt="" />拥堵开始时间
|
||||
</div>
|
||||
<div class="statistics-item__value">
|
||||
{{ item.startTime }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="statistics-item">
|
||||
<div class="statistics-item__label">
|
||||
<img src="@/assets/images/t-icon-1.png" alt="" />拥堵持续时长
|
||||
</div>
|
||||
<div class="statistics-item__value">
|
||||
{{ item.congestDuration }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-item">
|
||||
<Title3 title="拥堵类型分析" />
|
||||
<div class="chart-box">
|
||||
<traffic-jam :series="item.series" :data="item.xdata" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<video-dialog v-model="videoShow" src="" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getRouterListApi } from '@/api/traffic'
|
||||
import countup from 'vue-countup-v3'
|
||||
import trafficJam from './traffic-jam'
|
||||
|
||||
import { useMap } from '@/hooks/map'
|
||||
|
||||
import { getRouterListApi, getRoutersApi } from '@/api/traffic'
|
||||
|
||||
const { map, initMap } = useMap()
|
||||
|
||||
let props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
let current = ref(0)
|
||||
let routerList = ref([])
|
||||
let routers = ref([])
|
||||
let videoShow = ref(false)
|
||||
|
||||
watch(
|
||||
() => [routerList.value, routers.value],
|
||||
(val) => {
|
||||
if (val[0].length > 0) {
|
||||
nextTick(() => {
|
||||
let { longitude, latitude, level } = val[0][0]
|
||||
initMap('traffic-map', longitude, latitude, level)
|
||||
map.value.setTrafficOn()
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
const handleNav = (e, index) => {
|
||||
current.value = index
|
||||
map.value.centerAndZoom(new BMapGL.Point(e.longitude, e.latitude), e.level)
|
||||
@@ -42,15 +136,17 @@
|
||||
const getRouterList = async () => {
|
||||
let res = await getRouterListApi()
|
||||
routerList.value = res.data
|
||||
let { longitude, latitude, level } = routerList.value[0]
|
||||
nextTick(() => {
|
||||
initMap('traffic-map', longitude, latitude, level)
|
||||
map.value.setTrafficOn()
|
||||
})
|
||||
}
|
||||
|
||||
const getRouters = async () => {
|
||||
let res = await getRoutersApi()
|
||||
routers.value = res.data
|
||||
console.log(routers.value, 'routers')
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getRouterList()
|
||||
getRouters()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -58,13 +154,14 @@
|
||||
.box-2 {
|
||||
margin-top: vh(120);
|
||||
display: flex;
|
||||
background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%);
|
||||
}
|
||||
.nav {
|
||||
width: vw(232);
|
||||
margin-left: vw(10);
|
||||
overflow: auto;
|
||||
width: vw(230);
|
||||
height: vh(950);
|
||||
margin-left: vw(8);
|
||||
padding-left: vw(5);
|
||||
overflow: auto;
|
||||
background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%);
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: vw(0); /* 滚动条的宽度 */
|
||||
@@ -89,47 +186,234 @@
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.traffic-map {
|
||||
position: relative;
|
||||
z-index: 9;
|
||||
width: vw(1290);
|
||||
width: vw(1300);
|
||||
height: vh(955);
|
||||
margin: 0 vw(8);
|
||||
padding: vw(20);
|
||||
margin-left: vw(8);
|
||||
box-sizing: border-box;
|
||||
background-image: url('/src/assets/images/map-bg-2.png');
|
||||
background-size: 100% 100%;
|
||||
.video-list {
|
||||
width: vw(320);
|
||||
height: vh(120);
|
||||
background: #0a254b;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
position: absolute;
|
||||
bottom: vw(40);
|
||||
right: vw(40);
|
||||
z-index: 99;
|
||||
}
|
||||
.traffic-map-big {
|
||||
position: relative;
|
||||
z-index: 9;
|
||||
width: vw(2116);
|
||||
height: vh(955);
|
||||
margin-left: vw(8);
|
||||
box-sizing: border-box;
|
||||
background-image: url('/src/assets/images/map-bg-2.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.video-list {
|
||||
width: vw(320);
|
||||
height: vh(120);
|
||||
background: #0a254b;
|
||||
border-radius: 0px 0px 0px 0px;
|
||||
position: absolute;
|
||||
bottom: vw(40);
|
||||
right: vw(40);
|
||||
z-index: 99;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.li {
|
||||
width: vw(140);
|
||||
height: vh(105);
|
||||
background-image: url('/src/assets/images/small-v-bg.png');
|
||||
background-size: 100% 100%;
|
||||
margin-right: vw(6);
|
||||
}
|
||||
.menu {
|
||||
width: vw(12);
|
||||
height: vh(60);
|
||||
font-family: Inter, Inter;
|
||||
font-weight: 400;
|
||||
font-size: vw(12);
|
||||
color: #ffffff;
|
||||
line-height: vh(14);
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
}
|
||||
}
|
||||
.list {
|
||||
width: vw(806);
|
||||
height: vh(952);
|
||||
margin-left: vw(8);
|
||||
overflow: auto;
|
||||
&::-webkit-scrollbar {
|
||||
width: vw(0); /* 滚动条的宽度 */
|
||||
}
|
||||
}
|
||||
.item {
|
||||
margin-bottom: vh(10);
|
||||
background-image: url('@/assets/images/bg-2.png');
|
||||
background-size: 100% 100%;
|
||||
.header {
|
||||
height: vh(72);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.li {
|
||||
width: vw(140);
|
||||
height: vh(105);
|
||||
background-image: url('/src/assets/images/small-v-bg.png');
|
||||
background-size: 100% 100%;
|
||||
margin-right: vw(6);
|
||||
&-left {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
> img {
|
||||
width: vw(30);
|
||||
height: auto;
|
||||
margin-right: vw(15);
|
||||
}
|
||||
}
|
||||
.menu {
|
||||
width: vw(12);
|
||||
height: vh(60);
|
||||
font-family: Inter, Inter;
|
||||
font-weight: 400;
|
||||
font-size: vw(12);
|
||||
&-left__title {
|
||||
margin-right: vw(20);
|
||||
font-size: vw(28);
|
||||
font-weight: bold;
|
||||
color: transparent;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-image: linear-gradient(to bottom, #ffffff 0%, #87c9ff 100%);
|
||||
}
|
||||
&-left__camera {
|
||||
cursor: pointer;
|
||||
width: vw(120);
|
||||
height: vw(72);
|
||||
font-weight: 600;
|
||||
font-size: vw(15);
|
||||
color: #ffffff;
|
||||
line-height: vh(14);
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
padding-left: vw(42);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 vw(20);
|
||||
background-image: url('/src/assets/images/t-a-1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
&-left__point {
|
||||
cursor: pointer;
|
||||
margin: 0 vw(20);
|
||||
width: vw(120);
|
||||
height: vw(72);
|
||||
font-weight: 600;
|
||||
font-size: vw(15);
|
||||
color: #ffffff;
|
||||
padding-left: vw(42);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-image: url('/src/assets/images/t-a-2.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
&-status {
|
||||
min-width: vw(150);
|
||||
height: vw(54);
|
||||
font-weight: 600;
|
||||
font-size: vw(14);
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: vw(50);
|
||||
padding-right: vw(20);
|
||||
background-image: url('/src/assets/images/t-b-1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-item {
|
||||
padding: vw(1);
|
||||
margin-top: vh(10);
|
||||
height: vh(293);
|
||||
background-image: url('@/assets/images/bg-3.png');
|
||||
background-size: 100% 100%;
|
||||
|
||||
.chart-box {
|
||||
width: 100%;
|
||||
height: vh(250);
|
||||
}
|
||||
|
||||
.title-3 {
|
||||
margin-left: vw(10);
|
||||
position: relative;
|
||||
width: vw(344);
|
||||
height: vh(12);
|
||||
margin-top: vh(20);
|
||||
background-image: url('@/assets/images/title-6.png');
|
||||
background-size: 100% 100%;
|
||||
|
||||
& > span {
|
||||
position: absolute;
|
||||
bottom: vh(4);
|
||||
left: vw(20);
|
||||
font-size: vw(15);
|
||||
font-weight: bold;
|
||||
background-image: linear-gradient(to bottom, #ffffff 0%, #0096ff 100%);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
/* 兼容WebKit内核浏览器 */
|
||||
color: transparent;
|
||||
/* 兼容其他浏览器 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.statistics {
|
||||
height: vh(90);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
background-image: url('@/assets/images/bg-3.png');
|
||||
background-size: 100% 100%;
|
||||
|
||||
&-item__label {
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
color: #fff;
|
||||
margin-bottom: vh(10);
|
||||
}
|
||||
&-item__value {
|
||||
padding-left: vw(15);
|
||||
height: vh(30);
|
||||
font-weight: bold;
|
||||
font-size: vw(24);
|
||||
color: #02f9fa;
|
||||
background-image: url('@/assets/images/t-box-title-bg-1.png');
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.item-box {
|
||||
.item-t {
|
||||
display: flex;
|
||||
font-weight: 400;
|
||||
font-size: vw(14);
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-bottom: vh(20);
|
||||
img {
|
||||
margin-right: vw(5);
|
||||
width: vw(8);
|
||||
height: vh(8);
|
||||
}
|
||||
}
|
||||
|
||||
.item-num {
|
||||
width: vw(134);
|
||||
height: vh(30);
|
||||
background-image: url('@/assets/images/t-box-title-bg-1.png');
|
||||
background-size: 100% 100%;
|
||||
font-weight: bold;
|
||||
font-size: vw(24);
|
||||
color: #02f9fa;
|
||||
text-align: left;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
padding-left: vw(15);
|
||||
position: relative;
|
||||
left: vw(-8);
|
||||
|
||||
span {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user