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