This commit is contained in:
parent
29f84b9255
commit
f632755e84
|
@ -51,10 +51,7 @@ const appStore = useAppStore();
|
|||
// 选镇
|
||||
const choseTownFn = (item) => {
|
||||
if (item.code.length == 6) {
|
||||
let name = 'luxian';
|
||||
if(item.code=='510502')name = 'jiangyang';
|
||||
if(item.code=='510521')name = 'xuyong';
|
||||
appStore.setMapInfo(name);
|
||||
appStore.setMapInfo('luxian');
|
||||
appStore.setAddress({
|
||||
areaCode: item.code,
|
||||
streetCode: ''
|
||||
|
|
|
@ -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) => {
|
||||
let c = list.value.find((item) => item.name == data.name);
|
||||
console.log(list.value, data, c);
|
||||
if (!c) return;
|
||||
appStore.setAddress({
|
||||
areaCode: appStore.address.areaCode,
|
||||
|
@ -96,7 +110,7 @@ const initList = async (re = false) => {
|
|||
streetCode: appStore.address.streetCode,
|
||||
});
|
||||
}
|
||||
mitt.emit("map_info", info);
|
||||
if(!re) mitt.emit("map_info", info);
|
||||
};
|
||||
const initList2 = async () => {
|
||||
getArea({
|
||||
|
@ -169,13 +183,6 @@ const initWeather = (city = 510500) => {
|
|||
});
|
||||
};
|
||||
|
||||
mitt.on("choserArea", (data) => {
|
||||
appStore.setAddress({
|
||||
areaCode: data.code,
|
||||
streetCode: "",
|
||||
});
|
||||
initList(true);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
if (route.query.areaCode) {
|
||||
|
|
|
@ -3,19 +3,24 @@ import leftItem from "./components/left.vue";
|
|||
import centerItem from "./components/center.vue";
|
||||
import bottomItem from "./components/bottom.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>
|
||||
|
||||
<template>
|
||||
<div class="center">
|
||||
<div class="item">
|
||||
<leftItem style="height: 98%"></leftItem>
|
||||
<leftItem :key="route.query.areaCode+key+'f'" style="height: 98%"></leftItem>
|
||||
</div>
|
||||
<div class="item item_c">
|
||||
<div style="height: 61%; display: flex; justify-content: space-between">
|
||||
<centerItem style="width: 64%"></centerItem>
|
||||
<rightItem style="width: 35%"></rightItem>
|
||||
<centerItem :key="route.query.areaCode+key+'c'" style="width: 64%"></centerItem>
|
||||
<rightItem :key="route.query.areaCode+key+'r'" style="width: 35%"></rightItem>
|
||||
</div>
|
||||
<bottomItem style="height: 36%"></bottomItem>
|
||||
<bottomItem :key="route.query.areaCode+key+'b'" style="height: 36%"></bottomItem>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -16,6 +16,7 @@ import longma_geo from "@/utils/longma_geo.js";
|
|||
import gulin_geo from "@/utils/gulin_geo.js";
|
||||
import hejiang_geo from "@/utils/hejiang_geo.js";
|
||||
import naxi_geo from "@/utils/naxi_geo.js";
|
||||
import { getStreet, getArea } from "@/api/index.js";
|
||||
import { useAppStore } from "@/store/app.js";
|
||||
import { useUserStore } from "@/store/user.js";
|
||||
|
||||
|
@ -478,7 +479,7 @@ const initMap = () => {
|
|||
chart.setOption(option);
|
||||
};
|
||||
|
||||
const mapInfo = () => {
|
||||
const mapInfo = async () => {
|
||||
let area = appStore.area.find(
|
||||
(item) => item.code == appStore.address.areaCode
|
||||
);
|
||||
|
@ -492,6 +493,12 @@ const mapInfo = () => {
|
|||
if (area.name == "古蔺县") map = gulin_geo;
|
||||
map = JSON.parse(JSON.stringify(map));
|
||||
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(
|
||||
(item) => item.code == appStore.address.streetCode
|
||||
);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import border from "@/components/border.vue"
|
||||
import { vehicleList } from "@/api/index.js";
|
||||
import { onMounted, ref } from "vue";
|
||||
import mitt from "@/utils/mitt";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
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(() => {
|
||||
loadList()
|
||||
|
|
|
@ -6,10 +6,16 @@ import centerItme2 from "./components/centerItem2.vue";
|
|||
import rightItem1 from "./components/rightItem1.vue";
|
||||
import rightItem2 from "./components/rightItem2.vue";
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ref } from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
|
||||
const route = useRoute();
|
||||
const key = ref(Date.now());
|
||||
|
||||
watch(()=> route.query, (n, o)=>{
|
||||
if(n.streetCode != o.streetCode){
|
||||
key.value = Date.now();
|
||||
}
|
||||
}, { deep: true })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
Loading…
Reference in New Issue