From e5c98a16d26d77a1b9f80ed8278c9ed459d34a32 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Sat, 3 Feb 2024 11:23:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=B6=E6=9E=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.vue | 4 ++-- src/components/areaMap.vue | 35 ++++++++++++++++++++++++++++++----- src/view/detail.vue | 14 ++++++-------- static/jsonData/luxian_geo.js | 2 +- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/components/Header.vue b/src/components/Header.vue index 5baef0f..68efef4 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -6,7 +6,7 @@
{{ areaStore.userInfo.name|| '泸县' }} + src="/static/index/DW.png" alt=""> {{ areaStore.userInfo.name|| '泸县' }}
@@ -23,7 +23,7 @@
-
diff --git a/src/components/areaMap.vue b/src/components/areaMap.vue index f79fb63..23ce465 100644 --- a/src/components/areaMap.vue +++ b/src/components/areaMap.vue @@ -47,9 +47,21 @@ import { areaObj } from "@/store/index.js" import { landListApi } from "@/api.js" import { globalEventBus } from '@/common/eventBus' import { sendMsg } from "@/api.js" + const sendFn = (event, data = '') => { sendMsg({ channel: 'user-11', event, data }) } + +let farmarCenter=[] +const getFamrCenter=async()=>{ + let res=await landListApi({ + ...areaStore.userInfo + }) + farmarCenter=res.data.list.map( item=>([item.longitude,item.latitude]) ) +} + + + const isMainScreen = JSON.parse(localStorage.getItem("TRADE_TYPE")) let geoJson = geoJsonLuxian const areaStore = areaObj() @@ -82,7 +94,7 @@ const pointerFn = () => { geoJson.center.forEach((item, index) => { list.push({ coord: item, - symbol: index == geoJson.center.length - 1 ? ('image://' + lx) : ('image://' + icon),// 自定义图片路径 + symbol: ('image://' + icon),// 自定义图片路径 symbolSize: [100, 30], // 图片大小 symbolOffset: ['50%', '-50%'], value: geoJson.features[index]?.properties.name || '泸县', @@ -112,6 +124,9 @@ const pointerFn2 = (lists) => { }) return list } + + + const initAreaMap =async () => { showArea.value = true await nextTick() @@ -258,25 +273,33 @@ const initAreaMap =async () => { }, // 发散点的大小 - symbolSize: function (val) { + symbolSize: function (val,parmas) { return 4 // return val[2] / 10; }, markPoint: { data: pointerFn() }, - + itemStyle:{ //设置散点样式 + // color:'green' 固定颜色 + color:function(params) // 包含了seriesIndex, dataIndex, data, value等参数 + { + return 'blue'; + } + }, data: (() => { let data = { - 资产数: geoJson.center + 资产数:farmarCenter } + console.log(farmarCenter,"center") let finalData = [] Object.keys(data).map((i, index) => { let child = data[i].map((row, index) => ({ value: row, itemStyle: { - color: index == geoJson.center.length - 1 ? '#FEB821' : '#F0733A', + // color: index == geoJson.center.length - 1 ? '#FEB821' : '#F0733A', + color: '#F0733A', }, })) @@ -526,6 +549,7 @@ const initTownMap = async (name) => { areaStore.changeUserInfoFn(510521, item.code) } }) + params.data.data.forEach(item => { if (item.value[0] == longInfo[0] && item.value[1] == longInfo[1]) { router.push(`/detail?landId=${item.id}&town=${name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${item.name}`) @@ -543,6 +567,7 @@ watch(() => areaStore.userInfo, (value, oldValue) => { ) onMounted(async () => { + getFamrCenter() if(areaStore.userInfo.streetCode)return; setTimeout(() => {showArea.value? initAreaMap(): initTownMap() }, 500) }) diff --git a/src/view/detail.vue b/src/view/detail.vue index 2b4d0ee..c7c15fd 100644 --- a/src/view/detail.vue +++ b/src/view/detail.vue @@ -8,7 +8,7 @@
- +
@@ -49,7 +49,6 @@ import { areaObj } from "@/store/index.js" import JessibucaDemo from "@/components/videoFlv.vue" const areaStore=areaObj() - const showVideo = ref(false) const video_url = ref('') const router = useRouter() @@ -78,7 +77,7 @@ const pullStream = () => { socket.addEventListener('close', onSocketClose); socket.addEventListener('error', onSocketError); } -// pullStream() +pullStream() const getDetail = () => { @@ -86,16 +85,15 @@ const getDetail = () => { landListApi({ ...data }).then(res => { + + console.log(res.data,'res,data') res.data.list.forEach(item => { if (item.id == data.land_id) { video_url.value = item.video_url showVideo.value = true - console.log(showVideo.value,video_url.value) - let data = { username: item.master_phone, - device: 'lihai_lot_walnutpi_dev_' + item.id, - // device: 'lihai_lot_walnutpi_dev_' + 5, + device: 'lihai_lot_walnutpi_dev_' + item.device_id, scene: 'screen' } socket.send(JSON.stringify(data)) @@ -104,7 +102,7 @@ const getDetail = () => { }) } -// getDetail() +getDetail() onBeforeUnmount(() => { socket.close() }) diff --git a/static/jsonData/luxian_geo.js b/static/jsonData/luxian_geo.js index 692294b..22ed16a 100644 --- a/static/jsonData/luxian_geo.js +++ b/static/jsonData/luxian_geo.js @@ -12,7 +12,7 @@ townsCenter({ geoJsonLuxian.features.forEach(item=>{ geoJsonLuxian.center.push(item.center) }) - geoJsonLuxian.center.push([105.370, 29.145]) + // geoJsonLuxian.center.push([105.370, 29.145]) }) let geoJsonLuxian = { "type": "FeatureCollection",