<template>
|
|
<view class="login">
|
|
|
|
<view class="logo">
|
|
<!-- 后续改回接口获取 -->
|
|
<image src="../static/auth/logo.png" mode=""></image>
|
|
<view class="text">
|
|
{{ configList.logo_name }}
|
|
</view>
|
|
</view>
|
|
|
|
<view class="title">
|
|
申请获取你的头像、昵称
|
|
</view>
|
|
|
|
<view class="form">
|
|
<view class="form-item">
|
|
<view class="label">
|
|
头像
|
|
</view>
|
|
<view class="content">
|
|
<button class="btn-avatar" :plain="true" :hairline="false" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
|
<image :src="userInfoForm.headImage" v-if="userInfoForm.headImage" class="avatar"
|
|
mode=""></image>
|
|
|
|
<image src="../static/auth/headImage.png" v-else class="avatar" mode=""></image>
|
|
</button>
|
|
</view>
|
|
</view>
|
|
<view class="form-item">
|
|
<view class="label">
|
|
昵称
|
|
</view>
|
|
<view class="content">
|
|
<input type="nickname" placeholder="请输入昵称" style="text-align: right;" id="nickName"
|
|
v-model="userInfoForm.nickName" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="btn" @click="submit">
|
|
确认
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
userInfoForm: {
|
|
headImage: '',
|
|
nickName: '',
|
|
}
|
|
};
|
|
},
|
|
onShow() {},
|
|
onLoad() {
|
|
this.userInfoForm.nickName = this.userInfo.nickName || ''
|
|
this.userInfoForm.headImage = this.userInfo.headImage || ''
|
|
},
|
|
computed: {},
|
|
methods: {
|
|
onChooseAvatar(res) {
|
|
this.$Oss.ossUpload(res.target.avatarUrl)
|
|
.then(url => {
|
|
this.userInfoForm.headImage = url
|
|
})
|
|
},
|
|
submit() {
|
|
let self = this
|
|
|
|
uni.createSelectorQuery().in(this)
|
|
.select("#nickName")
|
|
.fields({
|
|
properties: ["value"],
|
|
})
|
|
.exec((res) => {
|
|
const nickName = res?.[0]?.value
|
|
self.userInfoForm.nickName = nickName
|
|
|
|
if (self.$utils.verificationAll(self.userInfoForm, {
|
|
headImage: '请选择头像',
|
|
nickName: '请填写昵称',
|
|
})) {
|
|
return
|
|
}
|
|
|
|
self.$api('updateInfo', {
|
|
avatarUrl : self.userInfoForm.headImage,
|
|
nickName : self.userInfoForm.nickName,
|
|
}, res => {
|
|
if (res.code == 200) {
|
|
uni.reLaunch({
|
|
url:'/pages/index/index'
|
|
})
|
|
}
|
|
})
|
|
})
|
|
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.login {
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
height: 100vh;
|
|
flex-direction: column;
|
|
position: relative;
|
|
|
|
background: $uni-bg-color;
|
|
|
|
.logo{
|
|
margin-top: 334rpx;
|
|
width: 320rpx;
|
|
image{
|
|
height: 150rpx;
|
|
width: 320rpx;
|
|
}
|
|
.text{
|
|
margin-top: 90rpx;
|
|
font-size: 38rpx;
|
|
font-family: PingFang SC, PingFang SC-Bold;
|
|
font-weight: 700;
|
|
text-align: center;
|
|
color: #000000;
|
|
}
|
|
}
|
|
|
|
.title {
|
|
margin-top: 48rpx;
|
|
font-size: 32rpx;
|
|
font-family: PingFang SC, PingFang SC-Regular;
|
|
font-weight: 400;
|
|
color: #000000;
|
|
}
|
|
|
|
.form {
|
|
margin-top: 45rpx;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
|
|
.form-item {
|
|
width: 85%;
|
|
display: flex;
|
|
align-items: baseline;
|
|
padding: 11rpx 23rpx;
|
|
|
|
position: relative;
|
|
|
|
&::after {
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
content: " ";
|
|
width: 100%;
|
|
height: 1rpx;
|
|
border-top: 1px solid rgba(112, 112, 112, 0.35);
|
|
transform: scaleY(.5);
|
|
}
|
|
|
|
.label {
|
|
width: 60rpx;
|
|
font-size: 30rpx;
|
|
font-family: SimSun, SimSun-Regular;
|
|
font-weight: 400;
|
|
text-align: left;
|
|
color: #000000;
|
|
}
|
|
|
|
.content {
|
|
flex: 1;
|
|
text-align: right;
|
|
}
|
|
}
|
|
|
|
.form-item + .form-item {
|
|
margin-top: 50rpx;
|
|
}
|
|
|
|
.btn-avatar {
|
|
background: transparent;
|
|
border: none;
|
|
border-radius: none;
|
|
box-shadow: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
font-size: 0;
|
|
text-align: right;
|
|
}
|
|
|
|
.avatar {
|
|
width: 70rpx;
|
|
height: 70rpx;
|
|
margin-right: 63rpx;
|
|
}
|
|
}
|
|
|
|
.btn {
|
|
text-align: center;
|
|
margin-top: 155rpx;
|
|
|
|
width: 80%;
|
|
height: 100rpx;
|
|
border-radius: 50rpx;
|
|
background-color: #B3997E;
|
|
color: #fff;
|
|
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
border-radius: 50rpx;
|
|
border: none;
|
|
}
|
|
}
|
|
</style>
|