|
@@ -1,8 +1,9 @@
|
|
|
<template>
|
|
|
<view class="ezy-custom-tabbar">
|
|
|
<view class="tabbar-item-box">
|
|
|
- <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path)"
|
|
|
- :style="{backgroundImage: 'url(' + item.iconPath + ')'}"></view>
|
|
|
+ <view class="tabbar-item" v-for="(item, index) in tabList" :key="index" @click="switchTab(item.path,index)"
|
|
|
+ :style="{ backgroundImage: 'url(' + (currentTab === index ? item.activePath : item.iconPath) + ')' }">
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -13,7 +14,8 @@
|
|
|
} from '@/utils/emitEvents.js';
|
|
|
import cacheManager from "@/utils/cacheManager.js";
|
|
|
import {
|
|
|
- toast,getUserIdentity
|
|
|
+ toast,
|
|
|
+ getUserIdentity
|
|
|
} from "@/utils/common";
|
|
|
export default {
|
|
|
|
|
@@ -21,22 +23,26 @@
|
|
|
return {
|
|
|
tabList: [{
|
|
|
iconPath: 'static/images/tabbar/unselect/plan-sj.png',
|
|
|
+ activePath: 'static/images/tabbar/select/plan-sj.png',
|
|
|
path: `/pages/study/index`
|
|
|
},
|
|
|
{
|
|
|
iconPath: 'static/images/tabbar/unselect/partner-sj.png',
|
|
|
+ activePath: 'static/images/tabbar/select/partner-sj.png',
|
|
|
path: '/pages/game/index'
|
|
|
},
|
|
|
{
|
|
|
iconPath: 'static/images/tabbar/unselect/my-sj.png',
|
|
|
+ activePath: 'static/images/tabbar/select/my-sj.png',
|
|
|
path: `/pages/my/index`
|
|
|
},
|
|
|
],
|
|
|
+ currentTab: 0
|
|
|
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
- nianji: {
|
|
|
+ nianji: {
|
|
|
type: String,
|
|
|
},
|
|
|
cardId: {
|
|
@@ -45,17 +51,12 @@
|
|
|
zhangId: {
|
|
|
type: String,
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
|
- switchTab(path, params = {}) {
|
|
|
- console.log(path)
|
|
|
- /* if(path =='/pages/game/index'){
|
|
|
- toast("功能暂未开放!")
|
|
|
- return false
|
|
|
- } */
|
|
|
-
|
|
|
+ switchTab(path, index) {
|
|
|
+ this.currentTab = index;
|
|
|
if (getUserIdentity() == 'Visitor') {
|
|
|
if (path === '/pages/game/index') {
|
|
|
// 游戏需要返回功能
|
|
@@ -68,18 +69,16 @@
|
|
|
url: path + '?nianji=' + this.nianji + '&cardId=' + this.cardId + '&zhangId=' + this
|
|
|
.zhangId
|
|
|
});
|
|
|
- }else{
|
|
|
-
|
|
|
- if (path === '/pages/game/index') {
|
|
|
- // 游戏需要返回功能
|
|
|
- uni.navigateTo({
|
|
|
- url: path
|
|
|
- });
|
|
|
- return ;
|
|
|
- }
|
|
|
-
|
|
|
+ } else {
|
|
|
+ if (path === '/pages/game/index') {
|
|
|
+ // 游戏需要返回功能
|
|
|
+ uni.navigateTo({
|
|
|
+ url: path
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
uni.redirectTo({
|
|
|
- url: path
|
|
|
+ url: path
|
|
|
});
|
|
|
}
|
|
|
|