You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
221 lines
4.8 KiB
221 lines
4.8 KiB
<template>
|
|
<view class="site">
|
|
<view class="site-bd">
|
|
<view class="item">
|
|
<view class="a">用户头像</view>
|
|
<view class="b">
|
|
<image @click="uploadImg" v-if="userInfo.avatar" class="img" :src="userInfo.avatar1 || userInfo.avatar"></image>
|
|
<image @click="uploadImg" v-else class="img" src="https://zhengxin.njrenzhou.cn/static/default.png"></image>
|
|
<text @click="openPage(1)">编辑</text>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="a">用户昵称</view>
|
|
<view class="b">
|
|
<input v-model="userInfo.username" type="text" placeholder="请输入用户名" />
|
|
<text @click="openPage(2)">编辑</text>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="a">密码</view>
|
|
<view class="b" @click="openPage(3)">
|
|
<text>设置</text>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="a">实名认证</view>
|
|
<view class="b" @click="openPage(4)">
|
|
<text>去认证</text>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="a">手机号</view>
|
|
<view class="b" @click="openPage(5)">
|
|
<input disabled value="180****0223" type="text" placeholder="请输入用户名" />
|
|
<text>编辑</text>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="a">微信号</view>
|
|
<view class="b" @click="openPage(6)">
|
|
<text>绑定</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
userInfo: {}
|
|
};
|
|
},
|
|
onShow() {
|
|
this.userInfo = uni.getStorageSync("userInfo")
|
|
},
|
|
methods: {
|
|
openPage(index){
|
|
if(index == 1){
|
|
|
|
}else if(index == 2){
|
|
|
|
}else if(index == 3){
|
|
uni.navigateTo({
|
|
url: "/pages/user/password"
|
|
})
|
|
}else if(index == 4){
|
|
uni.navigateTo({
|
|
url: "/pages/user/verification"
|
|
})
|
|
}else if(index == 5){
|
|
uni.navigateTo({
|
|
url: "/pages/user/phone"
|
|
})
|
|
}else if(index == 6){
|
|
uni.navigateTo({
|
|
url: "/pages/user/verification"
|
|
})
|
|
}
|
|
},
|
|
async toSubmit() {
|
|
if (!this.userInfo.username) {
|
|
uni.showToast({
|
|
title: '请输入用户名',
|
|
icon: 'none',
|
|
})
|
|
return
|
|
}
|
|
if (!this.userInfo.mobile) {
|
|
uni.showToast({
|
|
title: '请输入手机号',
|
|
icon: 'none',
|
|
})
|
|
return
|
|
}
|
|
|
|
if (!/^1[3456789]\d{9}$/.test(this.userInfo.mobile)) {
|
|
uni.showToast({
|
|
title: '请输入正确手机号',
|
|
icon: 'none',
|
|
})
|
|
return
|
|
}
|
|
|
|
const { code, data, message } = await this.$api.editMember({
|
|
avatar: this.userInfo.avatar,
|
|
username: this.userInfo.username,
|
|
mobile: this.userInfo.mobile,
|
|
wx_qr_code: "",
|
|
alipay_account: "",
|
|
wx_account: "",
|
|
});
|
|
if(code == 200){
|
|
uni.showToast({
|
|
title: "提交成功"
|
|
})
|
|
setTimeout(()=>{
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
},1000)
|
|
}
|
|
},
|
|
//上传图片
|
|
uploadImg() {
|
|
const that = this
|
|
uni.chooseImage({
|
|
count: 1,
|
|
sizeType: ["original"], //可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ["album", "camera"],
|
|
success: (res) => {
|
|
console.log(res.tempFilePaths[0])
|
|
uni.uploadFile({
|
|
name: 'file',
|
|
header: {
|
|
userToken: uni.getStorageSync('token')
|
|
},
|
|
url: this.$baseUrl+'api/user/upload',
|
|
filePath: res.tempFilePaths[0],
|
|
success: (upRes) => {
|
|
let end = JSON.parse(upRes.data)
|
|
that.userInfo.avatar = end.data.path
|
|
that.userInfo.avatar1 = end.data.url
|
|
},
|
|
fail: (err) => {
|
|
console.log("toUpload err",err)
|
|
console.log(err)
|
|
}
|
|
});
|
|
},
|
|
fail(err){
|
|
console.log("fail",err)
|
|
}
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.site{
|
|
padding: 25rpx;
|
|
overflow: hidden;
|
|
&-bd{
|
|
width: 700rpx;
|
|
background: #FFFFFF;
|
|
box-shadow: 0px 3rpx 10rpx 0px rgba(9,44,39,0.05);
|
|
border-radius: 20rpx;
|
|
margin: 0 auto;
|
|
padding: 0 30rpx;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
.item{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
border-top: 1px solid #EAEAEA;
|
|
padding: 35rpx 0;
|
|
overflow: hidden;
|
|
position: relative;
|
|
&:first-child{
|
|
border-color: #FFFFFF;
|
|
}
|
|
.a{
|
|
width: 160rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
font-weight: 500;
|
|
font-size: 30rpx;
|
|
color: #222222;
|
|
}
|
|
.b{
|
|
flex: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
font-weight: 500;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
input{
|
|
flex: 1;
|
|
font-weight: 500;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
}
|
|
text{
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #00C6A9;
|
|
margin-left: 15rpx;
|
|
}
|
|
image{
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |