修正用户名显示逻辑进入服务列表页面自动刷新

This commit is contained in:
zhonghua.li
2026-04-17 08:12:56 +08:00
parent d74bc2ad1f
commit 18455a311d
14 changed files with 132 additions and 72 deletions

View File

@@ -40,13 +40,6 @@ Component({
iconPath: '/static/tabbar/insight.png',
selectedIconPath: '/static/tabbar/insight_active.png',
},
{
key: 'furniture_reception',
text: '接待',
pagePath: 'pages/furniture_reception/furniture_reception',
iconPath: '/static/tabbar/reception.png',
selectedIconPath: '/static/tabbar/reception_active.png',
},
{
key: 'common_begin_reception',
text: '开始接待',
@@ -68,6 +61,13 @@ Component({
iconPath: '/static/tabbar/ai_analysis.png',
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
},
{
key: 'workbench',
text: '工作台',
pagePath: 'pages/workbench/workbench',
iconPath: '/static/tabbar/team.png',
selectedIconPath: '/static/tabbar/team_active.png',
},
{
key: 'furniture_top_sales',
text: '销冠',
@@ -280,8 +280,8 @@ Component({
'team': 'pages/team/team',
'ucenter': 'pages/ucenter/ucenter',
'meeting_summary': 'pages-subpackage/meeting_summary/meeting_summary',
'furniture_reception': 'pages/furniture_reception/furniture_reception',
'common_begin_reception': 'pages/furniture_reception/common_begin_reception',
'workbench': 'pages/workbench/workbench',
'furniture_customer': 'pages-subpackage/furniture_customer/furniture_customer',
'ai_analysis': 'pages/ai_analysis/ai_analysis',
'furniture_top_sales': 'pages/furniture_top_sales/furniture_top_sales'
@@ -511,7 +511,7 @@ Component({
const hasFurnitureRole = roles.includes('furniture');
if (isAdminFurniture || hasFurnitureRole) {
const furnitureTabs = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
const furnitureTabs = ['ai_analysis', 'workbench', 'ucenter'];
console.log('[TabBar][allowed] furniture/admin_furniture role ->', furnitureTabs);
return furnitureTabs;
}

View File

@@ -34,13 +34,6 @@ export default {
roles: [],
currentPath: '',
allTabs: [
{
key: 'furniture_reception',
text: '接待',
pagePath: '/pages/furniture_reception/furniture_reception',
iconPath: '/static/tabbar/reception.png',
selectedIconPath: '/static/tabbar/reception_active.png',
},
{
key: 'furniture_customer',
text: '客户',
@@ -77,6 +70,13 @@ export default {
iconPath: '/static/tabbar/me.png',
selectedIconPath: '/static/tabbar/me_active.png',
},
{
key: 'workbench',
text: '工作台',
pagePath: '/pages/workbench/workbench',
iconPath: '/static/tabbar/team.png',
selectedIconPath: '/static/tabbar/team_active.png',
},
{
key: 'ai_analysis',
text: 'AI分析',
@@ -96,36 +96,29 @@ export default {
},
computed: {
furnitureTabs() {
// 强制返回所有家具角色的tab使用与pages.json相同的路径格式
// 与 pages.json 的 tabBar 一致AI分析、工作台、我的
return [
{
key: 'furniture_reception',
text: '接待',
pagePath: 'pages/furniture_reception/furniture_reception', // 移除开头的/
iconPath: '/static/tabbar/reception.png',
selectedIconPath: '/static/tabbar/reception_active.png',
},
{
key: 'furniture_customer',
text: '客户',
pagePath: 'pages-subpackage/furniture_customer/furniture_customer', // 移除开头的/
iconPath: '/static/tabbar/customer.png',
selectedIconPath: '/static/tabbar/customer_active.png',
},
{
key: 'ai_analysis',
text: 'AI分析',
pagePath: 'pages/ai_analysis/ai_analysis',
pagePath: '/pages/ai_analysis/ai_analysis',
iconPath: '/static/tabbar/ai_analysis.png',
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
},
{
key: 'workbench',
text: '工作台',
pagePath: '/pages/workbench/workbench',
iconPath: '/static/tabbar/team.png',
selectedIconPath: '/static/tabbar/team_active.png',
},
{
key: 'ucenter',
text: '我的',
pagePath: 'pages/ucenter/ucenter', // 移除开头的/
pagePath: '/pages/ucenter/ucenter',
iconPath: '/static/tabbar/me.png',
selectedIconPath: '/static/tabbar/me_active.png',
}
},
];
},
@@ -134,7 +127,7 @@ export default {
console.log('VISIBLE TABS CALC - THIS MUST SHOW IN H5');
// 简化逻辑直接返回家具相关的tabs跳过权限检查
const furnitureKeys = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
const furnitureKeys = ['ai_analysis', 'workbench', 'ucenter'];
const result = furnitureKeys.map(key => {
return this.allTabs.find(tab => tab.key === key);
}).filter(Boolean);
@@ -289,15 +282,15 @@ export default {
console.log('GET ALLOWED KEYS - 简化版本总是返回家具相关tabs');
// 简化逻辑总是返回家具相关的tabs
const furnitureTabs = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
const furnitureTabs = ['ai_analysis', 'workbench', 'ucenter'];
console.log('[TabBar][allowed] 简化逻辑 ->', furnitureTabs);
return furnitureTabs;
},
// #ifdef H5
toggleNativeTabs() {
// H5 平台自定义 tabbar 不生效,直接根据角色显隐原生 tabbar 项
// 当前位置顺序(根据 pages.json 的 tabBar.list 顺序接待、客户、AI分析、我的、团队、总结和统计
const ORDER = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter', 'reception', 'customer', 'team', 'meeting_summary', 'common_begin_reception'];
// 当前位置顺序( pages.json 的 tabBar.list 一致AI分析、工作台、我的
const ORDER = ['ai_analysis', 'workbench', 'ucenter', 'reception', 'customer', 'team', 'meeting_summary', 'common_begin_reception'];
const allowed = this.getAllowedKeys();
// 限制重试次数,防止渲染时机未就绪
this._h5TabRetries = (this._h5TabRetries || 0) + 1;
@@ -326,10 +319,9 @@ export default {
isInTabBar(pagePath) {
// 检查页面路径是否在原生tabBar配置中
const tabBarList = [
'pages/furniture_reception/furniture_reception',
'pages-subpackage/furniture_customer/furniture_customer',
'pages/ai_analysis/ai_analysis',
'pages/ucenter/ucenter'
'pages/workbench/workbench',
'pages/ucenter/ucenter',
];
const normalizedPath = pagePath.startsWith('/') ? pagePath.substring(1) : pagePath;
const result = tabBarList.includes(normalizedPath);
@@ -367,9 +359,8 @@ export default {
const allElements = document.querySelectorAll('*');
const tabElements = Array.from(allElements).filter(el =>
el.textContent && (
el.textContent.includes('接待') ||
el.textContent.includes('客户') ||
el.textContent.includes('AI分析') ||
el.textContent.includes('工作台') ||
el.textContent.includes('我的')
)
);
@@ -406,9 +397,9 @@ export default {
return;
}
// 按文本内容排序:接待、客户、AI分析、我的
// 按文本内容排序AI分析、工作台、我的
const sortedElements = tabElements.sort((a, b) => {
const order = ['接待', '客户', 'AI分析', '我的'];
const order = ['AI分析', '工作台', '我的'];
const aIndex = order.findIndex(text => a.textContent.includes(text));
const bIndex = order.findIndex(text => b.textContent.includes(text));
return aIndex - bIndex;
@@ -418,7 +409,7 @@ export default {
// 处理每个元素
sortedElements.forEach((element, index) => {
const keyMap = ['furniture_reception', 'furniture_customer', 'ai_analysis', 'ucenter'];
const keyMap = ['ai_analysis', 'workbench', 'ucenter'];
const key = keyMap[index];
const shouldShow = allowed.includes(key);