适配微信小程序
This commit is contained in:
@@ -54,13 +54,6 @@ Component({
|
||||
iconPath: '/static/tabbar/customer.png',
|
||||
selectedIconPath: '/static/tabbar/customer_active.png',
|
||||
},
|
||||
{
|
||||
key: 'ai_analysis',
|
||||
text: 'AI分析',
|
||||
pagePath: 'pages/ai_analysis/ai_analysis',
|
||||
iconPath: '/static/tabbar/ai_analysis.png',
|
||||
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
|
||||
},
|
||||
{
|
||||
key: 'workbench',
|
||||
text: '工作台',
|
||||
@@ -283,7 +276,6 @@ Component({
|
||||
'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 +503,7 @@ Component({
|
||||
const hasFurnitureRole = roles.includes('furniture');
|
||||
|
||||
if (isAdminFurniture || hasFurnitureRole) {
|
||||
const furnitureTabs = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
const furnitureTabs = ['workbench', 'ucenter'];
|
||||
console.log('[TabBar][allowed] furniture/admin_furniture role ->', furnitureTabs);
|
||||
return furnitureTabs;
|
||||
}
|
||||
|
||||
@@ -77,13 +77,6 @@ export default {
|
||||
iconPath: '/static/tabbar/team.png',
|
||||
selectedIconPath: '/static/tabbar/team_active.png',
|
||||
},
|
||||
{
|
||||
key: 'ai_analysis',
|
||||
text: 'AI分析',
|
||||
pagePath: '/pages/ai_analysis/ai_analysis',
|
||||
iconPath: '/static/tabbar/ai_analysis.png',
|
||||
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
|
||||
},
|
||||
{
|
||||
key: 'meeting_summary',
|
||||
text: '总结和统计',
|
||||
@@ -96,15 +89,8 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
furnitureTabs() {
|
||||
// 与 pages.json 的 tabBar 一致:AI分析、工作台、我的
|
||||
// 与 pages.json 的 tabBar 一致:工作台、我的
|
||||
return [
|
||||
{
|
||||
key: 'ai_analysis',
|
||||
text: 'AI分析',
|
||||
pagePath: '/pages/ai_analysis/ai_analysis',
|
||||
iconPath: '/static/tabbar/ai_analysis.png',
|
||||
selectedIconPath: '/static/tabbar/ai_analysis_active.png',
|
||||
},
|
||||
{
|
||||
key: 'workbench',
|
||||
text: '工作台',
|
||||
@@ -127,7 +113,7 @@ export default {
|
||||
console.log('VISIBLE TABS CALC - THIS MUST SHOW IN H5');
|
||||
|
||||
// 简化逻辑:直接返回家具相关的tabs,跳过权限检查
|
||||
const furnitureKeys = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
const furnitureKeys = ['workbench', 'ucenter'];
|
||||
const result = furnitureKeys.map(key => {
|
||||
return this.allTabs.find(tab => tab.key === key);
|
||||
}).filter(Boolean);
|
||||
@@ -282,15 +268,15 @@ export default {
|
||||
console.log('GET ALLOWED KEYS - 简化版本,总是返回家具相关tabs');
|
||||
|
||||
// 简化逻辑:总是返回家具相关的tabs
|
||||
const furnitureTabs = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
const furnitureTabs = ['workbench', 'ucenter'];
|
||||
console.log('[TabBar][allowed] 简化逻辑 ->', furnitureTabs);
|
||||
return furnitureTabs;
|
||||
},
|
||||
// #ifdef H5
|
||||
toggleNativeTabs() {
|
||||
// H5 平台自定义 tabbar 不生效,直接根据角色显隐原生 tabbar 项
|
||||
// 当前位置顺序(与 pages.json 的 tabBar.list 一致):AI分析、工作台、我的…
|
||||
const ORDER = ['ai_analysis', 'workbench', 'ucenter', 'reception', 'customer', 'team', 'meeting_summary', 'common_begin_reception'];
|
||||
// 当前位置顺序(与 pages.json 的 tabBar.list 一致):工作台、我的…
|
||||
const ORDER = ['workbench', 'ucenter', 'reception', 'customer', 'team', 'meeting_summary', 'common_begin_reception'];
|
||||
const allowed = this.getAllowedKeys();
|
||||
// 限制重试次数,防止渲染时机未就绪
|
||||
this._h5TabRetries = (this._h5TabRetries || 0) + 1;
|
||||
@@ -319,7 +305,6 @@ export default {
|
||||
isInTabBar(pagePath) {
|
||||
// 检查页面路径是否在原生tabBar配置中
|
||||
const tabBarList = [
|
||||
'pages/ai_analysis/ai_analysis',
|
||||
'pages/workbench/workbench',
|
||||
'pages/ucenter/ucenter',
|
||||
];
|
||||
@@ -359,7 +344,6 @@ export default {
|
||||
const allElements = document.querySelectorAll('*');
|
||||
const tabElements = Array.from(allElements).filter(el =>
|
||||
el.textContent && (
|
||||
el.textContent.includes('AI分析') ||
|
||||
el.textContent.includes('工作台') ||
|
||||
el.textContent.includes('我的')
|
||||
)
|
||||
@@ -397,9 +381,9 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// 按文本内容排序:AI分析、工作台、我的
|
||||
// 按文本内容排序:工作台、我的
|
||||
const sortedElements = tabElements.sort((a, b) => {
|
||||
const order = ['AI分析', '工作台', '我的'];
|
||||
const order = ['工作台', '我的'];
|
||||
const aIndex = order.findIndex(text => a.textContent.includes(text));
|
||||
const bIndex = order.findIndex(text => b.textContent.includes(text));
|
||||
return aIndex - bIndex;
|
||||
@@ -409,7 +393,7 @@ export default {
|
||||
|
||||
// 处理每个元素
|
||||
sortedElements.forEach((element, index) => {
|
||||
const keyMap = ['ai_analysis', 'workbench', 'ucenter'];
|
||||
const keyMap = ['workbench', 'ucenter'];
|
||||
const key = keyMap[index];
|
||||
const shouldShow = allowed.includes(key);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user