feat:完善样式

This commit is contained in:
zjc
2025-03-05 19:59:23 +08:00
parent 21cb9b04ca
commit 5619c9ddfb
5 changed files with 73 additions and 30 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -4,12 +4,12 @@
<li <li
class="nav-left-item" class="nav-left-item"
:style="{ :style="{
backgroundImage: `url(${current === index && !isSkip ? title2Select : title2})` backgroundImage: `url(${current === item.id && !isSkip ? title2Select : title2})`
}" }"
v-for="(item, index) in navLeft" v-for="(item, index) in navLeft"
:key="index" :key="index"
:title="item.name" :title="item.name"
@click="handleNav(item, index)" @click="handleNav(item)"
> >
{{ item.name }} {{ item.name }}
</li> </li>
@@ -18,7 +18,7 @@
['/scenic', '/hotel'].includes(router.currentRoute.value.path) && otherLeftNav.length > 0 ['/scenic', '/hotel'].includes(router.currentRoute.value.path) && otherLeftNav.length > 0
" "
trigger="click" trigger="click"
@command="handleCommand" @command="handleCommand($event, 'hotel')"
> >
<li <li
class="nav-left-item" class="nav-left-item"
@@ -44,13 +44,40 @@
<ul class="nav-right"> <ul class="nav-right">
<li <li
class="nav-right-item" class="nav-right-item"
:style="{
backgroundImage: `url(${current === item.id && !isSkip ? title3Select : title3})`
}"
v-for="(item, index) in navRight" v-for="(item, index) in navRight"
:key="index" :key="index"
:title="item.name" :title="item.name"
@click="handleNav(item, index)" @click="handleNav(item)"
> >
{{ item.name }} {{ item.name }}
</li> </li>
<el-dropdown
v-if="
['/scenic', '/hotel'].includes(router.currentRoute.value.path) && otherRightNav.length > 0
"
trigger="click"
@command="handleCommand($event, 'venue')"
>
<li
class="nav-right-item"
:style="{
backgroundImage: `url(${title3})`
}"
>
{{ otherRightLabel }}
<img class="icon" src="@/assets/images/arrow-down-1.png" />
</li>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-for="(item, index) in otherRightNav" :key="index" :command="item">
<span class="label"> {{ item.name }}</span>
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</ul> </ul>
<div class="weather"> <div class="weather">
<span>{{ weatherData?.temperature }}-{{ weatherData?.skycon }}</span> <span>{{ weatherData?.temperature }}-{{ weatherData?.skycon }}</span>
@@ -70,7 +97,9 @@
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import title2 from '@/assets/images/title-2.png' import title2 from '@/assets/images/title-2.png'
import title3 from '@/assets/images/title-3.png'
import title2Select from '@/assets/images/title-2-select.png' import title2Select from '@/assets/images/title-2-select.png'
import title3Select from '@/assets/images/title-3-select.png'
import { getWeatherApi } from '@/api/home' import { getWeatherApi } from '@/api/home'
import { getSpotListApi } from '@/api/sentiment' import { getSpotListApi } from '@/api/sentiment'
@@ -87,9 +116,11 @@
let navRight = ref([]) let navRight = ref([])
let isSkip = ref(true) let isSkip = ref(true)
let isBack = ref(false) let isBack = ref(false)
let current = ref(0) let current = ref(1)
let otherLeftLabel = ref('') let otherLeftLabel = ref('')
let otherRightLabel = ref('')
let otherLeftNav = ref([]) let otherLeftNav = ref([])
let otherRightNav = ref([])
let spotList = ref([]) let spotList = ref([])
// 补零 // 补零
@@ -115,9 +146,15 @@
const handleBack = () => { const handleBack = () => {
router.push('/home') router.push('/home')
} }
const handleCommand = (item) => { const handleCommand = (item, type) => {
current.value = '' current.value = ''
otherLeftLabel.value = item.name if (type === 'hotel') {
otherRightLabel.value = '其他场馆'
otherLeftLabel.value = item.name
} else {
otherLeftLabel.value = '其他酒店'
otherRightLabel.value = item.name
}
switch (router.currentRoute.value.path) { switch (router.currentRoute.value.path) {
case '/scenic': case '/scenic':
pubSub.publish('scenicChange', item) pubSub.publish('scenicChange', item)
@@ -131,19 +168,21 @@
} }
} }
// 点击导航 // 点击导航
const handleNav = (item, index) => { const handleNav = (item) => {
if (isSkip.value) { if (isSkip.value) {
router.push(item.path) router.push(item.path)
} else { } else {
if (current.value === index) return if (current.value === item.id) return
otherLeftLabel.value = '其他酒店' otherLeftLabel.value = '其他酒店'
current.value = index otherRightLabel.value = '其他场馆'
title.value = item.name current.value = item.id
switch (router.currentRoute.value.path) { switch (router.currentRoute.value.path) {
case '/scenic': case '/scenic':
title.value = item.name
pubSub.publish('scenicChange', item) pubSub.publish('scenicChange', item)
break break
case '/monitor': case '/monitor':
title.value = item.name
pubSub.publish('monitorChange', item) pubSub.publish('monitorChange', item)
break break
case '/hotel': case '/hotel':
@@ -167,6 +206,8 @@
const setNav = async () => { const setNav = async () => {
navLeft.value = [] navLeft.value = []
navRight.value = [] navRight.value = []
otherLeftNav.value = []
otherRightNav.value = []
switch (router.currentRoute.value.path) { switch (router.currentRoute.value.path) {
case '/home': case '/home':
title.value = '奉节县旅游指挥调度中心' title.value = '奉节县旅游指挥调度中心'
@@ -273,13 +314,17 @@
case '/hotel': case '/hotel':
title.value = '酒店场馆' title.value = '酒店场馆'
otherLeftLabel.value = '其他酒店' otherLeftLabel.value = '其他酒店'
otherRightLabel.value = '其他场馆'
isSkip.value = false isSkip.value = false
current.vlaue = '' current.vlaue = ''
isBack.value = true isBack.value = true
let hotelRes = await getHotelListApi({ hotelStadiumType: 1 }) let hotelRes = await getHotelListApi({ hotelStadiumType: 1 })
navLeft.value = hotelRes.data.slice(0, 3) navLeft.value = hotelRes.data.slice(0, 3)
pubSub.publish('hotelChange', hotelRes.data[0])
otherLeftNav.value = hotelRes.data.slice(3, hotelRes.data.length - 1) otherLeftNav.value = hotelRes.data.slice(3, hotelRes.data.length - 1)
let venueRes = await getHotelListApi({ hotelStadiumType: 2 })
navRight.value = venueRes.data.slice(0, 3)
otherRightNav.value = venueRes.data.slice(3, venueRes.data.length - 1)
pubSub.publish('hotelChange', hotelRes.data[0])
break break
} }
} }
@@ -411,6 +456,10 @@
color: rgba(208, 236, 255, 0.9); color: rgba(208, 236, 255, 0.9);
background-image: url('@/assets/images/title-3.png'); background-image: url('@/assets/images/title-3.png');
background-size: 100% 100%; background-size: 100% 100%;
.icon {
width: vw(18);
height: vw(18);
}
} }
} }
} }

