123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <template>
- <view class="tabbar">
- <view :class="['item',current == 0?'active':'']" @click="currentTab(0)">
- <image v-if="current==0" src="../static/images/home-fill.png" mode=""></image>
- <image v-else src="../static/images/home.png" mode=""></image>
- <view class="name">
- 首页
- </view>
- </view>
- <view v-if="$transformAuth('100202')" :class="['item',current == 1?'active':'']" @click="currentTab(1)">
- <image v-if="current==1" src="../static/images/scheduling-fill.png" mode=""></image>
- <image v-else src="../static/images/scheduling.png" mode=""></image>
- <view class="name">
- 工作
- </view>
- </view>
- <view v-if="$transformAuth('101100')" :class="['item',current == 2?'active':'']" @click="currentTab(2)">
- <image v-if="current==2" src="../static/images/student-fill.png" mode=""></image>
- <image v-else src="../static/images/student.png" mode=""></image>
- <view class="name">
- 学生
- </view>
- </view>
- <view :class="['item',current == 3?'active':'']" @click="currentTab(3)">
- <image v-if="current==3" src="../static/images/active-fill.png" mode=""></image>
- <image v-else src="../static/images/active.png" mode=""></image>
- <view class="name">
- 活动
- </view>
- </view>
- <view :class="['item',current == 4?'active':'']" @click="currentTab(4)">
- <image v-if="current==4" src="../static/images/mine-fill.png" mode=""></image>
- <image v-else src="../static/images/mine.png" mode=""></image>
- <view class="name">
- 我的
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "tabbar",
- props: {
- current: {
- type: Number,
- default: 5
- }
- },
- data() {
- return {
- // current: ''
- roles: [],
- is_monitor: false,
- is_polling: false,
- is_admin: false,
- };
- },
- watch: {
- current() {
- console.log('opopopopop')
- },
- },
- onShow() {
- },
- created() {
- let status = false
- let roles = this.$store.state.vuex_user.roles
- let arr = []
- roles.map(item => {
- arr.push(item.name)
- })
- let index = arr.indexOf('polling')
- if (index >= 0) this.is_polling = true
- let index2 = arr.indexOf('monitor')
- if (index2 >= 0) this.is_monitor = true
- let index3 = arr.indexOf('admin')
- if (index3 >= 0) this.is_admin = true
- console.log(index, index2, index3, 'opopop')
- },
- methods: {
- currentTab(index) {
- console.log(index, 'opopopo')
- // this.current = index
- if (index == 0) {
- uni.reLaunch({
- url: '/pages/index/index'
- })
- } else if (index == 1) {
- console.log(index, 'opopop')
- uni.reLaunch({
- url: '/pages/scheduling/index'
- })
- } else if (index == 2) {
- uni.reLaunch({
- url: '/pages/student/index_new'
- })
- }
- else if (index == 3) {
- uni.reLaunch({
- url: '/pages/activity/index'
- })
- }
- else if (index == 4) {
- uni.reLaunch({
- url: '/pages/mine/index'
- })
- }
-
- },
- }
- }
- </script>
- <style lang="scss">
- .tabbar {
- height: 60px;
- padding: 5px 0;
- width: 100%;
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: space-around;
- position: fixed;
- left: 0;
- bottom: 0;
- z-index: 2;
- button::after {
- border: none;
- }
- .item {
- text-align: center;
- image {
- width: 25px;
- height: 25px;
- }
- .name {
- // margin-top: -5px;
- // line-height: 25px;
- font-size: 12px;
- color: #909399;
- font-weight: 400;
- }
- }
- .active {
- image {
- width: 25px;
- height: 25px;
- }
- .name {
- font-size: 12px;
- color: #303133 !important;
- font-weight: 400;
- }
- }
- }
- </style>
|