This commit is contained in:
zmj 2024-02-02 18:21:43 +08:00
parent c13e52d482
commit 138bec70e2
11 changed files with 123 additions and 185 deletions

View File

@ -1,4 +1,4 @@
<script setup lang="ts">
<script setup >
// let Token =localStorage.getItem('TOKEN')
@ -7,54 +7,35 @@ import { Push } from '@/common/push'
import { areaObj } from "@/store/index.js"
import { useRouter } from 'vue-router';
const router=useRouter()
const userInfoStore=areaObj()
userInfoStore.changeUserInfoFn(510521)
const openPush=()=>{
var connection = new Push({
url: 'wss://chat.lihaink.cn/tts', // websocket
app_key: 'aaea61749929eb53a4bd75a1474c1d27',
});
// uid1
var uid = 3;
var uid = 11;
// user-2uid1
var user_channel = connection.subscribe('user-' + uid);
// user-2message
user_channel.on('message', function (data) {
globalEventBus.emit(data.content.event, data.content.data)
});
// 线
user_channel.on('close', function () {
});
}
globalEventBus.on('refresh', data => {
router.go(0)
})
// var ws = new WebSocket("ws://192.168.26.167:8080");
// //WebSocketonopen
// ws.onopen = function () {
// console.log("open");
// }
// //onmessagee.dataserver
// ws.onmessage = function (e) {
// let data =JSON.parse(e.data)
// globalEventBus.emit(data.event, data.data ||'')
// }
if( !JSON.parse(localStorage.getItem("TRADE_TYPE")) )openPush();
</script>
<template>

View File

