<template>
|
<view class="profile-page">
|
<view class="profile-header">
|
<image class="avatar" src="/static/images/ic_pic@2x.png" mode="aspectFill"></image>
|
<view class="profile-info">
|
<view class="profile-name">{{ displayName }}</view>
|
<view class="profile-mobile">{{ displayMobile }}</view>
|
</view>
|
</view>
|
|
<view class="menu-card">
|
<view class="menu-item" v-for="item in menuList" :key="item.id" @click="handleMenu(item)">
|
<view class="menu-text">{{ item.name }}</view>
|
<image class="menu-arrow" src="/static/icon/ar_detail@2x.png" mode="aspectFit"></image>
|
</view>
|
</view>
|
|
<view class="logout-btn" @click="logout">退出登录</view>
|
</view>
|
</template>
|
|
<script>
|
import { mapState } from 'vuex'
|
|
export default {
|
computed: {
|
...mapState(['userInfo']),
|
displayName() {
|
return this.userInfo.nickName || this.userInfo.nickname || this.userInfo.name || '未登录用户'
|
},
|
displayMobile() {
|
const mobile = this.userInfo.mobile || ''
|
if (!mobile) {
|
return '请先绑定手机号'
|
}
|
return mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
}
|
},
|
data() {
|
return {
|
menuList: [
|
{ id: 1, name: '结算退押金' },
|
{ id: 2, name: '消费明细', url: '/pages/consumptionDetails/consumptionDetails' },
|
{ id: 3, name: '车辆计价规则', url: '/pages/pricingRules/pricingRules' },
|
{ id: 4, name: '抖音兑换说明' },
|
{ id: 5, name: '联系客服' },
|
{ id: 6, name: '运营中心' }
|
]
|
}
|
},
|
methods: {
|
handleMenu(item) {
|
if (item.url) {
|
uni.navigateTo({
|
url: item.url
|
})
|
return
|
}
|
|
if (item.id === 1) {
|
uni.showToast({
|
title: '请在首页发起退押金',
|
icon: 'none'
|
})
|
return
|
}
|
|
if (item.id === 4) {
|
uni.showToast({
|
title: '兑换说明暂未配置',
|
icon: 'none'
|
})
|
return
|
}
|
|
if (item.id === 5) {
|
uni.showToast({
|
title: '暂未配置客服电话',
|
icon: 'none'
|
})
|
return
|
}
|
|
if (item.id === 6) {
|
uni.navigateTo({
|
url: this.userInfo.sysuser ? '/pages/operationsCenter/operationsCenter' : '/pages/operationLogin/operationLogin'
|
})
|
}
|
},
|
logout() {
|
uni.showLoading({ title: '加载中' })
|
this.$u.api.logout()
|
.then(res => {
|
uni.hideLoading()
|
if (res.code === 200) {
|
this.$store.commit('setUserInfo', res.data)
|
this.$store.commit('setToken', '')
|
uni.reLaunch({
|
url: '/pages/index/index'
|
})
|
}
|
})
|
.catch(() => {
|
uni.hideLoading()
|
uni.showToast({
|
title: '退出失败,请稍后重试',
|
icon: 'none'
|
})
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.profile-page {
|
width: 100%;
|
min-height: 100vh;
|
padding: 30rpx;
|
box-sizing: border-box;
|
background: #ffffff;
|
}
|
|
.profile-header {
|
display: flex;
|
align-items: center;
|
padding-top: 6rpx;
|
}
|
|
.avatar {
|
width: 92rpx;
|
height: 92rpx;
|
border-radius: 46rpx;
|
flex-shrink: 0;
|
}
|
|
.profile-info {
|
margin-left: 20rpx;
|
min-width: 0;
|
}
|
|
.profile-name {
|
font-weight: 600;
|
font-size: 36rpx;
|
color: #222222;
|
}
|
|
.profile-mobile {
|
margin-top: 10rpx;
|
font-weight: 400;
|
font-size: 26rpx;
|
color: #666666;
|
}
|
|
.menu-card {
|
margin-top: 62rpx;
|
background: #F8F9FB;
|
border-radius: 24rpx;
|
overflow: hidden;
|
}
|
|
.menu-item {
|
height: 106rpx;
|
padding: 0 28rpx 0 30rpx;
|
box-sizing: border-box;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 2rpx solid #E5E5E5;
|
|
&:last-child {
|
border-bottom: 0;
|
}
|
}
|
|
.menu-text {
|
font-weight: 500;
|
font-size: 30rpx;
|
color: #222222;
|
}
|
|
.menu-arrow {
|
width: 30rpx;
|
height: 30rpx;
|
flex-shrink: 0;
|
}
|
|
.logout-btn {
|
width: 200rpx;
|
height: 72rpx;
|
margin: 70rpx auto 0;
|
border-radius: 36rpx;
|
border: 1rpx solid #999999;
|
font-weight: 400;
|
font-size: 28rpx;
|
color: #333333;
|
line-height: 72rpx;
|
text-align: center;
|
box-sizing: border-box;
|
background: #ffffff;
|
}
|
</style>
|