157 lines
3.3 KiB
Vue
157 lines
3.3 KiB
Vue
<script lang="ts">
|
|
// import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"
|
|
// onLaunch(() => {})
|
|
// onShow(() => {})
|
|
// onHide(() => {})
|
|
|
|
// zhezhengding:浙政钉 | shihua:诗画
|
|
const tabbar = [
|
|
{
|
|
pagePath: "pages/tabbar/canteen",
|
|
text: "食堂",
|
|
iconPath: "/static/tabbar/canteen.png",
|
|
selectedIconPath: "/static/tabbar/canteen-select.png",
|
|
auth: ["zhezhengding", "shihua"],
|
|
},
|
|
{
|
|
pagePath: "pages/tabbar/shop",
|
|
text: "超市",
|
|
iconPath: "/static/tabbar/shop.png",
|
|
selectedIconPath: "/static/tabbar/shop-select.png",
|
|
auth: ["zhezhengding", "shihua"],
|
|
},
|
|
{
|
|
pagePath: "pages/tabbar/coopShop",
|
|
text: "合作商家",
|
|
iconPath: "/static/tabbar/coopShop.png",
|
|
selectedIconPath: "/static/tabbar/coopShop-select.png",
|
|
auth: ["zhezhengding"],
|
|
},
|
|
{
|
|
pagePath: "pages/tabbar/order",
|
|
text: "订单",
|
|
iconPath: "/static/tabbar/order.png",
|
|
selectedIconPath: "/static/tabbar/order-select.png",
|
|
auth: ["zhezhengding"],
|
|
},
|
|
{
|
|
pagePath: "pages/tabbar/flowStatistics",
|
|
text: "流水统计",
|
|
iconPath: "/static/tabbar/order.png",
|
|
selectedIconPath: "/static/tabbar/order-select.png",
|
|
auth: ["shihua"],
|
|
},
|
|
{
|
|
pagePath: "pages/tabbar/individualOrder",
|
|
text: "订单",
|
|
iconPath: "/static/tabbar/order.png",
|
|
selectedIconPath: "/static/tabbar/order-select.png",
|
|
auth: ["shihua"],
|
|
},
|
|
{
|
|
pagePath: "pages/tabbar/my",
|
|
text: "我的",
|
|
iconPath: "/static/tabbar/my.png",
|
|
selectedIconPath: "/static/tabbar/my-select.png",
|
|
auth: ["zhezhengding", "shihua"],
|
|
},
|
|
]
|
|
|
|
export default {
|
|
onLaunch() {},
|
|
onShow() {},
|
|
onHide() {},
|
|
|
|
methods: {
|
|
_initTabbar() {
|
|
console.log("环境判断")
|
|
|
|
let appEnv = 1 // 1:浙政钉 2:诗画
|
|
|
|
switch (appEnv) {
|
|
case 1:
|
|
tabbar.forEach(({ pagePath, text, iconPath, selectedIconPath, auth }, index) => {
|
|
if (auth.includes("zhezhengding")) {
|
|
uni.setTabBarItem({
|
|
index,
|
|
pagePath,
|
|
text,
|
|
iconPath,
|
|
selectedIconPath,
|
|
visible: true,
|
|
})
|
|
} else {
|
|
uni.setTabBarItem({
|
|
index,
|
|
pagePath,
|
|
text,
|
|
iconPath,
|
|
selectedIconPath,
|
|
visible: false,
|
|
})
|
|
}
|
|
})
|
|
break
|
|
case 2:
|
|
tabbar.forEach(({ pagePath, text, iconPath, selectedIconPath, auth }, index) => {
|
|
if (auth.includes("shihua")) {
|
|
uni.setTabBarItem({
|
|
index,
|
|
pagePath,
|
|
text,
|
|
iconPath,
|
|
selectedIconPath,
|
|
visible: true,
|
|
})
|
|
} else {
|
|
uni.setTabBarItem({
|
|
index,
|
|
pagePath,
|
|
text,
|
|
iconPath,
|
|
selectedIconPath,
|
|
visible: false,
|
|
})
|
|
}
|
|
})
|
|
break
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import "@/sheep/scss/global.scss";
|
|
@import url(@/uni_modules/tm-ui/css/remixicon.min.css);
|
|
|
|
$theme-green: #06be36;
|
|
$theme-blue: #0094ff;
|
|
$theme-gray: #999;
|
|
|
|
.botder_btn {
|
|
border: 1px solid #999;
|
|
color: #999;
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
border-radius: 10rpx;
|
|
padding: 8rpx 15rpx;
|
|
}
|
|
|
|
.prefix_title {
|
|
font-size: 32rpx;
|
|
font-weight: 500;
|
|
color: #333;
|
|
|
|
&::before {
|
|
content: "";
|
|
display: inline-block;
|
|
width: 8rpx;
|
|
height: 24rpx;
|
|
background: $theme-blue;
|
|
border-radius: 4rpx;
|
|
margin-right: 10rpx;
|
|
}
|
|
}
|
|
</style>
|