我的页面,完善导航

This commit is contained in:
zhonghua1
2025-12-17 11:31:04 +08:00
parent 0467861168
commit 77ce611583
3 changed files with 102 additions and 15 deletions

View File

@@ -53,13 +53,13 @@ export default {
}, },
mine:{ mine:{
showText: "文字", showText: "文字",
signIn: "普通签到", signIn: "接待",
signInByAd:"看广告签到", signInByAd:"看广告签到",
toEvaluate: "去评分", toEvaluate: "去评分",
readArticles: "阅读过的文章", readArticles: "客户",
myScore: "我的积分", myScore: "团队",
invite: "分销推荐", invite: "分销推荐",
feedback: "问题与反馈", feedback: "销冠",
settings: "设置", settings: "设置",
checkUpdate: "检查更新", checkUpdate: "检查更新",
about: "关于", about: "关于",

View File

@@ -632,7 +632,6 @@ import { getApiUrl } from "@/common/config.js";
}, },
buildServiceStatusItem(record = {}) { buildServiceStatusItem(record = {}) {
if (!record || typeof record !== 'object') { if (!record || typeof record !== 'object') {
console.warn('[buildServiceStatusItem] 记录数据无效:', record);
return null; return null;
} }
@@ -648,7 +647,7 @@ import { getApiUrl } from "@/common/config.js";
tags.push({ text: `项目:${record.projectName}`, color: 'blue' }); tags.push({ text: `项目:${record.projectName}`, color: 'blue' });
} }
const item = { return {
id: record.id || '', id: record.id || '',
staffName: record.salesName || '未分配销售', staffName: record.salesName || '未分配销售',
status: record.syncStatus || '服务中', status: record.syncStatus || '服务中',
@@ -657,9 +656,6 @@ import { getApiUrl } from "@/common/config.js";
tags, tags,
durationText: formattedUpdateTime ? `最近更新时间:${formattedUpdateTime}` : '最近暂无更新时间' durationText: formattedUpdateTime ? `最近更新时间:${formattedUpdateTime}` : '最近暂无更新时间'
}; };
console.log('[buildServiceStatusItem] 构建的列表项:', item);
return item;
}, },
formatDateTime(value) { formatDateTime(value) {
if (!value) { if (!value) {

View File

@@ -13,6 +13,25 @@
<text class="uer-name" v-else>{{$t('mine.notLogged')}}</text> <text class="uer-name" v-else>{{$t('mine.notLogged')}}</text>
</view> </view>
</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 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-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> <uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
@@ -59,6 +78,8 @@
// #endif // #endif
data() { data() {
return { return {
tenantId: '',
loginUserInfo: {},
gridList: [{ gridList: [{
"text": this.$t('mine.showText'), "text": this.$t('mine.showText'),
"icon": "chat" "icon": "chat"
@@ -87,7 +108,7 @@
// #endif // #endif
{ {
"title": this.$t('mine.signIn'), "title": this.$t('mine.signIn'),
"event": 'signIn', "to": '/pages/reception/reception',
"icon": "compose" "icon": "compose"
}, },
// #ifdef APP-PLUS // #ifdef APP-PLUS
@@ -99,13 +120,12 @@
//#endif //#endif
{ {
"title":this.$t('mine.readArticles'), "title":this.$t('mine.readArticles'),
"to": '/pages/ucenter/read-news-log/read-news-log', "to": '/pages/customer/customer',
"icon": "flag" "icon": "flag"
}, },
{ {
"title": this.$t('mine.myScore'), "title": this.$t('mine.myScore'),
"to": '', "to": '/pages/team/team',
"event": 'getScore',
"icon": "paperplane" "icon": "paperplane"
} }
// #ifdef APP // #ifdef APP
@@ -118,7 +138,7 @@
], ],
[{ [{
"title": this.$t('mine.feedback'), "title": this.$t('mine.feedback'),
"to": '/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback', "to": '/pages/champion/champion',
"icon": "help" "icon": "help"
}, { }, {
"title": this.$t('mine.settings'), "title": this.$t('mine.settings'),
@@ -146,6 +166,8 @@
} }
}, },
onLoad() { onLoad() {
// 加载用户信息
this.loadUserInfo()
//#ifdef APP-PLUS //#ifdef APP-PLUS
this.ucenterList[this.ucenterList.length - 2].unshift({ this.ucenterList[this.ucenterList.length - 2].unshift({
title:this.$t('mine.checkUpdate'),// this.this.$t('mine.checkUpdate')"检查更新" title:this.$t('mine.checkUpdate'),// this.this.$t('mine.checkUpdate')"检查更新"
@@ -156,7 +178,10 @@
}) })
//#endif //#endif
}, },
onShow() {}, onShow() {
// 每次显示页面时更新租户信息和登录人信息
this.loadUserInfo()
},
computed: { computed: {
userInfo() { userInfo() {
return store.userInfo return store.userInfo
@@ -174,6 +199,26 @@
} }
}, },
methods: { 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() { toSettings() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/ucenter/settings/settings" url: "/pages/ucenter/settings/settings"
@@ -191,6 +236,19 @@
ucenterListClick(item) { ucenterListClick(item) {
if (!item.to && item.event) { if (!item.to && item.event) {
this[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 {
// 其他页面使用 navigateTouni-list-item 会自动处理,但这里显式处理以确保正确)
uni.navigateTo({
url: item.to
})
}
} }
}, },
async checkVersion() { async checkVersion() {
@@ -407,6 +465,39 @@
height: 40rpx; 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 { .grid {
background-color: #FFFFFF; background-color: #FFFFFF;
margin-bottom: 6px; margin-bottom: 6px;