Commit e68a29bc authored by lizhan's avatar lizhan

📝 【TASK-20240812-01】TASK:登录跳转判断

parent e6bdbe88
......@@ -3,7 +3,12 @@
<view class="header-toper">
<!-- <view class="start-bar"></view> -->
<view class="header-toper-title">
<image src="../../static/img/back.png" mode="" @click="$request.backGo"></image>
<image
v-if="leftIcon"
src="../../static/img/back.png"
mode=""
@click="$request.backGo"
></image>
<text>{{ title }}</text>
<image
v-if="rightBtn"
......@@ -22,6 +27,10 @@ export default {
rightBtn: {
type: Boolean,
default: false
},
leftIcon: {
type: Boolean,
default: true
}
},
data() {
......
This diff is collapsed.
<template>
<view>
<dHeader :title="$lang.lang.myInfo.info"></dHeader>
<dHeader :left-icon="!first" :title="first ? '个人信息填写' : $lang.lang.myInfo.info"></dHeader>
<view class="start-bar"></view>
<view class="consultAdd">
<view class="consult-item">
......@@ -89,7 +89,7 @@
@change="bindCountyChange"
>
<view :class="{ placeholder: !params.country }">{{
params.country ? params.country : $lang.lang.notices.country
params.countryValue ? params.countryValue : $lang.lang.notices.country
}}</view>
</picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
......@@ -107,7 +107,7 @@
@change="bindCityChange"
>
<view :class="{ placeholder: !params.city }">{{
params.city ? params.city : $lang.lang.notices.city
params.cityValue ? params.cityValue : $lang.lang.notices.city
}}</view>
</picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image>
......@@ -143,7 +143,7 @@
</view>
</view>
<view class="consult-btn">
<view class="" @click="submitForm">{{ $lang.lang.myInfo.edit }}</view>
<view class="" @click="submitForm">{{ first ? '完成' : $lang.lang.myInfo.edit }}</view>
</view>
</view>
</template>
......@@ -175,10 +175,16 @@ export default {
countryArray: [],
countryId: 0,
// 城市列表
cityArray: []
cityArray: [],
// 是否为首次进入 没有国家城市信息
first: false
}
},
onLoad() {
onLoad(route) {
const { type } = route
if (type == 'first') {
this.first = true
}
this.getUserInfo()
},
computed: {
......@@ -196,6 +202,16 @@ export default {
submitForm() {
this.$request.put('/app-api/member/user/update', this.params).then((res) => {
if (res.code == 0) {
if (this.first) {
uni.showToast({
title: '成功',
icon: 'none'
})
uni.reLaunch({
url: '/pages/index/index'
})
return
}
uni.showToast({
title: this.$lang.lang.notices.edited,
icon: 'none'
......@@ -218,9 +234,17 @@ export default {
if (res.data.birthday) {
this.date = res.data.birthday
}
const { city, country, countryTitleZh, countryTitleEn, cityTitleZh, cityTitleEn } =
res.data
this.params.city = city
this.params.country = country
this.params.cityValue = this.rangeKey == 'zh' ? cityTitleZh : cityTitleEn
this.params.countryValue = this.rangeKey == 'zh' ? countryTitleZh : countryTitleEn
this.getCountryList()
this.getCityList()
this.Country()
if (country) this.getCityList(country)
}
this.Country()
this.getCountryList()
})
},
// 获取国家区号
......@@ -274,7 +298,6 @@ export default {
// 获取国家列表
getCountryList() {
this.$request.get('/admin-api/ecw/region/getTradeCountryList').then((res) => {
console.log(res)
if (res.code == 0) {
this.countryArray = res.data
}
......@@ -285,13 +308,17 @@ export default {
const index = e.detail.value
const { titleZh, titleEn, id } = this.countryArray[index]
const value = this.rangeKey == 'zh' ? titleZh : titleEn
this.$set(this.params, 'country', value)
this.getCityList(id)
if (this.params.country != id) {
this.$set(this.params, 'cityValue', '')
this.$set(this.params, 'city', '')
this.getCityList(id)
}
this.$set(this.params, 'countryValue', value)
this.$set(this.params, 'country', id)
},
// 获取城市列表
getCityList(id) {
this.$request.get('/admin-api/ecw/region/getCityListByParent', { id }).then((res) => {
console.log(res)
if (res.code == 0) {
this.cityArray = res.data
}
......@@ -300,9 +327,10 @@ export default {
// 城市选择 change
bindCityChange(e) {
const index = e.detail.value
const { titleZh, titleEn } = this.cityArray[index]
const { titleZh, titleEn, id } = this.cityArray[index]
const value = this.rangeKey == 'zh' ? titleZh : titleEn
this.$set(this.params, 'city', value)
this.$set(this.params, 'cityValue', value)
this.$set(this.params, 'city', id)
}
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment