Commit e68a29bc authored by lizhan's avatar lizhan

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

parent e6bdbe88
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
<view class="header-toper"> <view class="header-toper">
<!-- <view class="start-bar"></view> --> <!-- <view class="start-bar"></view> -->
<view class="header-toper-title"> <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> <text>{{ title }}</text>
<image <image
v-if="rightBtn" v-if="rightBtn"
...@@ -22,6 +27,10 @@ export default { ...@@ -22,6 +27,10 @@ export default {
rightBtn: { rightBtn: {
type: Boolean, type: Boolean,
default: false default: false
},
leftIcon: {
type: Boolean,
default: true
} }
}, },
data() { data() {
......
This diff is collapsed.
<template> <template>
<view> <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="start-bar"></view>
<view class="consultAdd"> <view class="consultAdd">
<view class="consult-item"> <view class="consult-item">
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
@change="bindCountyChange" @change="bindCountyChange"
> >
<view :class="{ placeholder: !params.country }">{{ <view :class="{ placeholder: !params.country }">{{
params.country ? params.country : $lang.lang.notices.country params.countryValue ? params.countryValue : $lang.lang.notices.country
}}</view> }}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
@change="bindCityChange" @change="bindCityChange"
> >
<view :class="{ placeholder: !params.city }">{{ <view :class="{ placeholder: !params.city }">{{
params.city ? params.city : $lang.lang.notices.city params.cityValue ? params.cityValue : $lang.lang.notices.city
}}</view> }}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
</view> </view>
</view> </view>
<view class="consult-btn"> <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>
</view> </view>
</template> </template>
...@@ -175,10 +175,16 @@ export default { ...@@ -175,10 +175,16 @@ export default {
countryArray: [], countryArray: [],
countryId: 0, countryId: 0,
// 城市列表 // 城市列表
cityArray: [] cityArray: [],
// 是否为首次进入 没有国家城市信息
first: false
} }
}, },
onLoad() { onLoad(route) {
const { type } = route
if (type == 'first') {
this.first = true
}
this.getUserInfo() this.getUserInfo()
}, },
computed: { computed: {
...@@ -196,6 +202,16 @@ export default { ...@@ -196,6 +202,16 @@ export default {
submitForm() { submitForm() {
this.$request.put('/app-api/member/user/update', this.params).then((res) => { this.$request.put('/app-api/member/user/update', this.params).then((res) => {
if (res.code == 0) { if (res.code == 0) {
if (this.first) {
uni.showToast({
title: '成功',
icon: 'none'
})
uni.reLaunch({
url: '/pages/index/index'
})
return
}
uni.showToast({ uni.showToast({
title: this.$lang.lang.notices.edited, title: this.$lang.lang.notices.edited,
icon: 'none' icon: 'none'
...@@ -218,9 +234,17 @@ export default { ...@@ -218,9 +234,17 @@ export default {
if (res.data.birthday) { if (res.data.birthday) {
this.date = 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 { ...@@ -274,7 +298,6 @@ export default {
// 获取国家列表 // 获取国家列表
getCountryList() { getCountryList() {
this.$request.get('/admin-api/ecw/region/getTradeCountryList').then((res) => { this.$request.get('/admin-api/ecw/region/getTradeCountryList').then((res) => {
console.log(res)
if (res.code == 0) { if (res.code == 0) {
this.countryArray = res.data this.countryArray = res.data
} }
...@@ -285,13 +308,17 @@ export default { ...@@ -285,13 +308,17 @@ export default {
const index = e.detail.value const index = e.detail.value
const { titleZh, titleEn, id } = this.countryArray[index] const { titleZh, titleEn, id } = this.countryArray[index]
const value = this.rangeKey == 'zh' ? titleZh : titleEn const value = this.rangeKey == 'zh' ? titleZh : titleEn
this.$set(this.params, 'country', value) if (this.params.country != id) {
this.getCityList(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) { getCityList(id) {
this.$request.get('/admin-api/ecw/region/getCityListByParent', { id }).then((res) => { this.$request.get('/admin-api/ecw/region/getCityListByParent', { id }).then((res) => {
console.log(res)
if (res.code == 0) { if (res.code == 0) {
this.cityArray = res.data this.cityArray = res.data
} }
...@@ -300,9 +327,10 @@ export default { ...@@ -300,9 +327,10 @@ export default {
// 城市选择 change // 城市选择 change
bindCityChange(e) { bindCityChange(e) {
const index = e.detail.value 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 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