289 lines
7.9 KiB
Vue
289 lines
7.9 KiB
Vue
<template>
|
|
<div class="box">
|
|
<div class="l">
|
|
<div class="top">
|
|
<leftTop :data="data" :key="data.land_id"></leftTop>
|
|
</div>
|
|
<div class="bottom top">
|
|
<leftCenter :data="data" :key="data.land_id"></leftCenter>
|
|
</div>
|
|
<div class="top center">
|
|
<JessibucaDemo v-if="video_url&&showVideo" :src="video_url"></JessibucaDemo>
|
|
</div>
|
|
</div>
|
|
<div class="center">
|
|
<div class="top-c">
|
|
<div style="display: flex;justify-content: space-between;">
|
|
<div class=" c-top-tits"><span class="color-font" @click="back">返回首页</span></div>
|
|
<div class=" c-top-tits"><span class="color-font">{{ landName }}</span> </div>
|
|
</div>
|
|
<farmerMap @changeLand="changeLandFn"></farmerMap>
|
|
</div>
|
|
<div class="bottom">
|
|
<centerBottom :data="data" :key="data.land_id"></centerBottom>
|
|
</div>
|
|
</div>
|
|
<div class="r">
|
|
<div class="center top">
|
|
<rightTop :data="data" :key="data.land_id"></rightTop>
|
|
</div>
|
|
<div class="bottom">
|
|
<rightBottom :data="data" :key="data.land_id"></rightBottom>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, reactive, onMounted, onBeforeUnmount } from "vue"
|
|
import farmerMap from "../components/farmerMap.vue";
|
|
import leftTop from "../components/detail/leftTop.vue";
|
|
import leftCenter from "../components/detail/leftCenter.vue";
|
|
import centerBottom from "../components/detail/centerBottom.vue";
|
|
import rightTop from "../components/detail/rightTop.vue";
|
|
import rightBottom from "../components/detail/rightBottom.vue";
|
|
import { useRouter, useRoute } from "vue-router"
|
|
import { landListApi } from "@/api.js"
|
|
import { globalEventBus } from '@/common/eventBus'
|
|
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()
|
|
const route = useRoute()
|
|
let data = reactive(
|
|
{
|
|
land_id: route.query.landId,
|
|
areaCode: JSON.parse(route.query.parmas).areaCode,
|
|
streetCode: JSON.parse(route.query.parmas).streetCode
|
|
}
|
|
)
|
|
const landName = ref(route.query.landName)
|
|
|
|
let socket = new WebSocket('wss://iot.lihaink.cn/test')
|
|
const pullStream = () => {
|
|
const onSocketOpen = (event) => {
|
|
console.log("scoket打开")
|
|
}
|
|
const onSocketClose = (event) => {
|
|
console.log('WebSocket连接已关闭');
|
|
}
|
|
const onSocketError = (event) => {
|
|
console.error('WebSocket连接发生错误');
|
|
}
|
|
socket.addEventListener('open', onSocketOpen);
|
|
socket.addEventListener('close', onSocketClose);
|
|
socket.addEventListener('error', onSocketError);
|
|
}
|
|
pullStream()
|
|
|
|
|
|
const getDetail = () => {
|
|
showVideo.value = false
|
|
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
|
|
let data = {
|
|
username: item.master_phone,
|
|
device: 'lihai_lot_walnutpi_dev_' + item.device_id,
|
|
scene: 'screen'
|
|
}
|
|
socket.send(JSON.stringify(data))
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
getDetail()
|
|
onBeforeUnmount(() => {
|
|
socket.close()
|
|
})
|
|
const changeLandFn = (item) => {
|
|
data.land_id = item.id
|
|
landName.value = item.name
|
|
getDetail()
|
|
}
|
|
|
|
const back = () => {
|
|
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, '','')
|
|
router.replace("/home")
|
|
|
|
}
|
|
|
|
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 => {
|
|
back()
|
|
|
|
})
|
|
globalEventBus.on('choserArea', data => {
|
|
// console.log(data.code)
|
|
router.push("/home?areaCode="+data.code)
|
|
areaStore.changeUserInfoFn(data.code, '', data.name)
|
|
})
|
|
globalEventBus.on('choseTown', data => {
|
|
router.push("/")
|
|
areaStore.areaCodeList.forEach(item => {
|
|
if (item.name == (data.name)) {
|
|
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, item.code, data.name)
|
|
}
|
|
})
|
|
})
|
|
|
|
</script>
|
|
<style lang="scss">
|
|
.box {
|
|
width: 100vw;
|
|
height: 93vh;
|
|
margin-top: 1vh;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.l {
|
|
width: 25vw;
|
|
height: 93vh;
|
|
|
|
.top {
|
|
width: 25vw;
|
|
height: 30vh;
|
|
background-size: 100% 100%;
|
|
// background-color: pink;
|
|
background-image: url('/static/detail/zzmj.png');
|
|
margin-top: 1vh;
|
|
box-sizing: border-box;
|
|
padding: 6vh 2vh 1vh 2vh;
|
|
color: #E5EFFF;
|
|
}
|
|
|
|
|
|
|
|
.center {
|
|
background-image: url("/static/detail/MQJk.png");
|
|
}
|
|
|
|
.bottom {
|
|
position: relative;
|
|
background-image: url("/static/index/SBGJTJ.png");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
.center {
|
|
width: 49vw;
|
|
height: 93vh;
|
|
|
|
.top-c {
|
|
margin-top: 1vh;
|
|
width: 49vw;
|
|
height: 61vh;
|
|
// background-color: RED;
|
|
background-image: url('/static/index/ZBK.png');
|
|
background-size: 100% 100%;
|
|
box-sizing: border-box;
|
|
padding: 2vh 2vw;
|
|
|
|
.c-top-tits {
|
|
|
|
padding: 1vh 1vw;
|
|
font-size: 20px;
|
|
// border: 1px solid red;
|
|
cursor: pointer;
|
|
background-image: url('/static/detail/FHSY.png');
|
|
background-size: 100% 100%;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
.bottom {
|
|
width: 49vw;
|
|
height: 30vh;
|
|
margin-top: 1vh;
|
|
background-image: url('/static/detail/QXHJJC.png');
|
|
background-size: 100% 100%;
|
|
box-sizing: border-box;
|
|
padding: 6vh 1vh 1vh 2vh;
|
|
position: relative;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
.r {
|
|
width: 25vw;
|
|
height: 93vh;
|
|
|
|
.bottom {
|
|
width: 25vw;
|
|
box-sizing: border-box;
|
|
padding: 5vh 1vh 1.5vh;
|
|
height: 61vh;
|
|
background-size: 100% 100%;
|
|
background-image: url('/static/detail/TRSQ.png');
|
|
margin-top: 1vh;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
|
|
.r-b-li {
|
|
width: 95%;
|
|
height: 7.5vh;
|
|
background-image: url('/static/detail/SQBG.png');
|
|
background-size: 100% 100%;
|
|
color: white;
|
|
font-family: FZCYJ;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
box-sizing: border-box;
|
|
padding: 0 1.5VW;
|
|
font-size: 14PX;
|
|
}
|
|
|
|
.act {
|
|
color: #C55956;
|
|
}
|
|
}
|
|
|
|
.top {
|
|
width: 25vw;
|
|
height: 30vh;
|
|
padding: 2vh;
|
|
box-sizing: border-box;
|
|
background-size: 100% 100%;
|
|
background-image: url('/static/index/YJCP.png');
|
|
margin-top: 1vh;
|
|
padding-top: 6vh;
|
|
color: #E5EFFF;
|
|
}
|
|
|
|
.center {
|
|
background-image: url('/static/index/JCSBSLTJ.png');
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
</style> |