add
This commit is contained in:
parent
138bec70e2
commit
f8d436a1a0
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<Transition>
|
<Transition>
|
||||||
<div class="address">
|
<div class="address" v-if="isMainScreen">
|
||||||
<div class="address-li" @click="choseTownFn({ name: '泸县', code: 510521, isArea: true })"> 泸县</div>
|
<div class="address-li" @click="choseTownFn({ name: '泸县', code: 510521, isArea: true })"> 泸县</div>
|
||||||
<div class="address-li" @click="choseTownFn(item)" v-for="( item, index ) in areaList ">{{ item.name }}</div>
|
<div class="address-li" @click="choseTownFn(item)" v-for="( item, index ) in areaList ">{{ item.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,6 +13,9 @@ import { reactive } from "vue"
|
||||||
import axios from "axios"
|
import axios from "axios"
|
||||||
import { areaObj } from "@/store/index.js"
|
import { areaObj } from "@/store/index.js"
|
||||||
import { sendMsg } from "@/api.js"
|
import { sendMsg } from "@/api.js"
|
||||||
|
import { useRouter } from "vue-router"
|
||||||
|
const router=useRouter()
|
||||||
|
|
||||||
const sendFn = (event, data = '') => {
|
const sendFn = (event, data = '') => {
|
||||||
sendMsg({ channel: 'user-11', event, data })
|
sendMsg({ channel: 'user-11', event, data })
|
||||||
}
|
}
|
||||||
|
@ -32,6 +35,7 @@ const choseTownFn = (item) => {
|
||||||
item.code == 510521? sendFn('choserArea', { name: item.name, code: item.code }): sendFn('choseTown', { name: item.name })
|
item.code == 510521? sendFn('choserArea', { name: item.name, code: item.code }): sendFn('choseTown', { name: item.name })
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
router.push('/')
|
||||||
item.code == 510521 ? userInfoStore.changeUserInfoFn(510521, '', item.name) : userInfoStore.changeUserInfoFn(510521, Number(item.code), item.name)
|
item.code == 510521 ? userInfoStore.changeUserInfoFn(510521, '', item.name) : userInfoStore.changeUserInfoFn(510521, Number(item.code), item.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,8 +309,6 @@ const initAreaMap =async () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
const initTownMap = async (name) => {
|
const initTownMap = async (name) => {
|
||||||
|
|
||||||
console.log("首位到访的")
|
|
||||||
showArea.value = false
|
showArea.value = false
|
||||||
await nextTick()
|
await nextTick()
|
||||||
let center = []
|
let center = []
|
||||||
|
@ -530,7 +528,7 @@ const initTownMap = async (name) => {
|
||||||
})
|
})
|
||||||
params.data.data.forEach(item => {
|
params.data.data.forEach(item => {
|
||||||
if (item.value[0] == longInfo[0] && item.value[1] == longInfo[1]) {
|
if (item.value[0] == longInfo[0] && item.value[1] == longInfo[1]) {
|
||||||
router.replace(`/detail?landId=${item.id}&town=${name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${item.name}`)
|
router.push(`/detail?landId=${item.id}&town=${name}&parmas=${JSON.stringify(areaStore.userInfo)}&landName=${item.name}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -539,15 +537,13 @@ const initTownMap = async (name) => {
|
||||||
|
|
||||||
watch(() => areaStore.userInfo, (value, oldValue) => {
|
watch(() => areaStore.userInfo, (value, oldValue) => {
|
||||||
value.name == '泸县' ? initAreaMap() : initTownMap(value.name)
|
value.name == '泸县' ? initAreaMap() : initTownMap(value.name)
|
||||||
console.log(showArea.value,"fdjfdoijf")
|
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
)
|
)
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await nextTick()
|
if(areaStore.userInfo.streetCode)return;
|
||||||
setTimeout(() => {showArea.value? initAreaMap(): initTownMap() }, 500)
|
setTimeout(() => {showArea.value? initAreaMap(): initTownMap() }, 500)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -125,11 +125,11 @@ globalEventBus.on('backHome', data => {
|
||||||
|
|
||||||
})
|
})
|
||||||
globalEventBus.on('choserArea', data => {
|
globalEventBus.on('choserArea', data => {
|
||||||
router.go(-1)
|
router.push("/")
|
||||||
areaStore.changeUserInfoFn(data.code, '', data.name)
|
areaStore.changeUserInfoFn(data.code, '', data.name)
|
||||||
})
|
})
|
||||||
globalEventBus.on('choseTown', data => {
|
globalEventBus.on('choseTown', data => {
|
||||||
router.go(-1)
|
router.push("/")
|
||||||
areaStore.areaCodeList.forEach(item => {
|
areaStore.areaCodeList.forEach(item => {
|
||||||
if (item.name == (data.name)) {
|
if (item.name == (data.name)) {
|
||||||
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, item.code, data.name)
|
areaStore.changeUserInfoFn(areaStore.userInfo.areaCode, item.code, data.name)
|
||||||
|
|
Loading…
Reference in New Issue