This commit is contained in:
weipengfei 2024-02-24 14:12:01 +08:00
parent 29f84b9255
commit f632755e84
6 changed files with 51 additions and 19 deletions

View File

@ -51,10 +51,7 @@ const appStore = useAppStore();
// //
const choseTownFn = (item) => { const choseTownFn = (item) => {
if (item.code.length == 6) { if (item.code.length == 6) {
let name = 'luxian'; appStore.setMapInfo('luxian');
if(item.code=='510502')name = 'jiangyang';
if(item.code=='510521')name = 'xuyong';
appStore.setMapInfo(name);
appStore.setAddress({ appStore.setAddress({
areaCode: item.code, areaCode: item.code,
streetCode: '' streetCode: ''

View File

@ -45,9 +45,23 @@ const offAreaList = (e) => {
}); });
}; };
mitt.on("choserArea", (data) => {
appStore.setAddress({
areaCode: data.code,
streetCode: "",
});
initList(true);
router.push({
path: '/',
query: {
areaCode: data.code
}
})
});
mitt.on("choseTown", (data) => { mitt.on("choseTown", (data) => {
let c = list.value.find((item) => item.name == data.name); let c = list.value.find((item) => item.name == data.name);
console.log(list.value, data, c);
if (!c) return; if (!c) return;
appStore.setAddress({ appStore.setAddress({
areaCode: appStore.address.areaCode, areaCode: appStore.address.areaCode,
@ -96,7 +110,7 @@ const initList = async (re = false) => {
streetCode: appStore.address.streetCode, streetCode: appStore.address.streetCode,
}); });
} }
mitt.emit("map_info", info); if(!re) mitt.emit("map_info", info);
}; };
const initList2 = async () => { const initList2 = async () => {
getArea({ getArea({
@ -169,13 +183,6 @@ const initWeather = (city = 510500) => {
}); });
}; };
mitt.on("choserArea", (data) => {
appStore.setAddress({
areaCode: data.code,
streetCode: "",
});
initList(true);
});
onMounted(() => { onMounted(() => {
if (route.query.areaCode) { if (route.query.areaCode) {

View File

@ -3,19 +3,24 @@ import leftItem from "./components/left.vue";
import centerItem from "./components/center.vue"; import centerItem from "./components/center.vue";
import bottomItem from "./components/bottom.vue"; import bottomItem from "./components/bottom.vue";
import rightItem from "./components/right.vue"; import rightItem from "./components/right.vue";
import { useRoute } from 'vue-router';
import { ref } from "vue";
const route = useRoute();
const key = ref(Date.now());
</script> </script>
<template> <template>
<div class="center"> <div class="center">
<div class="item"> <div class="item">
<leftItem style="height: 98%"></leftItem> <leftItem :key="route.query.areaCode+key+'f'" style="height: 98%"></leftItem>
</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">
<centerItem style="width: 64%"></centerItem> <centerItem :key="route.query.areaCode+key+'c'" style="width: 64%"></centerItem>
<rightItem style="width: 35%"></rightItem> <rightItem :key="route.query.areaCode+key+'r'" style="width: 35%"></rightItem>
</div> </div>
<bottomItem style="height: 36%"></bottomItem> <bottomItem :key="route.query.areaCode+key+'b'" style="height: 36%"></bottomItem>
</div> </div>
</div> </div>
</template> </template>

View File

@ -16,6 +16,7 @@ import longma_geo from "@/utils/longma_geo.js";
import gulin_geo from "@/utils/gulin_geo.js"; import gulin_geo from "@/utils/gulin_geo.js";
import hejiang_geo from "@/utils/hejiang_geo.js"; import hejiang_geo from "@/utils/hejiang_geo.js";
import naxi_geo from "@/utils/naxi_geo.js"; import naxi_geo from "@/utils/naxi_geo.js";
import { getStreet, getArea } from "@/api/index.js";
import { useAppStore } from "@/store/app.js"; import { useAppStore } from "@/store/app.js";
import { useUserStore } from "@/store/user.js"; import { useUserStore } from "@/store/user.js";
@ -478,7 +479,7 @@ const initMap = () => {
chart.setOption(option); chart.setOption(option);
}; };
const mapInfo = () => { const mapInfo = async () => {
let area = appStore.area.find( let area = appStore.area.find(
(item) => item.code == appStore.address.areaCode (item) => item.code == appStore.address.areaCode
); );
@ -492,6 +493,12 @@ const mapInfo = () => {
if (area.name == "古蔺县") map = gulin_geo; if (area.name == "古蔺县") map = gulin_geo;
map = JSON.parse(JSON.stringify(map)); map = JSON.parse(JSON.stringify(map));
if (appStore.address.streetCode) { if (appStore.address.streetCode) {
if(appStore.street.length==0) {
let { data } = await getStreet({
area_code: appStore.address.areaCode,
});
appStore.setStreet(data);
}
let street = appStore.street.find( let street = appStore.street.find(
(item) => item.code == appStore.address.streetCode (item) => item.code == appStore.address.streetCode
); );

View File

@ -2,6 +2,7 @@
import border from "@/components/border.vue" import border from "@/components/border.vue"
import { vehicleList } from "@/api/index.js"; import { vehicleList } from "@/api/index.js";
import { onMounted, ref } from "vue"; import { onMounted, ref } from "vue";
import mitt from "@/utils/mitt";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { useAppStore } from "@/store/app.js" import { useAppStore } from "@/store/app.js"
@ -38,6 +39,15 @@ const navToDelivery = (item) => {
}); });
} }
mitt.on('c_car_index', (e)=>{
router.push({
path: '/delivery',
query: {
id: e.id
}
});
})
onMounted(() => { onMounted(() => {
loadList() loadList()

View File

@ -6,10 +6,16 @@ import centerItme2 from "./components/centerItem2.vue";
import rightItem1 from "./components/rightItem1.vue"; import rightItem1 from "./components/rightItem1.vue";
import rightItem2 from "./components/rightItem2.vue"; import rightItem2 from "./components/rightItem2.vue";
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { ref } from "vue"; import { ref, watch } from "vue";
const route = useRoute(); const route = useRoute();
const key = ref(Date.now()); const key = ref(Date.now());
watch(()=> route.query, (n, o)=>{
if(n.streetCode != o.streetCode){
key.value = Date.now();
}
}, { deep: true })
</script> </script>
<template> <template>