feat:对接交通大屏

This commit is contained in:
zjc
2025-01-18 11:06:19 +08:00
parent 8eb966fa14
commit 46c737fb93
4 changed files with 47 additions and 44 deletions

9
src/api/traffic.js Normal file
View File

@@ -0,0 +1,9 @@
import request from './request'
// 交通路段
export function getRouterListApi() {
return request({
url: '/fjtcc-api/api/largeScreen/router/list',
method: 'get'
})
}

View File

@@ -66,7 +66,7 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.box-1 { .box-1 {
margin-top: vh(120); margin-top: vh(120);
width: vw(940); width: vw(826);
height: vh(950); height: vh(950);
background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%); background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%);
@@ -77,7 +77,7 @@
padding: 0 vw(8); padding: 0 vw(8);
&-item { &-item {
width: vw(456); width: vw(400);
background-image: url('@/assets/images/bg-3.png'); background-image: url('@/assets/images/bg-3.png');
background-size: 100% 100%; background-size: 100% 100%;
} }

View File

@@ -4,16 +4,16 @@
<li <li
class="nav-item" class="nav-item"
:class="{ active: current == index }" :class="{ active: current == index }"
v-for="(item, index) in 20" v-for="(item, index) in routerList"
:key="index" :key="index"
@click="handleNav(index)" @click="handleNav(item, index)"
>路段{{ index + 1 }} >
{{ item.name }}
</li> </li>
</ul> </ul>
<div id="traffic-map" class="traffic-map" />
<div class="map-box"> <div class="map-box">
<Map /> <!-- <div class="video-list">
<div class="video-list">
<div class="li"> <div class="li">
<vue3VideoPlay v-bind="options" /> <vue3VideoPlay v-bind="options" />
</div> </div>
@@ -21,53 +21,47 @@
<vue3VideoPlay v-bind="options" /> <vue3VideoPlay v-bind="options" />
</div> </div>
<div class="menu">查看更多</div> <div class="menu">查看更多</div>
</div> </div> -->
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import Map from '@/components/Map/marker.vue' import { getRouterListApi } from '@/api/traffic'
let current = ref(0) import { useMap } from '@/hooks/map'
const options = reactive({
src: 'http://192.168.1.60:8080/live/340200000013200000011_34020000001320000001/hls.m3u8', //视频源
type: 'm3u8', //视频类型
width: '100%',
height: '100%',
color: '#409eff', //主题色
title: '', //视频名称
muted: false, //静音
webFullScreen: false,
speedRate: ['0.75', '1.0', '1.25', '1.5', '2.0'], //播放倍速
autoPlay: true, //自动播放
loop: false, //循环播放
mirror: false, //镜像画面
ligthOff: false, //关灯模式
volume: 0.3, //默认音量大小
control: true, //是否显示控制
controlBtns: [
// "audioTrack",
// "quality",
// "speedRate",
// "volume",
'setting',
'pip',
'pageFullScreen',
'fullScreen'
] //显示所有按钮,
})
const handleNav = (e) => { const { map, initMap } = useMap()
current.value = e
let current = ref(0)
let routerList = ref([])
const handleNav = (e, index) => {
current.value = index
map.value.centerAndZoom(new BMapGL.Point(e.longitude, e.latitude), e.level)
} }
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()
})
}
onMounted(() => {
getRouterList()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.box-2 { .box-2 {
display: flex;
margin-top: vh(120); margin-top: vh(120);
display: flex;
background: linear-gradient(321deg, #0b2f64 0%, #062b57 100%);
} }
.nav { .nav {
width: vw(232);
margin-left: vw(10); margin-left: vw(10);
overflow: auto; overflow: auto;
height: vh(950); height: vh(950);
@@ -79,7 +73,7 @@
&-item { &-item {
cursor: pointer; cursor: pointer;
margin-bottom: vw(15); margin-bottom: vw(15);
width: vw(120); width: vw(220);
height: vh(54); height: vh(54);
font-weight: bold; font-weight: bold;
font-size: vw(18); font-size: vw(18);
@@ -96,7 +90,7 @@
} }
} }
.map-box { .traffic-map {
position: relative; position: relative;
z-index: 9; z-index: 9;
width: vw(1290); width: vw(1290);

View File

@@ -88,7 +88,7 @@
<style scoped lang="scss"> <style scoped lang="scss">
.spotRate { .spotRate {
width: vw(240); width: vw(200);
height: vh(320); height: vh(320);
} }
</style> </style>