|
|
@ -1,5 +1,8 @@ |
|
|
|
<template> |
|
|
|
<view class="login"> |
|
|
|
<view class="logo"> |
|
|
|
<image :src="configList.logo_image" mode=""></image> |
|
|
|
</view> |
|
|
|
<view class="title"> |
|
|
|
{{ configList.logo_name }} |
|
|
|
</view> |
|
|
@ -13,7 +16,7 @@ |
|
|
|
头像 |
|
|
|
</view> |
|
|
|
<view class=""> |
|
|
|
<image :src="userInfo.headImage" v-if="userInfo.headImage" style="width: 60rpx;height: 60rpx;" |
|
|
|
<image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" style="width: 60rpx;height: 60rpx;" |
|
|
|
mode=""></image> |
|
|
|
|
|
|
|
<image src="../static/auth/headImage.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image> |
|
|
@ -26,9 +29,34 @@ |
|
|
|
</view> |
|
|
|
<view class=""> |
|
|
|
<input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName" |
|
|
|
v-model="userInfo.nickName" /> |
|
|
|
v-model="userInfoForm.nickName" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class=""> |
|
|
|
手机号 |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="" |
|
|
|
v-if="userInfoForm.phone"> |
|
|
|
<input placeholder="请输入手机号" style="text-align: right;" |
|
|
|
disabled |
|
|
|
v-model="userInfoForm.phone" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="" |
|
|
|
v-else> |
|
|
|
<button |
|
|
|
class="getPhoneNumber" |
|
|
|
open-type="getPhoneNumber" |
|
|
|
@getphonenumber="getPhone"> |
|
|
|
获取电话号码 |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="btn" @click="submit"> |
|
|
|
确认 |
|
|
|
</view> |
|
|
@ -39,21 +67,44 @@ |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
userInfo: { |
|
|
|
userInfoForm: { |
|
|
|
headImage: '', |
|
|
|
nickName: '', |
|
|
|
phone : '', |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
onShow() {}, |
|
|
|
onLoad() { |
|
|
|
this.userInfoForm.phone = this.userInfo.phone || '' |
|
|
|
this.userInfoForm.nickName = this.userInfo.nickName || '' |
|
|
|
this.userInfoForm.headImage = this.userInfo.headImage || '' |
|
|
|
}, |
|
|
|
computed: {}, |
|
|
|
methods: { |
|
|
|
onChooseAvatar(res) { |
|
|
|
let self = this |
|
|
|
self.$Oss.ossUpload(res.target.avatarUrl) |
|
|
|
.then(url => { |
|
|
|
self.userInfo.headImage = url |
|
|
|
}) |
|
|
|
.then(url => { |
|
|
|
self.userInfoForm.headImage = url |
|
|
|
}) |
|
|
|
}, |
|
|
|
getPhone(e){ |
|
|
|
this.$api('bindPhone', { |
|
|
|
phoneCode : e.detail.code |
|
|
|
}, res => { |
|
|
|
if(res.code == 200){ |
|
|
|
let phoneObj = JSON.parse(res.result) |
|
|
|
if(phoneObj.errmsg == 'ok'){ |
|
|
|
this.userInfoForm.phone = phoneObj.phone_info.phoneNumber |
|
|
|
}else{ |
|
|
|
uni.showModal({ |
|
|
|
title: phoneObj.errmsg |
|
|
|
}) |
|
|
|
} |
|
|
|
console.log(phoneObj); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
let self = this |
|
|
@ -65,18 +116,20 @@ |
|
|
|
}) |
|
|
|
.exec((res) => { |
|
|
|
const nickName = res?.[0]?.value |
|
|
|
self.userInfo.nickName = nickName |
|
|
|
self.userInfoForm.nickName = nickName |
|
|
|
|
|
|
|
if (self.$utils.verificationAll(self.userInfo, { |
|
|
|
if (self.$utils.verificationAll(self.userInfoForm, { |
|
|
|
headImage: '请选择头像', |
|
|
|
nickName: '请填写昵称', |
|
|
|
phone: '请填写昵称', |
|
|
|
})) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
self.$api('updateInfo', { |
|
|
|
avatarUrl : self.userInfo.headImage, |
|
|
|
nickName : self.userInfo.nickName |
|
|
|
avatarUrl : self.userInfoForm.headImage, |
|
|
|
nickName : self.userInfoForm.nickName, |
|
|
|
phone : self.userInfoForm.phone, |
|
|
|
}, res => { |
|
|
|
if (res.code == 200) { |
|
|
|
uni.reLaunch({ |
|
|
@ -98,6 +151,16 @@ |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
height: 80vh; |
|
|
|
.logo{ |
|
|
|
height: 140rpx; |
|
|
|
width: 140rpx; |
|
|
|
image{ |
|
|
|
height: 140rpx; |
|
|
|
width: 140rpx; |
|
|
|
border-radius: 30rpx; |
|
|
|
} |
|
|
|
margin-bottom: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.title { |
|
|
|
line-height: 45rpx; |
|
|
@ -132,5 +195,18 @@ |
|
|
|
border-radius: 15rpx; |
|
|
|
margin-top: 10vh; |
|
|
|
} |
|
|
|
.getPhoneNumber{ |
|
|
|
all: unset; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
// background: $uni-linear-gradient-btn-color; |
|
|
|
background: $uni-color; |
|
|
|
color: #fff; |
|
|
|
width: 200rpx; |
|
|
|
height: 60rpx; |
|
|
|
border-radius: 30rpx; |
|
|
|
font-size: 24rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |