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.
267 lines
7.2 KiB
267 lines
7.2 KiB
<template>
|
|
<view class="pageBg">
|
|
<view class="pad">
|
|
<view class="avatarBox" @click="editAvatar">
|
|
<view class="avatar">
|
|
<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="card">
|
|
<view class="row">
|
|
<view class="lab">手机号</view>
|
|
<view class="val">{{ vuex_userInfo.phone }}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="card" v-if="vuex_userInfo.schoolName">
|
|
<view class="row border">
|
|
<view class="lab">我的驾校</view>
|
|
<view class="val">{{ vuex_userInfo.schoolName||'' }}</view>
|
|
</view>
|
|
<view class="row border">
|
|
<view class="lab">我的教练</view>
|
|
<view class="val">{{ vuex_userInfo.coachName||'' }}</view>
|
|
</view>
|
|
<view class="row border">
|
|
<view class="lab">所学车型</view>
|
|
<view class="val">{{ vuex_userInfo.trainType||'' }}</view>
|
|
</view>
|
|
<view class="row">
|
|
<view class="lab">报名时间</view>
|
|
<view class="val">{{ $u.timeFormat(vuex_userInfo.applyDate, 'yyyy-mm-dd hh:MM:ss')}}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="card" v-if="vuex_userInfo.cardType>1" @click="$goPage('/pages/mineEntry/personaInfo/myInfo')">
|
|
<view class="row">
|
|
<view class="lab">个人信息</view>
|
|
<view class="flex">
|
|
<view class="val">查看</view>
|
|
<view class="icon">
|
|
<u-icon name="arrow-right"></u-icon>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="card" v-if="vuex_userInfo.cardType==1">
|
|
<view class="row">
|
|
<view class="lab">实名认证</view>
|
|
<view class="val">已完成</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- <view class="card" v-if="vuex_userInfo.cardType==1">
|
|
<view class="row">
|
|
<view class="lab">拍照&体检&面签</view>
|
|
<view class="val">已完成</view>
|
|
</view>
|
|
</view> -->
|
|
|
|
<!-- <view class="logout" @click="deleteTestClick" style="margin-top: 40rpx;">删除测试账号(开发用的)</view> -->
|
|
|
|
</view>
|
|
<view class="footerBtn">
|
|
<view class="btnBg" @click="logOutFn">退出登录</view>
|
|
<view class="AccountCancellation" @click="AccountCanceFn">注销账号</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { logOut,deleteTest, avatarApply } from '@/config/api.js'
|
|
import { uploadImgApi } from '@/config/utils.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
avatarLink: '',
|
|
photoPath: ''
|
|
}
|
|
},
|
|
onLoad() {
|
|
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() {
|
|
const _this = this;
|
|
uni.chooseImage({
|
|
count: 1, // 默认9
|
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
success: (res) => {
|
|
let url = res.tempFilePaths[0];
|
|
// 获取裁剪图片资源后,给data添加src属性及其值
|
|
console.log('跳转到哪了?')
|
|
// uni.navigateTo({
|
|
// url: '/pages/mineEntry/uAvatarCropper/uAvatarCropper?src=' + encodeURIComponent(url)
|
|
// })
|
|
uni.navigateTo({
|
|
url: '/pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper?url=' + encodeURIComponent(url)
|
|
})
|
|
}
|
|
});
|
|
},
|
|
AccountCanceFn() {
|
|
this.$goPage('/pages/mineEntry/personaInfo/AccountCance')
|
|
},
|
|
logOutFn() {
|
|
let _this = this
|
|
uni.showModal({
|
|
content: '确定要退出登录吗?',
|
|
success: async function (res) {
|
|
if (res.confirm) {
|
|
logOut().then(()=>{
|
|
_this.$store.commit('goLogin')
|
|
}).catch(()=>{
|
|
_this.$store.commit('goLogin')
|
|
})
|
|
|
|
} else if (res.cancel) {
|
|
console.log('用户点击取消');
|
|
}
|
|
}
|
|
});
|
|
|
|
},
|
|
async deleteTestClick() {
|
|
const res = await deleteTest({phone: this.vuex_userInfo.phone})
|
|
this.$store.commit('goLogin')
|
|
console.log(res)
|
|
},
|
|
uploadTap() {
|
|
// let studentId = uni.getStorageSync('studentId')
|
|
// if(!studentId&&!this.havePay) return false
|
|
const _this = this;
|
|
uni.chooseImage({
|
|
count: 1, // 默认9
|
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
success: (res) => {
|
|
let url = res.tempFilePaths[0];
|
|
// 获取裁剪图片资源后,给data添加src属性及其值
|
|
uni.navigateTo({
|
|
url: '/pages/indexEntry/enroll/uploadAvatar/uAvatarCropper/uAvatarCropper?url=' + encodeURIComponent(url)
|
|
})
|
|
}
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.editBtn {
|
|
padding: 10rpx 20rpx ;
|
|
border: 1rpx solid #ebedf0;
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
border-radius: 10rpx;
|
|
margin: 10rpx 0 30rpx 0;
|
|
background-color: #fff;
|
|
}
|
|
.card {
|
|
padding: 6rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
.pad {
|
|
overflow: hidden;
|
|
}
|
|
.avatarBox {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
position: relative;
|
|
.avatar {
|
|
width: 175rpx;
|
|
height: 175rpx;
|
|
border-radius: 50%;
|
|
overflow: hidden;
|
|
background-color: #E8E9EC;
|
|
position: relative;
|
|
.imgMask {
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
// background: rgba(0,0,0,1);
|
|
background-color: rgba(0,0,0,0.4);
|
|
font-size: 24rpx;
|
|
color: rgba(255,255,255,0.8);
|
|
// opacity: 0.4;
|
|
line-height: 104rpx;
|
|
text-align: center;
|
|
}
|
|
}
|
|
.phoneIcon {
|
|
width: 46rpx;
|
|
height: 46rpx;
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: 0;
|
|
z-index: 9;
|
|
}
|
|
|
|
}
|
|
.row {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
height: 98rpx;
|
|
font-size: 28rpx;
|
|
padding: 0 30rpx;
|
|
&.border {
|
|
border-bottom: 2rpx solid #E8E9EC;
|
|
}
|
|
}
|
|
.logout {
|
|
width: 396rpx;
|
|
height: 72rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 8rpx;
|
|
border: 2rpx solid #E8E9EC;
|
|
font-size: 28rpx;
|
|
color: #ADADAD;
|
|
text-align: center;
|
|
line-height: 72rpx;
|
|
margin: 88rpx auto;
|
|
}
|
|
.AccountCancellation {
|
|
border: 1px solid #d1d1d1;;
|
|
border-radius: 8rpx;
|
|
border-color: linear-gradient(180deg, #3593FB 0%, #53D3E5 100%);
|
|
line-height: 72rpx;
|
|
color: #999;
|
|
text-align: center;
|
|
font-size: 28rpx;
|
|
margin-top: 30rpx;
|
|
}
|
|
</style>
|