123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { useLoginUserStore } from '@/stores/loginUser'
- const loginUserStore = useLoginUserStore();
- export function useSetTabbar() {
- /**
- * 设置tabbar
- */
- const setTabbar = (index) => {
- let flag = false;
-
- switch(index){
- case 0:
- // 故障
- if(loginUserStore.loginUser.user.engineer == 1){
- flag = true;
- }
- break;
- case 1:
- // 巡检
- if(loginUserStore.loginUser.user.engineer == 0){
- flag = false;
- }else if(loginUserStore.loginUser.menu.some(v => v.link === 'app.inspection.inspectList')){
- flag = true;
- }
- break;
- case 2:
- // 我的报修
- if(loginUserStore.loginUser.user.engineer == 0){
- flag = true;
- }else{
- flag = true;
- }
- break;
- case 3:
- // 我的
- if(loginUserStore.loginUser.user.engineer == 1){
- flag = true;
- }else{
- flag = false;
- }
- break;
- case 4:
- // 设置
- if(loginUserStore.loginUser.user.engineer == 0){
- flag = true;
- }else{
- flag = false;
- }
- break;
- }
-
- uni.setTabBarItem({
- index,
- visible: flag,
- });
- }
- return {
- setTabbar
- };
- }
|