|
|
@ -1,14 +1,14 @@ |
|
|
|
<template> |
|
|
|
<view class="pageBg"> |
|
|
|
<view class="pad"> |
|
|
|
<!-- <view class="avatarBox" @click="editAvatar"> |
|
|
|
<view class="avatarBox" @click="editAvatar"> |
|
|
|
<view class="avatar"> |
|
|
|
<image :src="avatarBase64?avatarBase64:avatarLink" mode=""></image> |
|
|
|
|
|
|
|
<view class="imgMask" v-if="avatarBase64">审核中</view> |
|
|
|
<image :src="vuex_userInfo.newPhotoPath?vuex_userInfo.newPhotoPath:vuex_userInfo.photoPath" mode="aspectFill"></image> |
|
|
|
<view class="imgMask" v-if="vuex_userInfo.avatarCheckStatus==0&&vuex_userInfo.newPhotoPath">审核中</view> |
|
|
|
<view class="imgMask" v-if="vuex_userInfo.avatarCheckStatus==2&&vuex_userInfo.newPhotoPath" style="color: red;">审核失败</view> |
|
|
|
</view> |
|
|
|
<view class="editBtn" v-if="vuex_userInfo.avatarCheckStatus!=0">修改头像</view> |
|
|
|
</view> |
|
|
|
<view class="editBtn">修改头像</view> |
|
|
|
</view> --> |
|
|
|
|
|
|
|
<view class="card"> |
|
|
|
<view class="row"> |
|
|
@ -73,25 +73,40 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { logOut,deleteTest } from '@/config/api.js' |
|
|
|
import { logOut,deleteTest, avatarApply } from '@/config/api.js' |
|
|
|
import { uploadImgApi } from '@/config/utils.js' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
avatarLink: '', |
|
|
|
avatarBase64: '' |
|
|
|
photoPath: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
uni.$on('uAvatarCropper', (res)=>{ |
|
|
|
this.avatarLink = res |
|
|
|
this.$store.dispatch('getUserInfo') |
|
|
|
uni.$on('uAvatarCropper', async (res)=>{ |
|
|
|
const photoPath = await uploadImgApi(res, 'face') |
|
|
|
this.photoPath = photoPath |
|
|
|
this.avatarApplyFn() |
|
|
|
}) |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
if(uni.getStorageSync('avatarBase64')) this.avatarBase64 = uni.getStorageSync('avatarBase64') |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 修改头像申请 |
|
|
|
async avatarApplyFn() { |
|
|
|
const res = await avatarApply({avatarImg: this.photoPath}) |
|
|
|
if(res.code==0) { |
|
|
|
this.$u.toast('申请成功,等待审核') |
|
|
|
} |
|
|
|
this.$store.dispatch('getUserInfo') |
|
|
|
console.log('申请成功') |
|
|
|
console.log(res) |
|
|
|
}, |
|
|
|
// 点击修改头像 |
|
|
|
editAvatar() { |
|
|
|
if(this.vuex_userInfo.avatarCheckStatus==0) return false |
|
|
|
this.uploadTapFn() |
|
|
|
}, |
|
|
|
uploadTapFn() { |
|
|
@ -104,8 +119,11 @@ |
|
|
|
let url = res.tempFilePaths[0]; |
|
|
|
// 获取裁剪图片资源后,给data添加src属性及其值 |
|
|
|
console.log('跳转到哪了?') |
|
|
|
// uni.navigateTo({ |
|
|
|
// url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url) |
|
|
|
// }) |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url) |
|
|
|
url: '/pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper?url=' + encodeURIComponent(url) |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
@ -194,12 +212,11 @@ |
|
|
|
right: 0; |
|
|
|
top: 0; |
|
|
|
bottom: 0; |
|
|
|
background: rgba(0,0,0,1); |
|
|
|
// background-color: rgba(0,0,0,0.4); |
|
|
|
// background: rgba(0,0,0,1); |
|
|
|
background-color: rgba(0,0,0,0.4); |
|
|
|
font-size: 24rpx; |
|
|
|
// color: rgba(255,255,255,0.8); |
|
|
|
color: #fff; |
|
|
|
opacity: 0.4; |
|
|
|
color: rgba(255,255,255,0.8); |
|
|
|
// opacity: 0.4; |
|
|
|
line-height: 104rpx; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|