智慧教务系统UniApp前端项目(使用中2025-0517)
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.
 
 
 
 
 

156 lines
5.1 KiB

<!--底部Tabber组件-->
<template>
<view class="main_box">
<fui-tabbar :tabBar="tabBar" :current="tabBerIndex" @click="openView"></fui-tabbar>
</view>
</template>
<script>
import fuiTabbar from "@/components/firstui/fui-tabbar/fui-tabbar.vue"
export default {
name: "AQTabber",
components:{
fuiTabbar
},
data() {
return {
userType:'1',//用户类型|1=教练,2=销售,3=学员
tabBerIndex:'0',
tabBar: []
};
},
created(){
console.log(123)
this.init()
},
methods: {
async init(){
uni.setStorageSync('userType','1')
let userType = uni.getStorageSync('userType')
this.userType = userType
let tabBerIndex = uni.getStorageSync('tabBerIndex')
if(tabBerIndex){
this.tabBerIndex = String(tabBerIndex)
}else{
this.tabBerIndex = '0'
}
switch (String(this.userType)){
case "1"://教练
this.tabBar = [
{
text: "首页",
urlPath:'/pages/coach/home/index',//自定义页面跳转路径
iconPath: "/static/images/tabbar/home.png",
selectedIconPath: "/static/images/tabbar/home_selected.png"
},
{
text: "课表",
urlPath:'/pages/student/timetable/index',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "班级",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "我的",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
}
]
break;
case "2"://销售
this.tabBar = [
{
text: "首页",
urlPath:'/pages/student/index/index',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "线索",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "添加",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png",
midButton: true,
width: 96,
height: 96
},
{
text: "数据",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "我的",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
}
]
break;
case "3"://学员
this.tabBar = [
{
text: "首页",
urlPath:'/pages/student/index/index',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "课表",
urlPath:'/pages/student/timetable/index',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
},
{
text: "我的",
urlPath:'/pages/student/my/my',//自定义页面跳转路径
iconPath: "/static/images/tabbar/my.png",
selectedIconPath: "/static/images/tabbar/my.png"
}
]
break;
}
},
openView(e){
console.log('点击跳转',e)
//跳转tabBar页面
uni.setStorageSync('tabBerIndex',e.index)
console.log('qqq',e.urlPath)
uni.navigateTo({
url:e.urlPath
})
},
}
}
</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 */
}
</style>