@ -11,6 +11,10 @@ const instacne = axios.create({
timeout: 30000,
});
const instacneSend = axios.create({
baseURL: "http://chat.lihaink.cn/index/",
timeout: 30000,
});
// 请求拦截
instacne.interceptors.request.use(
@ -37,7 +41,9 @@ instacne.interceptors.response.use(
);
export function sendMsg(params) {
return instacneSend.get('/dataviewTouchPush', { params })
}
export function deviceAlarmCountApi(params) {
return instacne.get('/api/dataview.device/deviceAlarmCount', { params })

View File

@ -5,10 +5,11 @@
<!-- <div style="color: red;">{{ areaStore.userInfo }}</div> -->
<div class="right">
<div class="rigth-li" @click="choseArea = true"> <img style="width: 1VW;height:1VW;margin-right: 0.5vw;"
<div class="rigth-li b-cls" @click="choseArea = true"> <img style="width: 1VW;height:1VW;margin-right: 0.5vw;"
:src="u('DW')" alt=""> {{ areaStore.userInfo.name|| '泸县' }}
<areaList :choseArea="choseArea" @offAreaList="offAreaList" :key="areaStore.userInfo.name" class="a-cls"></areaList>
</div>
<areaList :choseArea="choseArea" @offAreaList="offAreaList" :key="areaStore.userInfo.name"></areaList>
<div class="right-line">
<span></span>
<span></span>
@ -101,20 +102,12 @@ onMounted(() => {
justify-content: space-between;
background-image: url('/static/index/tit.png');
background-color: #000C14;
background-size: cover;
.right {
display: flex;
font-size: 15px;
margin-right: 30px;
position: relative;
.rigth-li {
height: 15px;
line-height: 15px;
@ -140,6 +133,24 @@ onMounted(() => {
}
}
}
.a-cls{
height: 0;
position: absolute;
top: 2vh;
display: block;
z-index: 999;
transition: 300ms;
left: 2vw;
}
.b-cls{
position: relative;
}
.b-cls:hover .a-cls{
height: 18vh;
display: block;
}
.v-enter-active,
.v-leave-active {

View File

@ -1,6 +1,6 @@
<template>
<Transition>
<div class="address" v-if="props.choseArea">
<div class="address">
<div class="address-li" @click="choseTownFn({ name: '泸县', code: 510521, isArea: true })"> 泸县</div>
<div class="address-li" @click="choseTownFn(item)" v-for="( item, index ) in areaList ">{{ item.name }}</div>
</div>
@ -12,6 +12,12 @@ import { defineProps, defineEmits } from "vue"
import { reactive } from "vue"
import axios from "axios"
import { areaObj } from "@/store/index.js"
import { sendMsg } from "@/api.js"
const sendFn = (event, data = '') => {
sendMsg({ channel: 'user-11', event, data })
}
const isMainScreen = JSON.parse(localStorage.getItem("TRADE_TYPE"))
const userInfoStore = areaObj()
const emit = defineEmits(['offAreaList'])
const props = defineProps({
@ -19,50 +25,32 @@ const props = defineProps({
})
const areaList = reactive([])
//
// ze
const choseTownFn = (item) => {
if (item.isArea)
{
userInfoStore.changeUserInfoFn( item.code ,null )
userInfoStore.changeAddress(item.name,'')
if (isMainScreen) {
// console.log("sdfhsdghfj")
item.code == 510521? sendFn('choserArea', { name: item.name, code: item.code }): sendFn('choseTown', { name: item.name })
} else {
item.code == 510521 ? userInfoStore.changeUserInfoFn(510521, '', item.name) : userInfoStore.changeUserInfoFn(510521, Number(item.code), item.name)
}
else {
userInfoStore.changeUserInfoFn(510524, Number(item.code))
userInfoStore.changeAddress("",item.name)
}
console.log(userInfoStore.userInfo)
props.choseArea = false
emit('offAreaList', item)
// router.replace('/townDetail?id=' + id)
}
axios.get(`https://crmeb-test.shop.lihaink.cn/api/city/get_street?area_code=${userInfoStore.userInfo.areaCode}`)
.then(function (response) {
userInfoStore.changeareaCodeList(response.data.data)
response.data.data.forEach(item => {
areaList.push(item)
})
})
.catch(function (error) {
//
})
.finally(function () {
//
});
</script>
<style lang="scss" scoped>
.address {
left: 1vw;
top: 18px;
position: absolute;
width: 8vw;
height: 18vh;
background-color: #092049;
@ -70,12 +58,10 @@ axios.get(`https://crmeb-test.shop.lihaink.cn/api/city/get_street?area_code=${us
z-index: 9999;
overflow-y: auto;
box-sizing: border-box;
padding: 5px;
.address-li {
padding: 2px 5px;
padding: 5px 5px;
cursor: pointer;
border-bottom: 0.1px solid #24A4F8;
}
}

View File

@ -24,9 +24,6 @@
height: 44vh;
width: 33.6vw;
position: absolute;
// transform: rotateX(45deg);
// animation: spin 2s linear infinite;
}
#chart2 {
@ -39,19 +36,27 @@
import { ref, onMounted, watch, defineEmits, nextTick } from "vue"
import * as echarts from 'echarts';
import geoJsonLuxian from "/static/jsonData/luxian_geo.js"
import geoJsonGulin from "/static/jsonData/gulin_geo.js"
import geoJsonHejiang from "/static/jsonData/hejiang_geo.js"
import geoJsonJiangyang from "/static/jsonData/jiangyang_geo.js"
import geoJsonLongmatan from "/static/jsonData/longmatan_geo.js"
import geoJsonNaxi from "/static/jsonData/naxi_geo.js"
import geoJsonXuyong from "/static/jsonData/xuyong_geo.js"
// import geoJsonGulin from "/static/jsonData/gulin_geo.js"
// import geoJsonHejiang from "/static/jsonData/hejiang_geo.js"
// import geoJsonJiangyang from "/static/jsonData/jiangyang_geo.js"
// import geoJsonLongmatan from "/static/jsonData/longmatan_geo.js"
// import geoJsonNaxi from "/static/jsonData/naxi_geo.js"
// import geoJsonXuyong from "/static/jsonData/xuyong_geo.js"
import { useRouter } from "vue-router"
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 })
}
const isMainScreen = JSON.parse(localStorage.getItem("TRADE_TYPE"))
let geoJson = geoJsonLuxian
const areaStore = areaObj()
const showArea = (ref(true))
if(areaStore.userInfo.streetCode)showArea.value=false;
const router = useRouter()
const icon = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231204\/202312041608529c9e21252.png"
const lx = "https:\/\/ceshi-worker-task.lihaink.cn\/uploads\/images\/20231205\/20231205092709cfe148712.png"
@ -71,9 +76,7 @@ const deepCopy = (obj) => {
return copy;
}
const emit = defineEmits(['getTowmName'])
const getTowmName = (e) => {
emit('getTowmName', e)
}
const pointerFn = () => {
let list = []
geoJson.center.forEach((item, index) => {
@ -109,14 +112,13 @@ const pointerFn2 = (lists) => {
})
return list
}
const initAreaMap = () => {
const initAreaMap =async () => {
showArea.value = true
await nextTick()
var mapName = 'lz';
const myChart = document.getElementById("chart2")
let option = {
geo: [
{
type: "map",
map: mapName,
@ -161,9 +163,6 @@ const initAreaMap = () => {
}],
}
// borderWidth: 0
}
},
@ -289,28 +288,31 @@ const initAreaMap = () => {
],
};
// document.getElementById("chart2").removeAttribute('_echarts_instance_');
echarts.registerMap(mapName, geoJson)
const bg = echarts.init(myChart)
bg.setOption(option);
bg.on('click', function (params) {
getTowmName(params.name)
if (isMainScreen) {
sendFn('choseTown', { name: params.name })
} else {
areaStore.areaCodeList.forEach(item => {
if (item.name == (params.name || params.value)) {
areaStore.changeUserInfoFn(510521, item.code)
areaStore.changeUserInfoFn(510521, item.code, item.name)
}
})
areaStore.changeAddress('', params.name || params.value)
initTownMap(params.name || params.value)
}
});
}
const initTownMap = async (name) => {
console.log("首位到访的")
showArea.value = false
await nextTick()
let center = []
let pointerList = []
let res = await landListApi({
@ -319,7 +321,6 @@ const initTownMap = async (name) => {
res.data.list.forEach(item => {
center.push([item.longitude, item.latitude])
pointerList.push({
value: [item.longitude, item.latitude],
@ -521,10 +522,7 @@ const initTownMap = async (name) => {
bg.on('click', function (params) {
let longInfo = params.data.coord
areaStore.areaCodeList.forEach(item => {
if (item.name == name) {
areaStore.changeUserInfoFn(510521, item.code)
@ -532,67 +530,31 @@ const initTownMap = async (name) => {
})
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}`)
router.replace(`/detail?landId=${item.id}&town=${name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${item.name}`)
}
})
});
}
watch(() => areaStore.userInfo, (value, oldValue) => {
value.name == '泸县' ? initAreaMap() : initTownMap(value.name)
console.log(showArea.value,"fdjfdoijf")
watch(() => areaStore.userInfo.areaCode, (value, oldValue) => {
if (value) {
switch (value) {
case "510503":
geoJson = geoJsonNaxi
break;
case "510502":
geoJson = geoJsonJiangyang
break;
case "510504":
geoJson = geoJsonLongmatan
break;
case "510521":
geoJson = geoJsonLuxian
break;
case "510522":
geoJson = geoJsonHejiang
break;
case "510524":
geoJson = geoJsonXuyong
break;
case "510525":
geoJson = geoJsonGulin
break;
}
initAreaMap()
}
// else if (value.area) {
// showArea.value = false
// initTownMap(value.area)
// }
}, {
deep: true,
}
)
/* 夏弥睡眼惺忪地抬起头来,脸上还有手表压出的印子,“居然睡着了……都快给高数折磨疯了。我说卡塞尔学院的高数课真是有够变态。”她是一边跟楚子航聊天一边啃课本的时候睡着的,这些天她常常在病房里混迹,好像这里是她的自习室。楚子航渐渐地也习惯了,如果他困了就会直接睡过去,当她不存在,有时候醒来夏弥还在,有时候夏弥走了。*/
onMounted(async () => {
setTimeout(() => { initAreaMap() }, 500)
await nextTick()
setTimeout(() => {showArea.value? initAreaMap(): initTownMap() }, 500)
})
globalEventBus.on('choserArea', data => {
areaStore.changeUserInfoFn(data.code, '', data.name)
})
globalEventBus.on('choseTown', data => {
getTowmName(data.name)
areaStore.areaCodeList.forEach(item => {
if (item.name == (data.name)) {
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, item.code, data.name)
@ -600,18 +562,14 @@ globalEventBus.on('choseTown', data => {
})
areaStore.changeAddress('', data.name)
initTownMap(data.name)
})
globalEventBus.on('choseLand', data => {
router.push(`/detail?landId=${data.id}&town=${areaStore.userInfo.name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${data.landName}`)
})
// globalEventBus.on('choseLand', data => {
// router.push(`/detail?landId=${data.id}&town=${areaStore.userInfo.name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${data.landName}`)
// })
globalEventBus.on('initAreaMap', data => {
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, '', '')
console.log("chufa")
initAreaMap()
})
// globalEventBus.on('initAreaMap', data => {
// areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, '', '')
// initAreaMap()
// })
</script>

View File

@ -1,7 +1,7 @@
<template>
<div style="display: flex;justify-content: space-between;" v-if="userInfoStore.userInfo.streetCode">
<div class="c-top-tits" style="z-index: 99999;"><span class="color-font" @click="back">返回首页</span></div>
<div class="c-top-tits" style="z-index: 99999;"><span class="color-font">{{ props.townName }}地块</span> </div>
<div class="c-top-tits" style="z-index: 99999;"><span class="color-font">{{ userInfoStore.userInfo.name }}地块</span> </div>
</div>
<div class="c-top-tit" v-else>
<div class="c-top-li">种植面积 <span class="color-font" style="font-size: 18px;margin-left: 1vw; ">{{
@ -17,15 +17,11 @@ import {ref,reactive,defineProps} from "vue"
import { centralCountApi } from "@/api.js"
import { areaObj } from "@/store/index.js"
import { globalEventBus } from '@/common/eventBus'
import { useRouter, useRoute } from 'vue-router'
const router =useRouter()
const userInfoStore = areaObj()
const props = defineProps({
townName: String,
})
centralCountApi({
...userInfoStore.userInfo
}).then(res => {
@ -41,9 +37,7 @@ const centerData = reactive({
})
const back=(name)=>{
userInfoStore.changeUserInfoFn(userInfoStore.userInfo.areaCode, '', name)
globalEventBus.emit('initAreaMap')
router.go(0)
}
globalEventBus.on('back', data => {
back()

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
{
@ -6,7 +6,6 @@ const routes = [
name: 'index',
component: () => import('@/view/index.vue'),
redirect: "/home",
children: [
{
path: '/home',
@ -25,7 +24,7 @@ const routes = [
]
const router = createRouter({
history: createWebHistory(),
history: createWebHashHistory(),
routes
})

View File

@ -8,14 +8,7 @@
<leftCenter :data="data" :key="data.land_id"></leftCenter>
</div>
<div class="top center">
<JessibucaDemo v-if="video_url&&showVideo" :src="video_url"></JessibucaDemo>
<!-- <video style="margin-top: 1vh;width: 100%;height: 100%;" autoplay muted
src="http://192.168.1.27/live/test.live.mp4?secret=gqig2yFKkDpIMic1uWZY1L5MsIo0eflm">
</video> -->
<!-- <JessibucaDemo v-if="video_url&&showVideo" :src="video_url"></JessibucaDemo> -->
</div>
</div>
<div class="center">
@ -85,7 +78,7 @@ const pullStream = () => {
socket.addEventListener('close', onSocketClose);
socket.addEventListener('error', onSocketError);
}
pullStream()
// pullStream()
const getDetail = () => {
@ -111,7 +104,7 @@ const getDetail = () => {
})
}
getDetail()
// getDetail()
onBeforeUnmount(() => {
socket.close()
})
@ -131,6 +124,19 @@ globalEventBus.on('backHome', data => {
back()
})
globalEventBus.on('choserArea', data => {
router.go(-1)
areaStore.changeUserInfoFn(data.code, '', data.name)
})
globalEventBus.on('choseTown', data => {
router.go(-1)
areaStore.areaCodeList.forEach(item => {
if (item.name == (data.name)) {
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, item.code, data.name)
}
})
})
</script>
<style lang="scss">
.box {

View File

@ -14,7 +14,6 @@
<div class="c">
<div class="top">
<centerTop :townName="townName" :key="userInfoStore.userInfo.name"></centerTop>
<div class="map">
<areaMap @getTowmName="getTowmName"></areaMap>
</div>
@ -43,7 +42,6 @@ import leftBottom from "../components/index/leftBottom.vue"
import centerBottom from "../components/index/centerBottom.vue"
import rightBottom from "../components/index/rightBottom.vue"
import centerTop from "../components/index/centerTop.vue"
import { centralCountApi } from "@/api.js"
import areaMap from "@/components/areaMap.vue"
import rightTop from "../components/index/rightTop.vue"
import { areaObj } from "@/store/index.js"

View File

@ -1,21 +1,20 @@
<template>
<div class="main-box">
<Header></Header>
<router-view></router-view>
</div>
</template>
<script setup>
import { useRoute } from "vue-router"
const route = useRoute()
import Header from "@/components/Header.vue"
if (route.query?.type) { localStorage.setItem("TRADE_TYPE", true) }
else {
localStorage.setItem("TRADE_TYPE", false)
}
</script>
<style lang="scss">

View File

@ -6,7 +6,7 @@ export default defineConfig({
plugins: [vue()],
server: { // ← ← ← ← ← ←
host: '0.0.0.0', // ← 新增内容 ←
port:"8888"
port:"8886"
},
resolve: {
//别名配置引用src路径下的东西可以通过@如import Layout from '@/layout/index.vue'