View File

@@ -88,7 +88,6 @@
<script setup> <script setup>
import countup from 'vue-countup-v3' import countup from 'vue-countup-v3'
import map from '@/assets/images/map-img-1.jpg'
import pubSub from 'pubsub-js' import pubSub from 'pubsub-js'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
@@ -97,15 +96,14 @@
let info = ref(null) let info = ref(null)
onMounted(() => { onMounted(() => {
hotelChange = PubSub.subscribe('hotelChange', (msg, data) => { hotelChange = pubSub.subscribe('hotelChange', (msg, data) => {
let newData = cloneDeep(data) let newData = cloneDeep(data)
newData.banner = newData.banner ? newData.banner.split(',') : [] newData.banner = newData.banner ? newData.banner.split(',') : []
info.value = newData info.value = newData
console.log(info.value, 'info.value')
}) })
}) })
onUnmounted(() => { onUnmounted(() => {
if (hotelChange) PubSub.unsubscribe(hotelChange) if (hotelChange) pubSub.unsubscribe(hotelChange)
}) })
</script> </script>

View File

@@ -147,7 +147,6 @@
if (map.value && modelValue.value) { if (map.value && modelValue.value) {
// 109.645729,31.041203 // 109.645729,31.041203
if (carOverlays.value.length > 0) { if (carOverlays.value.length > 0) {
console.log(11111)
// 更新车辆marker位置 // 更新车辆marker位置
let flag = false let flag = false
for (let i = 0; i < carOverlays.value.length; i++) { for (let i = 0; i < carOverlays.value.length; i++) {
@@ -159,7 +158,7 @@
lat: props.carList[j].lat lat: props.carList[j].lat
}) })
flag = true flag = true
break continue
} }
} }
} }
@@ -175,11 +174,14 @@
lng: props.carList[i].lng, lng: props.carList[i].lng,
lat: props.carList[i].lat lat: props.carList[i].lat
}) })
currentMarker.value.setPosition({
lng: props.carList[i].lng,
lat: props.carList[i].lat
})
break break
} }
} }
} else { } else {
console.log(2222)
props.carList.map((item, i) => { props.carList.map((item, i) => {
if (item.lng && item.lat) { if (item.lng && item.lat) {
addMarker(carIcon, [item.lng, item.lat], [36, 50]) addMarker(carIcon, [item.lng, item.lat], [36, 50])

View File

@@ -12,7 +12,7 @@
</li> </li>
</ul> </ul>
<div id="traffic-map" :class="[routers.length == 0 ? 'traffic-map-big' : 'traffic-map']" /> <div id="traffic-map" class="traffic-map-big" :class="{ 'traffic-map': routers.length > 0 }" />
<div v-if="routers.length > 0" class="list"> <div v-if="routers.length > 0" class="list">
<div class="item" v-for="(item, index) in routers" :key="index" @click="handleRouter(item)"> <div class="item" v-for="(item, index) in routers" :key="index" @click="handleRouter(item)">
@@ -183,16 +183,7 @@
background-size: 100% 100%; background-size: 100% 100%;
} }
} }
.traffic-map {
position: relative;
z-index: 9;
width: vw(1500);
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%;
}
.traffic-map-big { .traffic-map-big {
position: relative; position: relative;
z-index: 9; z-index: 9;
@@ -203,6 +194,9 @@
background-image: url('/src/assets/images/map-bg-2.png'); background-image: url('/src/assets/images/map-bg-2.png');
background-size: 100% 100%; background-size: 100% 100%;
} }
.traffic-map {
width: vw(1500) !important;
}
.video-list { .video-list {
width: vw(320); width: vw(320);
height: vh(120); height: vh(120);