You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
// 判断用户端不同tabbar
|
|
function ifTabbar() {
|
|
let roleId = uni.getStorageSync("roleId");
|
|
if (roleId == 0) {
|
|
// uni.setTabBarItem({
|
|
// index: 0,
|
|
// pagePath: "pages/company-home/index",
|
|
// iconPath: "static/images/tabbar/home.png",
|
|
// selectedIconPath: "static/images/tabbar/home_.png",
|
|
// });
|
|
// uni.setTabBarItem({
|
|
// index: 1,
|
|
// pagePath: "pages/company-mine/index",
|
|
// iconPath: "static/images/tabbar/mine.png",
|
|
// selectedIconPath: "static/images/tabbar/mine_.png",
|
|
// });
|
|
// 动态隐藏,根据角色
|
|
uni.setTabBarItem({
|
|
index: 2, //从左到右 0开始
|
|
visible: false, //默认true false隐藏
|
|
});
|
|
uni.setTabBarItem({
|
|
index: 3, //从左到右 0开始
|
|
visible: false, //默认true false隐藏
|
|
});
|
|
} else if (roleId == 1) {
|
|
// uni.setTabBarItem({
|
|
// index: 0,
|
|
// pagePath: "pages/public-home/index",
|
|
// iconPath: "static/images/liao-ning/tab-home-n.png",
|
|
// selectedIconPath: "static/images/liao-ning/tab-home-s.png",
|
|
// });
|
|
// uni.setTabBarItem({
|
|
// index: 1,
|
|
// pagePath: "pages/public-mine/index",
|
|
// iconPath: "static/images/liao-ning/tab-mine-n.png",
|
|
// selectedIconPath: "static/images/liao-ning/tab-mine-s.png",
|
|
// });
|
|
// // 动态隐藏,根据角色
|
|
uni.setTabBarItem({
|
|
index: 0, //从左到右 0开始
|
|
visible: false, //默认true false隐藏
|
|
});
|
|
uni.setTabBarItem({
|
|
index: 1, //从左到右 0开始
|
|
visible: false, //默认true false隐藏
|
|
});
|
|
}
|
|
}
|
|
// 还原tabbar
|
|
function reTabbar() {
|
|
for (let i = 0; i < 4; i++) {
|
|
uni.setTabBarItem({
|
|
index: i, //从左到右 0开始
|
|
visible: true, //默认true false隐藏
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
ifTabbar,
|
|
reTabbar,
|
|
};
|