diff --git a/src/components/areaList.vue b/src/components/areaList.vue
index ca3df76..05e0e0c 100644
--- a/src/components/areaList.vue
+++ b/src/components/areaList.vue
@@ -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: ''
diff --git a/src/components/headView.vue b/src/components/headView.vue
index 5c89f4e..c636c20 100644
--- a/src/components/headView.vue
+++ b/src/components/headView.vue
@@ -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) {
diff --git a/src/view/delivery/index.vue b/src/view/delivery/index.vue
index 8672253..1a3f6de 100644
--- a/src/view/delivery/index.vue
+++ b/src/view/delivery/index.vue
@@ -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());
diff --git a/src/view/index/components/centerMap.vue b/src/view/index/components/centerMap.vue
index a05d9ad..fd6d6b5 100644
--- a/src/view/index/components/centerMap.vue
+++ b/src/view/index/components/centerMap.vue
@@ -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
);
diff --git a/src/view/index/components/rightItem1.vue b/src/view/index/components/rightItem1.vue
index 8736394..3c3d8ea 100644
--- a/src/view/index/components/rightItem1.vue
+++ b/src/view/index/components/rightItem1.vue
@@ -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()
diff --git a/src/view/index/index.vue b/src/view/index/index.vue
index cc18ae8..355af5c 100644
--- a/src/view/index/index.vue
+++ b/src/view/index/index.vue
@@ -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 })