<template>
|
<view class="modifyInfo-wrapper wrapperLayer">
|
<titleBar :titleText="'修改信息'" :pageForm='"modifyInfo"'></titleBar>
|
<view class="pagebottom-container colCen">
|
<view class="userAvator-bar pd30 rowCenBet" @tap="avatarChoose()">
|
<view class="leftkey">
|
头像
|
</view>
|
<view class="rightval rowCen">
|
<image :src="user.avatar" mode="aspectFill"></image>
|
<view class="arrow iconfont">
|

|
</view>
|
</view>
|
</view>
|
<view class="username-bar userAvator-bar rowCenBet pd30" @tap="nickname()">
|
<view class="leftkey">
|
昵称
|
</view>
|
<view class="rightval rowCen">
|
<view class="nameinfo">
|
{{user.nickname}}
|
</view>
|
<view class="arrow iconfont">
|

|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import util from '../../../utils/utils.js'
|
import titleBar from '@/components/backTitlebar.vue'
|
import basicConfig from '../../../utils/config.js'
|
export default {
|
components: {
|
titleBar
|
},
|
data() {
|
return {
|
user:''
|
}
|
},
|
onShow() {
|
util.getCache('userInfo').then(res=>{
|
this.user = res
|
})
|
},
|
methods:{
|
nickname(){
|
uni.navigateTo({
|
url:'./setNickname?nickName='+this.user.nickname
|
})
|
},
|
avatarChoose(){
|
var that =this;
|
uni.chooseImage({
|
count: 1, //默认9
|
success: res=> {
|
uni.uploadFile({
|
url: basicConfig.httpUrl + '/api/common/upload', //仅为示例,非真实的接口地址
|
filePath: res.tempFilePaths[0],
|
name: 'file',
|
fileType: 'json',
|
//这个是参数根据你后台的需求可以隐藏
|
header: {
|
"token": this.user.token,
|
"appVersion":plus.runtime.version
|
},
|
success: obj => {
|
console.log(obj)
|
var result = JSON.parse(obj.data);
|
console.log(result)
|
that.$u.api.profile({
|
avatar: result.data.url
|
}).then(e => {
|
console.log(e)
|
if(e.code == 1)return that.$alert(e.msg);
|
that.user.avatar = result.data.fullurl
|
//util.setCache('userInfo',that.userInfo)
|
}).catch(function (err) {
|
uni.showToast({
|
title:'很抱歉,您的头像上传失败!',
|
icon:'none'
|
})
|
})
|
}
|
});
|
}
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.modifyInfo-wrapper {
|
width: 100%;
|
|
.pagebottom-container {
|
width: 100%;
|
margin-top: 20rpx;
|
|
.userAvator-bar {
|
width: 100%;
|
height: 130rpx;
|
background: #FFFFFF;
|
box-shadow: 0px -1rpx 0px 0px #F1F1F1;
|
|
.leftkey {
|
font-size: 28rpx;
|
font-weight: 500;
|
color: #333333;
|
}
|
|
.rightval {
|
image {
|
width: 100rpx;
|
height: 100rpx;
|
border-radius: 50%;
|
}
|
|
.arrow {
|
color: #666666;
|
font-size: 20rpx;
|
margin-left: 30rpx;
|
margin-top: 5rpx;
|
}
|
}
|
}
|
|
.username-bar {
|
height: 90rpx;
|
}
|
}
|
}
|
</style>
|