This commit is contained in:
parent
ef9a657d75
commit
52004b1df4
25
src/App.vue
25
src/App.vue
|
@ -11,15 +11,14 @@ const userInfoStore=areaObj()
|
||||||
userInfoStore.changeUserInfoFn(510521)
|
userInfoStore.changeUserInfoFn(510521)
|
||||||
|
|
||||||
|
|
||||||
const openPush=()=>{
|
const openPush=(uid=11)=>{
|
||||||
var connection = new Push({
|
var connection = new Push({
|
||||||
url: 'wss://chat.lihaink.cn/tts', // websocket地址
|
url: 'wss://chat.lihaink.cn/tts', // websocket地址
|
||||||
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
|
||||||
});
|
});
|
||||||
// 假设用户uid为1
|
// 假设用户uid为1
|
||||||
var uid = 11;
|
|
||||||
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
// 浏览器监听user-2频道的消息,也就是用户uid为1的用户消息
|
||||||
var user_channel = connection.subscribe('user-' + uid);
|
var user_channel = connection.subscribe( uid==11?'user-' + uid:uid+'user-plant' );
|
||||||
|
|
||||||
// 当user-2频道有message事件的消息时
|
// 当user-2频道有message事件的消息时
|
||||||
user_channel.on('message', function (data) {
|
user_channel.on('message', function (data) {
|
||||||
|
@ -35,7 +34,25 @@ globalEventBus.on('refresh', data => {
|
||||||
router.go(0)
|
router.go(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
if( !JSON.parse(localStorage.getItem("TRADE_TYPE")) )openPush();
|
|
||||||
|
|
||||||
|
|
||||||
|
// 获取 URL 中的查询参数部分
|
||||||
|
var queryString = window.location.hash.split("?")[1];
|
||||||
|
// 解析查询参数字符串
|
||||||
|
const searchParams = new URLSearchParams(queryString);
|
||||||
|
|
||||||
|
// 读取名为 id 的参数
|
||||||
|
const id = searchParams.get('local') || '';
|
||||||
|
if (!JSON.parse(localStorage.getItem("TRADE_TYPE"))) {
|
||||||
|
if (id) {
|
||||||
|
openPush(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
openPush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -36,12 +36,12 @@
|
||||||
import { ref, onMounted, watch, defineEmits, nextTick } from "vue"
|
import { ref, onMounted, watch, defineEmits, nextTick } from "vue"
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
import geoJsonLuxian from "/static/jsonData/luxian_geo.js"
|
import geoJsonLuxian from "/static/jsonData/luxian_geo.js"
|
||||||
// import geoJsonGulin from "/static/jsonData/gulin_geo.js"
|
import geoJsonGulin from "/static/jsonData/gulin_geo.js"
|
||||||
// import geoJsonHejiang from "/static/jsonData/hejiang_geo.js"
|
import geoJsonHejiang from "/static/jsonData/hejiang_geo.js"
|
||||||
// import geoJsonJiangyang from "/static/jsonData/jiangyang_geo.js"
|
import geoJsonJiangyang from "/static/jsonData/jiangyang_geo.js"
|
||||||
// import geoJsonLongmatan from "/static/jsonData/longmatan_geo.js"
|
import geoJsonLongmatan from "/static/jsonData/longmatan_geo.js"
|
||||||
// import geoJsonNaxi from "/static/jsonData/naxi_geo.js"
|
import geoJsonNaxi from "/static/jsonData/naxi_geo.js"
|
||||||
// import geoJsonXuyong from "/static/jsonData/xuyong_geo.js"
|
import geoJsonXuyong from "/static/jsonData/xuyong_geo.js"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
import { areaObj } from "@/store/index.js"
|
import { areaObj } from "@/store/index.js"
|
||||||
import { landListApi } from "@/api.js"
|
import { landListApi } from "@/api.js"
|
||||||
|
@ -49,15 +49,17 @@ import { globalEventBus } from '@/common/eventBus'
|
||||||
import { sendMsg } from "@/api.js"
|
import { sendMsg } from "@/api.js"
|
||||||
|
|
||||||
const sendFn = (event, data = '') => {
|
const sendFn = (event, data = '') => {
|
||||||
sendMsg({ channel: 'user-11', event, data })
|
sendMsg({ channel: 'user-11', event, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
let farmarCenter=[]
|
let farmarCenter = []
|
||||||
const getFamrCenter=async()=>{
|
const getFamrCenter = async () => {
|
||||||
let res=await landListApi({
|
farmarCenter = []
|
||||||
...areaStore.userInfo
|
let res = await landListApi({
|
||||||
})
|
...areaStore.userInfo
|
||||||
farmarCenter=res.data.list.map( item=>([item.longitude,item.latitude]) )
|
})
|
||||||
|
farmarCenter = res.data.list.map(item => ([item.longitude, item.latitude]))
|
||||||
|
return Promise.resolve(farmarCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ const isMainScreen = JSON.parse(localStorage.getItem("TRADE_TYPE"))
|
||||||
let geoJson = geoJsonLuxian
|
let geoJson = geoJsonLuxian
|
||||||
const areaStore = areaObj()
|
const areaStore = areaObj()
|
||||||
const showArea = (ref(true))
|
const showArea = (ref(true))
|
||||||
if(areaStore.userInfo.streetCode)showArea.value=false;
|
if (areaStore.userInfo.streetCode) showArea.value = false;
|
||||||
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -94,7 +96,7 @@ const pointerFn = () => {
|
||||||
geoJson.center.forEach((item, index) => {
|
geoJson.center.forEach((item, index) => {
|
||||||
list.push({
|
list.push({
|
||||||
coord: item,
|
coord: item,
|
||||||
symbol: ('image://' + icon),// 自定义图片路径
|
symbol: ('image://' + icon),// 自定义图片路径
|
||||||
symbolSize: [100, 30], // 图片大小
|
symbolSize: [100, 30], // 图片大小
|
||||||
symbolOffset: ['50%', '-50%'],
|
symbolOffset: ['50%', '-50%'],
|
||||||
value: geoJson.features[index]?.properties.name || '泸县',
|
value: geoJson.features[index]?.properties.name || '泸县',
|
||||||
|
@ -127,7 +129,7 @@ const pointerFn2 = (lists) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const initAreaMap =async () => {
|
const initAreaMap = async () => {
|
||||||
showArea.value = true
|
showArea.value = true
|
||||||
await nextTick()
|
await nextTick()
|
||||||
var mapName = 'lz';
|
var mapName = 'lz';
|
||||||
|
@ -273,26 +275,25 @@ const initAreaMap =async () => {
|
||||||
},
|
},
|
||||||
|
|
||||||
// 发散点的大小
|
// 发散点的大小
|
||||||
symbolSize: function (val,parmas) {
|
symbolSize: function (val, parmas) {
|
||||||
return 4
|
return 4
|
||||||
// return val[2] / 10;
|
// return val[2] / 10;
|
||||||
},
|
},
|
||||||
markPoint: {
|
markPoint: {
|
||||||
data: pointerFn()
|
data: pointerFn()
|
||||||
},
|
},
|
||||||
itemStyle:{ //设置散点样式
|
itemStyle: { //设置散点样式
|
||||||
// color:'green' 固定颜色
|
// color:'green' 固定颜色
|
||||||
color:function(params) // 包含了seriesIndex, dataIndex, data, value等参数
|
color: function (params) // 包含了seriesIndex, dataIndex, data, value等参数
|
||||||
{
|
{
|
||||||
return 'blue';
|
return 'blue';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: (() => {
|
data: (() => {
|
||||||
let data = {
|
let data = {
|
||||||
资产数:farmarCenter
|
资产数: farmarCenter
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log(farmarCenter,"center")
|
|
||||||
let finalData = []
|
let finalData = []
|
||||||
Object.keys(data).map((i, index) => {
|
Object.keys(data).map((i, index) => {
|
||||||
let child = data[i].map((row, index) => ({
|
let child = data[i].map((row, index) => ({
|
||||||
|
@ -549,7 +550,7 @@ const initTownMap = async (name) => {
|
||||||
areaStore.changeUserInfoFn(510521, item.code)
|
areaStore.changeUserInfoFn(510521, item.code)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
params.data.data.forEach(item => {
|
params.data.data.forEach(item => {
|
||||||
if (item.value[0] == longInfo[0] && item.value[1] == longInfo[1]) {
|
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}`)
|
router.push(`/detail?landId=${item.id}&town=${name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${item.name}`)
|
||||||
|
@ -560,16 +561,53 @@ const initTownMap = async (name) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => areaStore.userInfo, (value, oldValue) => {
|
watch(() => areaStore.userInfo, (value, oldValue) => {
|
||||||
value.name == '泸县' ? initAreaMap() : initTownMap(value.name)
|
|
||||||
|
if (!value.streetCode) {
|
||||||
|
|
||||||
|
switch (value.areaCode) {
|
||||||
|
case "510521":
|
||||||
|
geoJson = geoJsonLuxian
|
||||||
|
break;
|
||||||
|
case '510502':
|
||||||
|
geoJson = geoJsonJiangyang
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510503':
|
||||||
|
geoJson = geoJsonNaxi
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510504':
|
||||||
|
geoJson = geoJsonLongmatan
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510522':
|
||||||
|
geoJson = geoJsonHejiang
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510524':
|
||||||
|
geoJson = geoJsonXuyong
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510525':
|
||||||
|
geoJson = geoJsonGulin
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
getFamrCenter().then(res => {
|
||||||
|
initAreaMap()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
initTownMap(value.name)
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
)
|
)
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
getFamrCenter()
|
await getFamrCenter()
|
||||||
if(areaStore.userInfo.streetCode)return;
|
if (areaStore.userInfo.streetCode) return;
|
||||||
setTimeout(() => {showArea.value? initAreaMap(): initTownMap() }, 500)
|
setTimeout(() => { showArea.value ? initAreaMap() : initTownMap() }, 500)
|
||||||
})
|
})
|
||||||
|
|
||||||
globalEventBus.on('choserArea', data => {
|
globalEventBus.on('choserArea', data => {
|
||||||
|
@ -585,9 +623,10 @@ globalEventBus.on('choseTown', data => {
|
||||||
initTownMap(data.name)
|
initTownMap(data.name)
|
||||||
})
|
})
|
||||||
|
|
||||||
// globalEventBus.on('choseLand', data => {
|
globalEventBus.on('choseLand', data => {
|
||||||
// router.push(`/detail?landId=${data.id}&town=${areaStore.userInfo.name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${data.landName}`)
|
areaStore.changeUserInfoFn(data.areaCode, data.townCode, data.town_name)
|
||||||
// })
|
router.push(`/detail?landId=${data.id}&town=${areaStore.userInfo.name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${data.landName}`)
|
||||||
|
})
|
||||||
|
|
||||||
// globalEventBus.on('initAreaMap', data => {
|
// globalEventBus.on('initAreaMap', data => {
|
||||||
// areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, '', '')
|
// areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, '', '')
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, defineEmits,watch } from "vue"
|
import { ref, onMounted, defineEmits, watch } from "vue"
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
import "echarts-gl"
|
import "echarts-gl"
|
||||||
import geoJsonLuxian from "/static/jsonData/luxian_geo.js"
|
import geoJsonLuxian from "/static/jsonData/luxian_geo.js"
|
||||||
|
@ -42,23 +42,23 @@ import geoJsonJiangyang from "/static/jsonData/jiangyang_geo.js"
|
||||||
import geoJsonLongmatan from "/static/jsonData/longmatan_geo.js"
|
import geoJsonLongmatan from "/static/jsonData/longmatan_geo.js"
|
||||||
import geoJsonNaxi from "/static/jsonData/naxi_geo.js"
|
import geoJsonNaxi from "/static/jsonData/naxi_geo.js"
|
||||||
import geoJsonXuyong from "/static/jsonData/xuyong_geo.js"
|
import geoJsonXuyong from "/static/jsonData/xuyong_geo.js"
|
||||||
import { useRoute,useRouter } from "vue-router"
|
import { useRoute, useRouter } from "vue-router"
|
||||||
import { areaObj } from "@/store/index.js"
|
import { areaObj } from "@/store/index.js"
|
||||||
import { landListApi } from "@/api.js"
|
import { landListApi } from "@/api.js"
|
||||||
import { globalEventBus } from '@/common/eventBus'
|
import { globalEventBus } from '@/common/eventBus'
|
||||||
const router=useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
let geoJson ;
|
let geoJson;
|
||||||
const icon = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231204\/202312041608529c9e21252.png"
|
const icon = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231204\/202312041608529c9e21252.png"
|
||||||
const areaStore = areaObj()
|
const areaStore = areaObj()
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510503) geoJson = geoJsonNaxi;
|
if (JSON.parse(route.query.parmas).areaCode == 510503) geoJson = geoJsonNaxi;
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510502) geoJson = geoJsonJiangyang;
|
if (JSON.parse(route.query.parmas).areaCode == 510502) geoJson = geoJsonJiangyang;
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510504) geoJson = geoJsonLongmatan;
|
if (JSON.parse(route.query.parmas).areaCode == 510504) geoJson = geoJsonLongmatan;
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510521) geoJson = geoJsonLuxian;
|
if (JSON.parse(route.query.parmas).areaCode == 510521) geoJson = geoJsonLuxian;
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510522) geoJson = geoJsonHejiang;
|
if (JSON.parse(route.query.parmas).areaCode == 510522) geoJson = geoJsonHejiang;
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510524) geoJson = geoJsonXuyong;
|
if (JSON.parse(route.query.parmas).areaCode == 510524) geoJson = geoJsonXuyong;
|
||||||
if(JSON.parse(route.query.parmas).areaCode==510525) geoJson = geoJsonGulinc;
|
if (JSON.parse(route.query.parmas).areaCode == 510525) geoJson = geoJsonGulinc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,13 +93,13 @@ const deepCopy = (obj) => {
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
const townJson = deepCopy(JSON.parse( JSON.stringify(geoJson)) )
|
let townJson = deepCopy(JSON.parse(JSON.stringify(geoJson)))
|
||||||
townJson.features=geoJson.features
|
townJson.features = geoJson.features
|
||||||
townJson.features = townJson.features.filter((item) => {
|
townJson.features = townJson.features.filter((item) => {
|
||||||
return item.properties.name == route.query.town
|
return item.properties.name == route.query.town
|
||||||
})
|
})
|
||||||
const lx = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231205\/20231205092709cfe148712.png"
|
const lx = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231205\/20231205092709cfe148712.png"
|
||||||
const initMap=async ()=>{
|
const initMap = async () => {
|
||||||
let center = []
|
let center = []
|
||||||
let pointerList = []
|
let pointerList = []
|
||||||
let res = await landListApi({
|
let res = await landListApi({
|
||||||
|
@ -341,6 +341,58 @@ const initMap=async ()=>{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(() => areaStore.userInfo, (value, oldValue) => {
|
||||||
|
|
||||||
|
// if (!value.streetCode) {
|
||||||
|
|
||||||
|
switch (value.areaCode) {
|
||||||
|
case "510521":
|
||||||
|
geoJson = geoJsonLuxian
|
||||||
|
break;
|
||||||
|
case '510502':
|
||||||
|
geoJson = geoJsonJiangyang
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510503':
|
||||||
|
geoJson = geoJsonNaxi
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510504':
|
||||||
|
geoJson = geoJsonLongmatan
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510522':
|
||||||
|
geoJson = geoJsonHejiang
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510524':
|
||||||
|
geoJson = geoJsonXuyong
|
||||||
|
|
||||||
|
break;
|
||||||
|
case '510525':
|
||||||
|
geoJson = geoJsonGulin
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
townJson = deepCopy(JSON.parse(JSON.stringify(geoJson)))
|
||||||
|
townJson.features = townJson.features.filter((item) => {
|
||||||
|
return item.properties.name == value.name
|
||||||
|
})
|
||||||
|
console.log(townJson.features)
|
||||||
|
initMap()
|
||||||
|
|
||||||
|
// getFamrCenter().then(res => {
|
||||||
|
// initAreaMap()
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// initTownMap(value.name)
|
||||||
|
// }
|
||||||
|
}, {
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
initMap()
|
initMap()
|
||||||
|
|
||||||
|
@ -348,9 +400,5 @@ onMounted(async () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
globalEventBus.on('detail', data => {
|
|
||||||
emit('changeLand', data)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
|
@ -8,7 +8,7 @@
|
||||||
<leftCenter :data="data" :key="data.land_id"></leftCenter>
|
<leftCenter :data="data" :key="data.land_id"></leftCenter>
|
||||||
</div>
|
</div>
|
||||||
<div class="top center">
|
<div class="top center">
|
||||||
<JessibucaDemo v-if="video_url&&showVideo" :src="video_url"></JessibucaDemo>
|
<!-- <JessibucaDemo v-if="video_url&&showVideo" :src="video_url"></JessibucaDemo> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
|
@ -118,6 +118,15 @@ const back = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalEventBus.on('choseLand', datas => {
|
||||||
|
console.log(data,'data')
|
||||||
|
data.land_id=datas.id
|
||||||
|
landName.value=datas.landName
|
||||||
|
areaStore.changeUserInfoFn(datas.areaCode, datas.townCode, datas.town_name)
|
||||||
|
// router.push(`/detail?landId=${data.id}&town=${areaStore.userInfo.name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${data.landName}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
globalEventBus.on('backHome', data => {
|
globalEventBus.on('backHome', data => {
|
||||||
back()
|
back()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue