feat(报餐): 新增报餐功能模块并更新版本号至1.3.27
- 添加报餐页面及相关API接口 - 实现报餐统计功能,包括有效/无效报餐人数计算 - 新增自定义时间选择器组件 - 更新应用版本号至1.3.27 - 调整角色权限控制,新增食堂角色权限配置
This commit is contained in:
@@ -5,7 +5,12 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
hasJumped: false // 防止重复跳转的标记
|
||||
tabVisible: {
|
||||
admin: [true, true, true, true, true, true],
|
||||
canteen: [false, false, false, false, true, true],
|
||||
worker: [false, true, true, true, false, true]
|
||||
},
|
||||
hasJumped: false, // 防止重复跳转的标记
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
@@ -25,10 +30,13 @@ export default {
|
||||
const roles = res.data.roles;
|
||||
|
||||
if (roles.includes('admin')) {
|
||||
uni.setTabBarItem({
|
||||
index: 0,
|
||||
visible: true
|
||||
});
|
||||
for (let i = 0; i < this.tabVisible.admin.length; i++) {
|
||||
const v = this.tabVisible.admin[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// 管理员角色跳转
|
||||
uni.switchTab({
|
||||
url: '/pages/line/line',
|
||||
@@ -44,14 +52,48 @@ export default {
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (roles.includes('canteen')) {
|
||||
for (let i = 0; i < this.tabVisible.canteen.length; i++) {
|
||||
const v = this.tabVisible.canteen[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// 食堂角色跳转
|
||||
uni.switchTab({
|
||||
url: '/pages/meal/meal',
|
||||
success: () => {
|
||||
this.hasJumped = true; // 标记已跳转
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('管理员页面跳转失败:', err);
|
||||
uni.showToast({
|
||||
title: '跳转产线页面失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (roles.includes('worker')) {
|
||||
// 工人角色跳转
|
||||
// 设置tab内容
|
||||
// 设置产线和复杂扫码不可见
|
||||
uni.setTabBarItem({
|
||||
index: 0,
|
||||
visible: false
|
||||
});
|
||||
for (let i = 0; i < this.tabVisible.worker.length; i++) {
|
||||
const v = this.tabVisible.worker[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// uni.setTabBarItem({
|
||||
// index: 0,
|
||||
// visible: false
|
||||
// });
|
||||
// uni.setTabBarItem({
|
||||
// index: 4,
|
||||
// visible: false
|
||||
// });
|
||||
uni.switchTab({
|
||||
url: '/pages/easycode/easycode',
|
||||
success: () => {
|
||||
@@ -68,15 +110,18 @@ export default {
|
||||
});
|
||||
} else {
|
||||
// 处理未定义角色(默认角色)
|
||||
uni.showToast({
|
||||
title: '检测到未知角色,将跳转至默认页面',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
uni.setTabBarItem({
|
||||
index: 0,
|
||||
visible: false
|
||||
});
|
||||
// uni.showToast({
|
||||
// title: '检测到未知角色,将跳转至默认页面',
|
||||
// icon: 'none',
|
||||
// duration: 2000
|
||||
// });
|
||||
for (let i = 0; i < this.tabVisible.worker.length; i++) {
|
||||
const v = this.tabVisible.worker[i]
|
||||
uni.setTabBarItem({
|
||||
index: i,
|
||||
visible: v
|
||||
});
|
||||
}
|
||||
// 延迟跳转,确保提示被用户看到
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
|
||||
Reference in New Issue
Block a user