2 changed files with 132 additions and 287 deletions
@ -1,137 +1,130 @@ |
|||
<!--底部Tabber组件--> |
|||
<template> |
|||
<view class="main_box"> |
|||
<fui-tabbar :tabBar="tabBar" :current="current" @click="openView"></fui-tabbar> |
|||
<fui-tabbar :tabBar="tabBar" :current="current" @click="openView"></fui-tabbar> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import fuiTabbar from "@/components/firstui/fui-tabbar/fui-tabbar.vue" |
|||
export default { |
|||
components:{ |
|||
fuiTabbar |
|||
}, |
|||
name: 'AQTabber', |
|||
data() { |
|||
return { |
|||
userType:'',//用户类型|1=教练,2=销售,3=学员 |
|||
current:'0', |
|||
tabBar: [] |
|||
userType: '', //用户类型|1=教练,2=销售,3=学员 |
|||
current: '0', |
|||
tabBar: [] |
|||
}; |
|||
}, |
|||
onShow(){ |
|||
//设置缓存 |
|||
uni.setStorageSync('userType',1) |
|||
//获取缓存 |
|||
this.userType = uni.getStorageSync('userType') |
|||
this.init() |
|||
}, |
|||
|
|||
created() { |
|||
//设置缓存 |
|||
uni.setStorageSync('userType', 1) |
|||
//获取缓存 |
|||
this.userType = uni.getStorageSync('userType') |
|||
this.init() |
|||
}, |
|||
methods: { |
|||
async init(){ |
|||
switch (String(this.userType)){ |
|||
case "1"://教练 |
|||
this.tabBar = [ |
|||
{ |
|||
text: "首页", |
|||
urlPath:'pages/student/index/index',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "课表", |
|||
urlPath:'pages/student/timetable/index',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "班级", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "我的", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
} |
|||
] |
|||
break; |
|||
case "2"://销售 |
|||
this.tabBar = [ |
|||
{ |
|||
text: "首页", |
|||
urlPath:'pages/student/index/index',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "线索", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "添加", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png", |
|||
midButton: true, |
|||
width: 96, |
|||
height: 96 |
|||
}, |
|||
{ |
|||
text: "数据", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "我的", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
} |
|||
] |
|||
break; |
|||
case "3"://学员 |
|||
this.tabBar = [ |
|||
{ |
|||
text: "首页", |
|||
urlPath:'pages/student/index/index',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "课表", |
|||
urlPath:'pages/student/timetable/index',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "我的", |
|||
urlPath:'pages/student/my/my',//自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
} |
|||
] |
|||
break; |
|||
} |
|||
}, |
|||
async init() { |
|||
switch (String(this.userType)) { |
|||
case "1": //教练 |
|||
this.tabBar = [{ |
|||
text: "首页", |
|||
urlPath: 'pages/student/index/index', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/home.png", |
|||
selectedIconPath: "/static/images/tabbar/home_selected.png" |
|||
}, |
|||
{ |
|||
text: "课表", |
|||
urlPath: 'pages/student/timetable/index', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "班级", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "我的", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
} |
|||
] |
|||
break; |
|||
case "2": //销售 |
|||
this.tabBar = [{ |
|||
text: "首页", |
|||
urlPath: 'pages/student/index/index', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "线索", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "添加", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png", |
|||
midButton: true, |
|||
width: 96, |
|||
height: 96 |
|||
}, |
|||
{ |
|||
text: "数据", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "我的", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
} |
|||
] |
|||
break; |
|||
case "3": //学员 |
|||
this.tabBar = [{ |
|||
text: "首页", |
|||
urlPath: 'pages/student/index/index', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "课表", |
|||
urlPath: 'pages/student/timetable/index', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
}, |
|||
{ |
|||
text: "我的", |
|||
urlPath: 'pages/student/my/my', //自定义页面跳转路径 |
|||
iconPath: "/static/images/tabbar/assembly_default_3x.png", |
|||
selectedIconPath: "/static/images/tabbar/assembly_selected_3x.png" |
|||
} |
|||
] |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
openView(e){ |
|||
console.log('点击跳转',e) |
|||
}, |
|||
openView(e) { |
|||
console.log('点击跳转', e) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.fui-wrap { |
|||
//为防止标签栏遮住页面内容,页面底部需留白高度不低于标签栏高度。非Nvue端和头条小程序如果fixedHeight属性没有设置为true,则页面外层还需加入以下样式(或者在页面最底部加入`fui-safe-area` 组件)兼容异形屏: |
|||
/* #ifndef APP-NVUE */ |
|||
padding-bottom: constant(safe-area-inset-bottom); |
|||
padding-bottom: env(safe-area-inset-bottom); |
|||
/* #endif */ |
|||
} |
|||
.fui-wrap { |
|||
//为防止标签栏遮住页面内容,页面底部需留白高度不低于标签栏高度。非Nvue端和头条小程序如果fixedHeight属性没有设置为true,则页面外层还需加入以下样式(或者在页面最底部加入`fui-safe-area` 组件)兼容异形屏: |
|||
/* #ifndef APP-NVUE */ |
|||
padding-bottom: constant(safe-area-inset-bottom); |
|||
padding-bottom: env(safe-area-inset-bottom); |
|||
/* #endif */ |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue