Commit 2c08bf4f by chenwq

feat(mobile): 添加移动端底部标签栏及相关页面

注册Vant Tabbar相关组件,封装全局底部标签栏组件。新增业绩概览、我的任务两个空白页面,配置路由元信息控制标签栏显示时机,调整团队工作台页面布局适配底部安全区域与标签栏间距。
1 parent a216ccdf
...@@ -9,12 +9,20 @@ ...@@ -9,12 +9,20 @@
<transition name="fade"> <transition name="fade">
<router-view v-if="!$route.meta.keepAlive"></router-view> <router-view v-if="!$route.meta.keepAlive"></router-view>
</transition> </transition>
<!-- 底部全局 TabBar -->
<tab-bar v-if="$route.meta.showTabBar"></tab-bar>
</template> </template>
</div> </div>
</template> </template>
<script> <script>
import TabBar from '@/components/tabBar/index.vue'
export default { export default {
name: 'App', name: 'App',
components: {
TabBar
},
data() { data() {
return { return {
showWindow: false showWindow: false
...@@ -41,4 +49,4 @@ export default { ...@@ -41,4 +49,4 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
</style>
\ No newline at end of file \ No newline at end of file
</style>
<template>
<van-tabbar route active-color="#2C66F7" inactive-color="#999999" safe-area-inset-bottom>
<van-tabbar-item
v-for="(item, index) in tabList"
:key="index"
replace
:to="item.to"
>
<span>{{ item.title }}</span>
<template #icon="props">
<img :src="props.active ? item.activeIcon : item.inactiveIcon" />
</template>
</van-tabbar-item>
</van-tabbar>
</template>
<script>
export default {
name: 'TabBar',
data() {
const baseUrl = 'https://img02.glsx.com.cn/weapp/resource/supervisor-wecom/'
return {
tabList: [
{
title: '团队工作台',
to: '/teamWork/teamList',
activeIcon: baseUrl + 'tab-home-active.png',
inactiveIcon: baseUrl + 'tab-home.png'
},
{
title: '业绩概览',
to: '/performance/overview',
activeIcon: baseUrl + 'tab-view-active.png',
inactiveIcon: baseUrl + 'tab-view.png'
},
{
title: '我的任务',
to: '/mine/tasks',
activeIcon: baseUrl + 'tab-mine-active.png',
inactiveIcon: baseUrl + 'tab-mine.png'
}
]
}
}
}
</script>
<style lang="scss" scoped>
/* van-tabbar-item 默认图标大小比较小,我们稍微调整大一点点确保和设计图相似 */
:deep(.van-tabbar-item__icon img) {
height: 24px;
}
</style>
...@@ -27,7 +27,9 @@ import { ...@@ -27,7 +27,9 @@ import {
CellGroup, CellGroup,
Loading, Loading,
Sticky, Sticky,
Calendar Calendar,
Tabbar,
TabbarItem
} from 'vant' } from 'vant'
// 导出一个函数,接收一个app参数,在函数中注册组件 // 导出一个函数,接收一个app参数,在函数中注册组件
export function vant(app) { export function vant(app) {
...@@ -60,4 +62,6 @@ export function vant(app) { ...@@ -60,4 +62,6 @@ export function vant(app) {
app.use(Loading) app.use(Loading)
app.use(Sticky) app.use(Sticky)
app.use(Calendar) app.use(Calendar)
app.use(Tabbar)
app.use(TabbarItem)
} }
...@@ -4,11 +4,32 @@ export const mobilePages = { ...@@ -4,11 +4,32 @@ export const mobilePages = {
name: 'teamWork/teamList', name: 'teamWork/teamList',
path: '/teamWork/teamList', path: '/teamWork/teamList',
meta: { meta: {
title: '团队工作台' title: '团队工作台',
showTabBar: true
}
}
],
performance: [
{
name: 'performance/overview',
path: '/performance/overview',
meta: {
title: '业绩概览',
showTabBar: true
}
}
],
mine: [
{
name: 'mine/tasks',
path: '/mine/tasks',
meta: {
title: '我的任务',
showTabBar: true
} }
} }
] ]
// recruitManage: [ }
// { // {
// name: 'recruitManage/recruitManage', // name: 'recruitManage/recruitManage',
// path: '/recruitManage/recruitManage', // path: '/recruitManage/recruitManage',
...@@ -45,4 +66,3 @@ export const mobilePages = { ...@@ -45,4 +66,3 @@ export const mobilePages = {
// } // }
// } // }
// ] // ]
}
<template>
<div class="page-container">
<van-empty description="我的任务开发中..." />
</div>
</template>
<script>
export default {
name: 'MineTasks'
}
</script>
<style lang="scss" scoped>
.page-container {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #f2f3f7;
box-sizing: border-box;
padding-bottom: calc(50px + env(safe-area-inset-bottom));
}
</style>
<template>
<div class="page-container">
<van-empty description="业绩概览开发中..." />
</div>
</template>
<script>
export default {
name: 'PerformanceOverview'
}
</script>
<style lang="scss" scoped>
.page-container {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #f2f3f7;
box-sizing: border-box;
padding-bottom: calc(50px + env(safe-area-inset-bottom));
}
</style>
...@@ -328,9 +328,13 @@ export default { ...@@ -328,9 +328,13 @@ export default {
/* 样式保留了原小程序的结构,单位已根据 1px = 2rpx 进行换算 */ /* 样式保留了原小程序的结构,单位已根据 1px = 2rpx 进行换算 */
.team-list-page { .team-list-page {
background: #f2f3f7; background: #f2f3f7;
min-height: 100vh; height: 100vh;
display: flex;
flex-direction: column;
position: relative; position: relative;
// padding-bottom: env(safe-area-inset-bottom); overflow: hidden;
box-sizing: border-box;
padding-bottom: calc(50px + env(safe-area-inset-bottom));
} }
.navigation-header { .navigation-header {
:deep(.van-nav-bar__title) { :deep(.van-nav-bar__title) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!