This commit is contained in:
魏啾
2024-07-19 09:36:41 +08:00
6 changed files with 191 additions and 528 deletions

View File

@@ -19,16 +19,18 @@
<view class="onecontentboxitemtext">
昵称
</view>
<input class="onecontentboxiteminput" v-model="nickName" type="nickname"
@blur="bindblur" placeholder="请输入昵称" @input="bindinput" />
<input class="onecontentboxiteminput" v-model="nickName" type="nickname" @blur="bindblur"
placeholder="请输入昵称" @input="bindinput" />
</view>
<view class="onecontentboxitem flex-between" style="border-top: 1rpx dotted #333333;">
<view class="onecontentboxitemtext">
手机号
</view>
<input class="onecontentboxiteminput" disabled v-model="userInfo.telephone" type="text"
placeholder="请输入手机号">
<button class="onecontentboxiteminput" style="background-color: #fff;border: none;!important"
open-type="getPhoneNumber" @getphonenumber="getPhone">{{phonetitle}} </button>
<!-- <input class="onecontentboxiteminput" disabled v-model="userInfo.telephone" type="text"
placeholder="请输入手机号"> -->
</view>
</view>
<view class="onecontentboxitemnamber" @click="sumbit">
@@ -61,13 +63,15 @@
},
userInfo: uni.cache.get('userInfo'),
userHeadImg: "",
nickName: ''
nickName: '',
phonetitle: ""
};
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.nickName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
this.phonetitle = this.userInfo.telephone ? this.userInfo.telephone : '请授权手机号'
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
@@ -77,12 +81,28 @@
}
},
methods: {
async getPhone(d) {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
this.phonetitle = res.data
}
})
}
},
bindblur(e) {
console.log(e,11)
console.log(e, 11)
this.nickName = e.detail.value; // 获取微信昵称
},
bindinput(e) {
console.log(e,22)
console.log(e, 22)
this.nickName = e.detail.value; // 获取微信昵称
},
// uploadImg() {
@@ -148,7 +168,8 @@
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
nickName: this.nickName
nickName: this.nickName,
telephone: this.phonetitle
})
if (res.code == 0) {
uni.navigateBack()