7 changed files with 1380 additions and 22 deletions
After Width: | Height: | Size: 507 B |
File diff suppressed because it is too large
@ -0,0 +1,7 @@ |
|||||
|
.selfCity{ |
||||
|
background-color: #ffffff; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
.selectAgency{ |
||||
|
border-radius: 8px; |
||||
|
} |
@ -1,22 +1,61 @@ |
|||||
<template> |
<template> |
||||
<div class=''> |
<div> |
||||
<div>123456789</div> |
<div class="selfCity flex flex-center2 p-12 flex-end"> |
||||
|
<div class="flex flex-center2 flex-1"> |
||||
|
<img src="@/assets/images/icons/homeBlue.png" alt="" /> |
||||
|
<span style="color: #666666;" v-if="!selfCityName">请选择您所在城市</span> |
||||
|
<span v-else>{{ selfCityName}}</span> |
||||
|
</div> |
||||
|
<van-button v-show="false" type="info" size="small" round class="m-right10">手动选择</van-button> |
||||
|
</div> |
||||
|
<div class="container"> |
||||
|
<van-list finished-text="没有更多了" @load="getAgency" class="selectAgency"> |
||||
|
<van-cell v-for="(item, index) in cityJson" :title="item.agencyName" :key="index" is-link |
||||
|
@click="handelClickAgency(item)"></van-cell> |
||||
|
</van-list> |
||||
|
</div> |
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
|
import { editUser } from "@/api/user"; |
||||
|
import cityJson from "./1.json" |
||||
export default { |
export default { |
||||
data() { |
data() { |
||||
return {}; |
return { |
||||
|
cityJson: [cityJson], |
||||
|
selfCity: [], |
||||
|
selfCityName:null |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getAgency() |
||||
|
}, |
||||
|
methods: { |
||||
|
getAgency() { |
||||
|
// this.cityJson = [cityJson] |
||||
|
}, |
||||
|
async handelClickAgency(item) { |
||||
|
this.selfCity.push(item); |
||||
|
this.selfCityName = this.selfCity.map(item=>item.agencyName).join(',') |
||||
|
if (item.level === 'community') { |
||||
|
let parm = this.$store.state.app.userInfo; |
||||
|
parm.agencyId = item.agencyId; |
||||
|
let {code} = await editUser(parm) |
||||
|
if(code == 0){ |
||||
|
this.$router.replace('/') |
||||
|
} |
||||
|
} else { |
||||
|
this.cityJson = item.children |
||||
|
} |
||||
|
} |
||||
}, |
}, |
||||
created() {}, |
|
||||
methods: {}, |
|
||||
components: {}, |
components: {}, |
||||
computed: {}, |
computed: {}, |
||||
watch: {}, |
watch: {}, |
||||
} |
} |
||||
</script> |
</script> |
||||
|
|
||||
<style lang='less'> |
<style lang='less' scoped> |
||||
|
@import './index'; |
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue