我的页面,完善导航
This commit is contained in:
@@ -13,6 +13,25 @@
|
||||
<text class="uer-name" v-else>{{$t('mine.notLogged')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 租户信息和登录人信息展示区域 -->
|
||||
<view class="user-info-panel" v-if="hasLogin">
|
||||
<view class="info-row">
|
||||
<text class="info-label">租户ID:</text>
|
||||
<text class="info-value">{{tenantId || '未设置'}}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="info-label">用户名:</text>
|
||||
<text class="info-value">{{loginUserInfo.userName || '未设置'}}</text>
|
||||
</view>
|
||||
<view class="info-row" v-if="loginUserInfo.phone">
|
||||
<text class="info-label">手机号:</text>
|
||||
<text class="info-value">{{loginUserInfo.phone}}</text>
|
||||
</view>
|
||||
<view class="info-row" v-if="loginUserInfo.email">
|
||||
<text class="info-label">邮箱:</text>
|
||||
<text class="info-value">{{loginUserInfo.email}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<uni-grid class="grid" :column="4" :showBorder="false" :square="true">
|
||||
<uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="tapGrid(index)" :key="index">
|
||||
<uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
|
||||
@@ -59,6 +78,8 @@
|
||||
// #endif
|
||||
data() {
|
||||
return {
|
||||
tenantId: '',
|
||||
loginUserInfo: {},
|
||||
gridList: [{
|
||||
"text": this.$t('mine.showText'),
|
||||
"icon": "chat"
|
||||
@@ -87,7 +108,7 @@
|
||||
// #endif
|
||||
{
|
||||
"title": this.$t('mine.signIn'),
|
||||
"event": 'signIn',
|
||||
"to": '/pages/reception/reception',
|
||||
"icon": "compose"
|
||||
},
|
||||
// #ifdef APP-PLUS
|
||||
@@ -99,13 +120,12 @@
|
||||
//#endif
|
||||
{
|
||||
"title":this.$t('mine.readArticles'),
|
||||
"to": '/pages/ucenter/read-news-log/read-news-log',
|
||||
"to": '/pages/customer/customer',
|
||||
"icon": "flag"
|
||||
},
|
||||
{
|
||||
"title": this.$t('mine.myScore'),
|
||||
"to": '',
|
||||
"event": 'getScore',
|
||||
"to": '/pages/team/team',
|
||||
"icon": "paperplane"
|
||||
}
|
||||
// #ifdef APP
|
||||
@@ -118,7 +138,7 @@
|
||||
],
|
||||
[{
|
||||
"title": this.$t('mine.feedback'),
|
||||
"to": '/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback',
|
||||
"to": '/pages/champion/champion',
|
||||
"icon": "help"
|
||||
}, {
|
||||
"title": this.$t('mine.settings'),
|
||||
@@ -146,6 +166,8 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 加载用户信息
|
||||
this.loadUserInfo()
|
||||
//#ifdef APP-PLUS
|
||||
this.ucenterList[this.ucenterList.length - 2].unshift({
|
||||
title:this.$t('mine.checkUpdate'),// this.this.$t('mine.checkUpdate')"检查更新"
|
||||
@@ -156,7 +178,10 @@
|
||||
})
|
||||
//#endif
|
||||
},
|
||||
onShow() {},
|
||||
onShow() {
|
||||
// 每次显示页面时更新租户信息和登录人信息
|
||||
this.loadUserInfo()
|
||||
},
|
||||
computed: {
|
||||
userInfo() {
|
||||
return store.userInfo
|
||||
@@ -174,6 +199,26 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 加载用户信息(租户ID和登录人信息)
|
||||
*/
|
||||
loadUserInfo() {
|
||||
try {
|
||||
// 获取租户ID
|
||||
this.tenantId = uni.getStorageSync('backend-tenant-id') || ''
|
||||
|
||||
// 获取登录人信息
|
||||
const loginResponse = uni.getStorageSync('backend-login-response') || {}
|
||||
this.loginUserInfo = {
|
||||
userName: loginResponse.userName || '',
|
||||
phone: loginResponse.phone || '',
|
||||
email: loginResponse.email || '',
|
||||
userId: loginResponse.userId || ''
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载用户信息失败:', e)
|
||||
}
|
||||
},
|
||||
toSettings() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/ucenter/settings/settings"
|
||||
@@ -191,6 +236,19 @@
|
||||
ucenterListClick(item) {
|
||||
if (!item.to && item.event) {
|
||||
this[item.event]();
|
||||
} else if (item.to) {
|
||||
// 如果是 tabBar 页面,使用 switchTab
|
||||
const tabBarPages = ['/pages/reception/reception', '/pages/customer/customer', '/pages/team/team', '/pages/champion/champion']
|
||||
if (tabBarPages.includes(item.to)) {
|
||||
uni.switchTab({
|
||||
url: item.to
|
||||
})
|
||||
} else {
|
||||
// 其他页面使用 navigateTo(uni-list-item 会自动处理,但这里显式处理以确保正确)
|
||||
uni.navigateTo({
|
||||
url: item.to
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
async checkVersion() {
|
||||
@@ -407,6 +465,39 @@
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.user-info-panel {
|
||||
background-color: #FFFFFF;
|
||||
margin: 20rpx 30rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.info-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
width: 140rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
flex: 1;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.grid {
|
||||
background-color: #FFFFFF;
|
||||
margin-bottom: 6px;
|
||||
|
||||
Reference in New Issue
Block a user