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 } =
this.Country() 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.getCountryList()
this.getCityList()
this.Country()
if (country) this.getCityList(country)
}
}) })
}, },
// 获取国家区号 // 获取国家区号
...@@ -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.$set(this.params, 'cityValue', '')
this.$set(this.params, 'city', '')
this.getCityList(id) 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)
} }
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</view> </view>
<view class="logo"> <view class="logo">
<image src="../../static/img/logo.png" mode=""></image> <image src="../../static/img/logo.png" mode=""></image>
<text>{{$lang.lang.login.title}}</text> <text>{{ $lang.lang.login.title }}</text>
</view> </view>
<view class="login-item"> <view class="login-item">
<view class="login-v"> <view class="login-v">
...@@ -15,11 +15,17 @@ ...@@ -15,11 +15,17 @@
<view class="login-vp login-phone"> <view class="login-vp login-phone">
<view class="login-area"> <view class="login-area">
<picker :value="areaIndex" :range="areaName" @change="areaChange"> <picker :value="areaIndex" :range="areaName" @change="areaChange">
<view class="uni-input">{{$request.checkAddIcon(areaData[areaIndex])}}</view> <view class="uni-input">{{ $request.checkAddIcon(areaData[areaIndex]) }}</view>
</picker> </picker>
<image src="../../static/img/more.png" mode=""></image> <image src="../../static/img/more.png" mode=""></image>
</view> </view>
<input class="vp-input" v-model="mobile" type="number" placeholder-style="color: #ffffff" :placeholder="$lang.lang.notices.phone"> <input
class="vp-input"
v-model="mobile"
type="number"
placeholder-style="color: #ffffff"
:placeholder="$lang.lang.notices.phone"
/>
</view> </view>
</view> </view>
<view class="login-v"> <view class="login-v">
...@@ -27,9 +33,15 @@ ...@@ -27,9 +33,15 @@
<image src="../../static/img/code.png" mode=""></image> <image src="../../static/img/code.png" mode=""></image>
</view> </view>
<view class="login-vp"> <view class="login-vp">
<input class="vp-input" v-model="code" type="number" placeholder-style="color: #ffffff" :placeholder="$lang.lang.notices.code"> <input
<view class="login-code" v-if="leftTime < 60">{{leftTime}}S</view> class="vp-input"
<view class="login-code" v-else @click="sendCode">{{$lang.lang.login.code}}</view> v-model="code"
type="number"
placeholder-style="color: #ffffff"
:placeholder="$lang.lang.notices.code"
/>
<view class="login-code" v-if="leftTime < 60">{{ leftTime }}S</view>
<view class="login-code" v-else @click="sendCode">{{ $lang.lang.login.code }}</view>
</view> </view>
</view> </view>
<view class="login-v"> <view class="login-v">
...@@ -37,7 +49,13 @@ ...@@ -37,7 +49,13 @@
<image src="../../static/img/pass.png" mode=""></image> <image src="../../static/img/pass.png" mode=""></image>
</view> </view>
<view class="login-vp"> <view class="login-vp">
<input class="vp-input" v-model="password" type="password" placeholder-style="color: #ffffff" :placeholder="$lang.lang.notices.numPsd"> <input
class="vp-input"
v-model="password"
type="password"
placeholder-style="color: #ffffff"
:placeholder="$lang.lang.notices.numPsd"
/>
</view> </view>
</view> </view>
<view class="login-v"> <view class="login-v">
...@@ -45,24 +63,36 @@ ...@@ -45,24 +63,36 @@
<image src="../../static/img/safe.png" mode=""></image> <image src="../../static/img/safe.png" mode=""></image>
</view> </view>
<view class="login-vp"> <view class="login-vp">
<input class="vp-input" v-model="passworded" type="password" placeholder-style="color: #ffffff" :placeholder="$lang.lang.notices.nextPsd"> <input
class="vp-input"
v-model="passworded"
type="password"
placeholder-style="color: #ffffff"
:placeholder="$lang.lang.notices.nextPsd"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="login-btns"> <view class="login-btns">
<view class="" @click="register">{{$lang.lang.login.register}}</view> <view class="" @click="register">{{ $lang.lang.login.register }}</view>
</view> </view>
<view class="agree" @click="agree = !agree"> <view class="agree" @click="agree = !agree">
<image :src="agree ? '../../static/img/check_true.png' : '../../static/img/check_false.png'" mode=""></image> <image
<view>{{$lang.lang.notices.read}}<text @click="showUser">{{$lang.lang.notices.service}}</text></view> :src="agree ? '../../static/img/check_true.png' : '../../static/img/check_false.png'"
mode=""
></image>
<view
>{{ $lang.lang.notices.read
}}<text @click="showUser">{{ $lang.lang.notices.service }}</text></view
>
</view> </view>
<user-agreement ref="userment" /> <user-agreement ref="userment" />
</view> </view>
</template> </template>
<script> <script>
import userAgreement from '../../components/userAgreement/index.vue' import userAgreement from '../../components/userAgreement/index.vue'
export default { export default {
components: { components: {
userAgreement userAgreement
}, },
...@@ -76,66 +106,73 @@ ...@@ -76,66 +106,73 @@
agree: false, agree: false,
areaData: [], areaData: [],
areaName: [], areaName: [],
leftTime: 60, leftTime: 60
} }
}, },
onLoad() { onLoad() {
this.Country() this.Country()
}, },
methods: { methods: {
showUser(){ showUser() {
this.$refs.userment.open() this.$refs.userment.open()
}, },
Country () { Country() {
this.$request.get('/app-api/ecw/country/list-all').then(res => { this.$request.get('/app-api/ecw/country/list-all').then((res) => {
if(res.code == 0 && res.data.length > 0){ if (res.code == 0 && res.data.length > 0) {
for(let i in res.data){ for (let i in res.data) {
this.areaData.push(res.data[i].tel) this.areaData.push(res.data[i].tel)
if(this.$lang.locale=='zh'){ if (this.$lang.locale == 'zh') {
this.areaName.push('+'+res.data[i].tel + ' ' + res.data[i].nameZh) this.areaName.push('+' + res.data[i].tel + ' ' + res.data[i].nameZh)
}else{ } else {
this.areaName.push('+'+res.data[i].tel + ' ' + res.data[i].nameEn) this.areaName.push('+' + res.data[i].tel + ' ' + res.data[i].nameEn)
} }
} }
} }
}) })
}, },
areaChange (e) { areaChange(e) {
this.areaIndex = e.detail.value this.areaIndex = e.detail.value
}, },
ismobile(code,mobile){ ismobile(code, mobile) {
this.$request.get('/app-api/param/validator/mobile',{code:code,mobile:mobile}).then(res => { this.$request
if(res.code==0){ .get('/app-api/param/validator/mobile', { code: code, mobile: mobile })
this.$request.post('/app-api/member/send-sms-code', {areaCode: this.areaData[this.areaIndex], mobile: this.mobile, scene: 0}).then(res => { .then((res) => {
if(res.code == 0){ if (res.code == 0) {
this.$request
.post('/app-api/member/send-sms-code', {
areaCode: this.areaData[this.areaIndex],
mobile: this.mobile,
scene: 0
})
.then((res) => {
if (res.code == 0) {
this.countDown() this.countDown()
} else { } else {
uni.showToast({ uni.showToast({
title: res.msg || 'error', title: res.msg || 'error',
icon: 'none', icon: 'none'
}) })
} }
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title: this.$lang.lang.notices.nophone, title: this.$lang.lang.notices.nophone,
icon: 'error', icon: 'error'
}) })
} }
}) })
}, },
sendCode () { sendCode() {
if(this.mobile == ''){ if (this.mobile == '') {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.phone, title: this.$lang.lang.notices.phone,
icon: 'error', icon: 'error'
}) })
} }
if (this.leftTime < 60) { if (this.leftTime < 60) {
return false return false
} }
this.ismobile(this.areaData[this.areaIndex],this.mobile) this.ismobile(this.areaData[this.areaIndex], this.mobile)
}, },
countDown() { countDown() {
this.leftTime-- this.leftTime--
...@@ -145,76 +182,76 @@ ...@@ -145,76 +182,76 @@
this.leftTime = 60 this.leftTime = 60
} }
}, },
register () { register() {
let params = { let params = {
areaCode: this.areaData[this.areaIndex], areaCode: this.areaData[this.areaIndex],
code: this.code, code: this.code,
englishName: '', englishName: '',
mobile: this.mobile, mobile: this.mobile,
password: this.password, password: this.password
} }
if(this.mobile == ''){ if (this.mobile == '') {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.phone, title: this.$lang.lang.notices.phone,
icon: 'error', icon: 'error'
}) })
} }
if(this.code == ''){ if (this.code == '') {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.code, title: this.$lang.lang.notices.code,
icon: 'error', icon: 'error'
}) })
} }
if(this.password == ''){ if (this.password == '') {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.password, title: this.$lang.lang.notices.password,
icon: 'error', icon: 'error'
}) })
} }
if(this.passworded == ''){ if (this.passworded == '') {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.nextPsd, title: this.$lang.lang.notices.nextPsd,
icon: 'error', icon: 'error'
}) })
}else{ } else {
var reg1 = new RegExp('^(?=.*[0-9])(?=.*[a-zA-Z])(.{6,32})$') var reg1 = new RegExp('^(?=.*[0-9])(?=.*[a-zA-Z])(.{6,32})$')
if (!reg1.test(this.passworded)) { if (!reg1.test(this.passworded)) {
return uni.showToast({ return uni.showToast({
title:this.$lang.lang.notices.numPsd, title: this.$lang.lang.notices.numPsd,
icon: 'error', icon: 'error'
}) })
} }
} }
if(this.password != this.passworded){ if (this.password != this.passworded) {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.different, title: this.$lang.lang.notices.different,
icon: 'none', icon: 'none'
}) })
} }
if(!this.agree){ if (!this.agree) {
return uni.showToast({ return uni.showToast({
title: this.$lang.lang.notices.chooseService, title: this.$lang.lang.notices.chooseService,
icon: 'none', icon: 'none'
}) })
} }
this.$request.post('/app-api/member/reg', params).then(res => { this.$request.post('/app-api/member/reg', params).then((res) => {
if(res.code == 0&&res.data){ if (res.code == 0 && res.data) {
uni.setStorageSync('Authorization', res.data.token) uni.setStorageSync('Authorization', res.data.token)
uni.reLaunch({ uni.reLaunch({
url: '../index/index' url: '/pages/my_info/my_info?type=first'
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none'
}) })
} }
}) })
} }
} }
} }
</script> </script>
<style> <style>
@import url(../../static/css/register.css); @import url(../../static/css/register.css);
</style> </style>
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