重构前端代码架构, 完善我的内容区
This commit is contained in:
29
App.vue
29
App.vue
@@ -98,6 +98,10 @@
|
||||
const isStudent = roles.includes('speaking_training_students');
|
||||
const isAdmin = roles.includes('admin');
|
||||
const isMeetingAdmin = roles.includes('meeting_admin');
|
||||
const isAdminFurniture = roles.includes('admin_furniture');
|
||||
|
||||
// 检查是否有任何角色名等于 "furniture" 字符串(精确匹配)
|
||||
const hasFurnitureRole = roles.includes('furniture');
|
||||
|
||||
// 会议相关的tab标签
|
||||
const meetingTabLabels = ['总结和统计'];
|
||||
@@ -107,23 +111,36 @@
|
||||
const otherHidden = ['作业', '教务', '语音', '表达'];
|
||||
|
||||
// tabBar 顺序(根据 pages.json 中的 tabBar.list 顺序)
|
||||
// 0: 接待, 1: 客户, 2: 团队, 3: 销冠, 4: 工作台, 5: 我的(ucenter)
|
||||
// 6: 总结和统计
|
||||
const meetingTabIndices = [6]; // 会议相关tab的索引位置
|
||||
// 0: 接待, 1: 客户, 2: 团队
|
||||
// 3: 总结和统计, 4: 接待(furniture_reception), 5: 开始接待(common_begin_reception), 6: 客户(furniture_customer), 7: 销冠(furniture_top_sales), 8: 我的(ucenter)
|
||||
const meetingTabIndices = [3]; // 会议相关tab的索引位置
|
||||
const furnitureTabIndices = [4, 6, 7]; // 家具相关tab的索引位置(接待、客户、销冠)
|
||||
const ucenterIndex = 8; // "我的"(ucenter)的索引位置
|
||||
|
||||
const shouldShow = (label, index) => {
|
||||
// 任何角色都应该能看到"我的"(ucenter)
|
||||
// 任何角色都应该能看到"我的"(ucenter,索引8)
|
||||
if (label === '我的') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// admin_furniture 和 furniture 角色:显示 furniture_reception, furniture_customer, furniture_top_sales 和 ucenter
|
||||
if (isAdminFurniture || hasFurnitureRole) {
|
||||
// 显示家具相关的tab(索引4, 6, 7)和"我的"(索引8)
|
||||
return furnitureTabIndices.includes(index) || index === ucenterIndex;
|
||||
}
|
||||
|
||||
// 隐藏"接待"和"客户"这两个tab(索引0和1)
|
||||
if (label === '接待' || label === '客户') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// meeting_admin 角色:显示会议相关的tab和"我的"
|
||||
if (isMeetingAdmin) {
|
||||
return meetingTabIndices.includes(index);
|
||||
}
|
||||
|
||||
// 非 meeting_admin 角色:隐藏所有会议相关的tab
|
||||
if (meetingTabIndices.includes(index)) {
|
||||
// 非 meeting_admin 角色:隐藏所有会议相关的tab和家具相关的tab
|
||||
if (meetingTabIndices.includes(index) || furnitureTabIndices.includes(index)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user