|
|
@ -1,8 +1,8 @@ |
|
|
|
<template> |
|
|
|
<view class="tab-bar"> |
|
|
|
<view v-for="(item,index) in list" :key="index" class="tab-bar-item" @click="switchTab(item, index)"> |
|
|
|
<image class="tab_img" :src="currentIndex == index ? item.selectedIconPath : item.iconPath"></image> |
|
|
|
<view class="tab_text" :style="{color: currentIndex == index ? selectedColor : color}">{{item.text}}</view> |
|
|
|
<image class="tab_img" :src="name == item.text ? item.selectedIconPath : item.iconPath"></image> |
|
|
|
<view class="tab_text" :style="{color: name == item.text ? selectedColor : color}">{{item.text}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -10,75 +10,110 @@ |
|
|
|
<script> |
|
|
|
export default { |
|
|
|
props: { |
|
|
|
selectedIndex: { // 当前选中的tab index |
|
|
|
name: { // 当前选中的tab index |
|
|
|
default: 0 |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
color: "#666666", |
|
|
|
selectedColor: "#00BAB2", |
|
|
|
color: "#999", |
|
|
|
selectedColor: "#218DFF", |
|
|
|
list: [], |
|
|
|
currentIndex:0, |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.currentIndex = this.selectedIndex; |
|
|
|
this.currentName = this.name; |
|
|
|
|
|
|
|
var _this = this |
|
|
|
|
|
|
|
if (uni.getStorageSync('identify') == 'nurse') { |
|
|
|
//护士 |
|
|
|
_this.list = [ |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/index/index", |
|
|
|
"text": "首页", |
|
|
|
"iconPath": "/static/images/tabbar/sy.png", |
|
|
|
"selectedIconPath": "/static/images/tabbar/syActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/question/index", |
|
|
|
"text": "题库", |
|
|
|
"iconPath": "/static/images/tabbar/tk.png", |
|
|
|
"selectedIconPath": "/static/images/tabbar/tkActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/mine/index", |
|
|
|
"text": "我的", |
|
|
|
"iconPath": "/static/images/tabbar/wd.png", |
|
|
|
"selectedIconPath": "/static/images/tabbar/wdActive.png" |
|
|
|
} |
|
|
|
] |
|
|
|
} else { |
|
|
|
//医管 |
|
|
|
|
|
|
|
|
|
|
|
if (uni.getStorageSync('identity') == '1') { |
|
|
|
//教练 |
|
|
|
_this.list = [{ |
|
|
|
"pagePath": "/pages/tabbar/index/index", |
|
|
|
"text": "首1页", |
|
|
|
"iconPath": "/static/images/tabbar/sy.png", |
|
|
|
"selectedIconPath": "/static/images/tabbar/syActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/question/index", |
|
|
|
"text": "题2库", |
|
|
|
"iconPath": "/static/images/tabbar/tk.png", |
|
|
|
"selectedIconPath": "/static/images/tabbar/tkActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/mine/index", |
|
|
|
"text": "我3的", |
|
|
|
"iconPath": "/static/images/tabbar/wd.png", |
|
|
|
"selectedIconPath": "/static/images/tabbar/wdActive.png" |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
"pagePath": "/pages/tabbar/statistics/index", |
|
|
|
"text": "首页", |
|
|
|
"iconPath": "../../static/images/tabbar/tj.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/tjActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/examSimulation/index", |
|
|
|
"text": "考场模拟", |
|
|
|
"iconPath": "../../static/images/tabbar/kc.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/kcActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/operateTrain/index", |
|
|
|
"text": "实操训练", |
|
|
|
"iconPath": "../../static/images/tabbar/sc.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/scActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/student/index", |
|
|
|
"text": "学员", |
|
|
|
"iconPath": "../../static/images/tabbar/xy.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/xyActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/mine/index", |
|
|
|
"text": "我的", |
|
|
|
"iconPath": "../../static/images/tabbar/wd.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/wdActive.png" |
|
|
|
} |
|
|
|
] |
|
|
|
} else if(uni.getStorageSync('identity') == '2') { |
|
|
|
//校长 |
|
|
|
_this.list = [{ |
|
|
|
"pagePath": "/pages/tabbar/statistics/index", |
|
|
|
"text": "统计", |
|
|
|
"iconPath": "../../static/images/tabbar/tj.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/tjActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/student/index", |
|
|
|
"text": "学员", |
|
|
|
"iconPath": "../../static/images/tabbar/xy.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/xyActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/mine/index", |
|
|
|
"text": "我的", |
|
|
|
"iconPath": "../../static/images/tabbar/wd.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/wdActive.png" |
|
|
|
} |
|
|
|
] |
|
|
|
}else { |
|
|
|
_this.list = [{ |
|
|
|
"pagePath": "/pages/tabbar/statistics/index", |
|
|
|
"text": "统计", |
|
|
|
"iconPath": "../../static/images/tabbar/tj.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/tjActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/examSimulation/index", |
|
|
|
"text": "预约记录", |
|
|
|
"iconPath": "../../static/images/tabbar/xy.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/xyActive.png" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"pagePath": "/pages/tabbar/mine/index", |
|
|
|
"text": "我的", |
|
|
|
"iconPath": "../../static/images/tabbar/wd.png", |
|
|
|
"selectedIconPath": "../../static/images/tabbar/wdActive.png" |
|
|
|
}] |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
switchTab(item, index) { |
|
|
|
this.currentIndex = index; |
|
|
|
this.currentName = item.text; |
|
|
|
|
|
|
|
let url = item.pagePath; |
|
|
|
console.log(url) |
|
|
|
uni.reLaunch({url:url}) |
|
|
|
uni.switchTab({ |
|
|
|
url |
|
|
|
}) |
|
|
|
// uni.reLaunch({url:url}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|