Browse Source

修改bug

master
前端-胡立永 11 months ago
parent
commit
2536cc0a3d
1 changed files with 82 additions and 92 deletions
  1. +82
    -92
      pages/auth/wxUserInfo.vue

+ 82
- 92
pages/auth/wxUserInfo.vue View File

@ -6,25 +6,17 @@
<view class="title"> <view class="title">
申请获取你的头像昵称 申请获取你的头像昵称
</view> </view>
<button
class="chooseAvatar"
open-type="chooseAvatar"
@chooseavatar="onChooseAvatar">
<button class="chooseAvatar" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<view class="line"> <view class="line">
<view class=""> <view class="">
头像 头像
</view> </view>
<view class=""> <view class="">
<image :src="userInfo.headImage"
v-if="userInfo.headImage"
style="width: 60rpx;height: 60rpx;"
mode=""></image>
<image src="/static/image/tabbar/6.png"
v-else
style="width: 50rpx;height: 50rpx;"
mode=""></image>
<image :src="userInfo.headImage" v-if="userInfo.headImage" style="width: 60rpx;height: 60rpx;"
mode=""></image>
<image src="/static/image/tabbar/6.png" v-else style="width: 50rpx;height: 50rpx;" mode=""></image>
</view> </view>
</view> </view>
</button> </button>
@ -33,19 +25,15 @@
昵称 昵称
</view> </view>
<view class=""> <view class="">
<input type="nickname" placeholder="请输入昵称"
style="text-align: right;"
id="nickName"
v-model="userInfo.nickName"
/>
<input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
v-model="userInfo.nickName" />
</view> </view>
</view> </view>
<view class="btn"
@click="submit">
<view class="btn" @click="submit">
确认 确认
</view> </view>
</view> </view>
</template> </template>
@ -53,89 +41,91 @@
export default { export default {
data() { data() {
return { return {
userInfo : {
headImage : '',
nickName : '',
userInfo: {
headImage: '',
nickName: '',
} }
}; };
}, },
onShow(){
},
computed : {
},
methods : {
onChooseAvatar(res){
onShow() {},
computed: {},
methods: {
onChooseAvatar(res) {
let self = this let self = this
self.$Oss.ossUpload(res.target.avatarUrl) self.$Oss.ossUpload(res.target.avatarUrl)
.then(url => {
self.userInfo.headImage = url
})
.then(url => {
self.userInfo.headImage = url
})
}, },
submit(){
submit() {
let self = this let self = this
uni.createSelectorQuery().in(this) uni.createSelectorQuery().in(this)
.select("#nickName")
.fields({
properties: ["value"],
})
.exec((res) => {
const nickName = res?.[0]?.value
self.userInfo.nickName = nickName
})
if(this.$utils.verificationAll(this.userInfo, {
headImage : '请选择头像',
nickName : '请填写昵称',
})){
return
}
this.$api('infoUpdateInfo', this.userInfo, res => {
if(res.code == 200){
uni.navigateBack(-1)
}
})
.select("#nickName")
.fields({
properties: ["value"],
})
.exec((res) => {
const nickName = res?.[0]?.value
self.userInfo.nickName = nickName
if (self.$utils.verificationAll(self.userInfo, {
headImage: '请选择头像',
nickName: '请填写昵称',
})) {
return
}
self.$api('infoUpdateInfo', self.userInfo, res => {
if (res.code == 200) {
uni.navigateBack(-1)
}
})
})
}, },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.login{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 80vh;
.title{
line-height: 45rpx;
font-weight: 900;
}
.line{
.login {
display: flex; display: flex;
justify-content: space-between;
flex-direction: column;
justify-content: center;
align-items: center; align-items: center;
width: 80%;
border-bottom: 1px solid #00000023;
padding: 30rpx 0;
margin: 0 auto;
}
.chooseAvatar{
width: 100%;
padding: 0;
margin: 0;
margin-top: 10vh;
border: none;
}
.btn{
background: $uni-linear-gradient-btn-color;
color: #fff;
width: 80%;
padding: 20rpx 0;
text-align: center;
border-radius: 15rpx;
margin-top: 10vh;
height: 80vh;
.title {
line-height: 45rpx;
font-weight: 900;
}
.line {
display: flex;
justify-content: space-between;
align-items: center;
width: 80%;
border-bottom: 1px solid #00000023;
padding: 30rpx 0;
margin: 0 auto;
}
.chooseAvatar {
width: 100%;
padding: 0;
margin: 0;
margin-top: 10vh;
border: none;
}
.btn {
background: $uni-linear-gradient-btn-color;
color: #fff;
width: 80%;
padding: 20rpx 0;
text-align: center;
border-radius: 15rpx;
margin-top: 10vh;
}
} }
}
</style>
</style>

Loading…
Cancel
Save