更新远程控制

This commit is contained in:
weipengfei 2024-02-22 18:14:59 +08:00
parent ea2fa75c4d
commit 4428b1af3a
3 changed files with 37 additions and 6 deletions

View File

@ -50,12 +50,12 @@ const user_channel = connection.subscribe('user-breed-datav');
// user-2message // user-2message
user_channel.on('message', function (data) { user_channel.on('message', function (data) {
console.log("收到消息--",data);
if(route.query.type=='main'&&data.content.event=='changMap') return; if(route.query.type=='main'&&data.content.event=='changMap') return;
if(data.content.event=='refresh') refresh(); if(data.content.event=='refresh') refresh();
if(data.content.event=='back') back(); if(data.content.event=='back') back();
else mitt.emit(data.content.event, data.content.data); else mitt.emit(data.content.event, data.content.data);
console.log("收到消息--",data);
}); });
// 线 // 线

View File

@ -160,6 +160,38 @@ const changeTime = (e) => {
console.log(e); console.log(e);
} }
mitt.on("choserArea", (data) => {
appStore.setAddress({
areaCode: data.code,
streetCode: "",
});
initList();
router.push({
path: '/',
query: {
areaCode: data.code,
}
})
});
mitt.on("choseTown", (data) => {
let c = list.value.find(item=>item.name==data.name);
if(!c)return;
appStore.setAddress({
areaCode: appStore.address.areaCode,
streetCode: c.code,
});
initList();
router.push({
path: '/indexc',
query: {
areaCode: appStore.address.areaCode,
streetCode: c.code,
name: data.name
}
})
});
onMounted(() => { onMounted(() => {
if (route.query.areaCode) { if (route.query.areaCode) {
appStore.setAddress({ appStore.setAddress({
@ -189,7 +221,6 @@ onMounted(() => {
initWeather(); initWeather();
mitt.on('changMap', (e)=>{ mitt.on('changMap', (e)=>{
if(e.areaName==info.areaName){ if(e.areaName==info.areaName){
let c = list.value.find(item=>item.name==e.name); let c = list.value.find(item=>item.name==e.name);

View File

@ -13,15 +13,15 @@ const key = ref(Date.now());
<template> <template>
<div class="center"> <div class="center">
<div class="item"> <div class="item">
<leftItme :key="route.query.name+key+'f'" style="height: 98%"></leftItme> <leftItme :key="route.query.areaCode+key+'f'" style="height: 98%"></leftItme>
</div> </div>
<div class="item item_c"> <div class="item item_c">
<div style="height: 61%; display: flex; justify-content: space-between"> <div style="height: 61%; display: flex; justify-content: space-between">
<centerItme :key="route.query.name+key+'c'" style="width: 64%"></centerItme> <centerItme :key="route.query.areaCode+key+'c'" style="width: 64%"></centerItme>
<rightItme :key="route.query.name+key+'r'" style="width: 35%"></rightItme> <rightItme :key="route.query.areaCode+key+'r'" style="width: 35%"></rightItme>
</div> </div>
<div style="height: 36%"> <div style="height: 36%">
<bottomItme :key="route.query.name+key+'b'" style="width: 100%"></bottomItme> <bottomItme :key="route.query.areaCode+key+'b'" style="width: 100%"></bottomItme>
</div> </div>
</div> </div>
</div> </div>