|
|
@ -7,12 +7,12 @@ |
|
|
昵称 |
|
|
昵称 |
|
|
</view> |
|
|
</view> |
|
|
<view class="lf-flex"> |
|
|
<view class="lf-flex"> |
|
|
<view class="lf-font-28 lf-color-555">{{ userInfo.mobile_replace }}</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text> |
|
|
|
|
|
|
|
|
<view class="lf-font-28 lf-color-555">{{ userInfo.nick_name || userInfo.mobile }}</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="lf-p-l-32 lf-p-r-32 lf-bg-white"> |
|
|
<view class="lf-p-l-32 lf-p-r-32 lf-bg-white"> |
|
|
<view class="set-tag lf-border-bottom" @click="$msg('敬请期待')"> |
|
|
|
|
|
|
|
|
<view class="set-tag lf-border-bottom" @click="changeImage"> |
|
|
<view class="lf-font-28 lf-color-black"> |
|
|
<view class="lf-font-28 lf-color-black"> |
|
|
头像 |
|
|
头像 |
|
|
</view> |
|
|
</view> |
|
|
@ -93,17 +93,70 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
|
|
|
import { config, getUpdateUserInfo } from '@/common/js/utils.js'; |
|
|
export default { |
|
|
export default { |
|
|
data(){ |
|
|
data(){ |
|
|
return { |
|
|
return { |
|
|
userInfo: {} |
|
|
|
|
|
|
|
|
userInfo: {}, |
|
|
|
|
|
token: '', |
|
|
|
|
|
shou_count: 0 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad(){ |
|
|
onLoad(){ |
|
|
var userInfo = this.$cookieStorage.get('user_info'); |
|
|
|
|
|
this.userInfo = userInfo || {}; |
|
|
|
|
|
|
|
|
// var userInfo = this.$cookieStorage.get('user_info'); |
|
|
|
|
|
// this.userInfo = userInfo || {}; |
|
|
|
|
|
var token = this.$cookieStorage.get('user_token'); |
|
|
|
|
|
this.token = token; |
|
|
|
|
|
this.getMeInfo(); |
|
|
|
|
|
}, |
|
|
|
|
|
onShow(){ |
|
|
|
|
|
this.shou_count++; |
|
|
|
|
|
if(this.shou_count > 1){ |
|
|
|
|
|
this.getMeInfo(); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
// 获取页面信息 |
|
|
|
|
|
getMeInfo(){ |
|
|
|
|
|
this.$http.get({ |
|
|
|
|
|
api: 'api/me', |
|
|
|
|
|
header: { |
|
|
|
|
|
Authorization: this.token |
|
|
|
|
|
} |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
this.userInfo = res.data.data; |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 上传更换用户头像 |
|
|
|
|
|
changeImage: function() { |
|
|
|
|
|
uni.chooseImage({ |
|
|
|
|
|
count: 1, |
|
|
|
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 |
|
|
|
|
|
sourceType: ['album'], //从相册选择 |
|
|
|
|
|
success: res => { |
|
|
|
|
|
var tempFilePaths = res.tempFilePaths; |
|
|
|
|
|
this.newImage = tempFilePaths[0]; |
|
|
|
|
|
|
|
|
|
|
|
uni.uploadFile({ |
|
|
|
|
|
header: { |
|
|
|
|
|
Authorization: this.token |
|
|
|
|
|
}, |
|
|
|
|
|
url: config.GLOBAL.baseUrl + 'api/users/upload/avatar', |
|
|
|
|
|
filePath: tempFilePaths[0], |
|
|
|
|
|
fileType: 'image', |
|
|
|
|
|
name: 'avatar_file', |
|
|
|
|
|
success: res => { |
|
|
|
|
|
var result = JSON.parse(res.data); |
|
|
|
|
|
// this.setData({ |
|
|
|
|
|
// 'userInfo.avatar': result.data.url |
|
|
|
|
|
// }); |
|
|
|
|
|
this.userInfo.avatar = result.data.url; |
|
|
|
|
|
getUpdateUserInfo(this.token); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
signOut(){ |
|
|
signOut(){ |
|
|
this.$msg('敬请期待') |
|
|
this.$msg('敬请期待') |
|
|
} |
|
|
} |
|
|
|