From 3c738f4fe2762bba8087e5a22fc0dc06560eab0e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Thu, 08 Aug 2024 10:01:17 +0800
Subject: [PATCH] 三色任务与自查任务
---
components/tabBar/tabBar.vue | 93 +++++++++++++++++++---------------------------
1 files changed, 38 insertions(+), 55 deletions(-)
diff --git a/components/tabBar/tabBar.vue b/components/tabBar/tabBar.vue
index 0c23be8..d8e8d2e 100644
--- a/components/tabBar/tabBar.vue
+++ b/components/tabBar/tabBar.vue
@@ -1,88 +1,71 @@
<template>
<view>
- <u-tabbar class="custom-tabbar" zIndex="100" :value="currentTab" :fixed="true" :active-color="activeColor"
- :inactive-color="inactiveColor" @change='change'>
- <u-tabbar-item v-for="(item,index) in curTabList" :icon="item.icon" :key="index" :text="item.name">
+ <u-tabbar class="custom-tabbar" zIndex="9999" :value="current" :fixed="true" :active-color="activeColor"
+ :inactive-color="inactiveColor">
+ <u-tabbar-item :text="item.name" @click="changeTabbar(item.url,index,item.name)"
+ v-for="(item,index) in tabbarList" :key="index">
+ <image class="tabbar-icon" slot="active-icon" :src="item.iconPathSelected"></image>
+ <image class="tabbar-icon" slot="inactive-icon" :src="item.iconPath"></image>
</u-tabbar-item>
</u-tabbar>
</view>
</template>
<script>
- import {
- messageCount,
- } from "@/api/system/message.js"
export default {
props: {
- currentTab: {},
+ current: Number,
+ list: {
+ type: Array,
+ default: () => []
+ }
},
data() {
return {
- inactiveColor: '#909399',
- activeColor: '#328CFA',
-
-
- curTabList: [{
- name: '首页',
- iconPathSelected: '',
- iconPath: '',
- icon: "home",
- url: '/pages/home/index'
- },
- {
- name: '个人中心',
- iconPathSelected: '',
- iconPath: '',
- icon: "account-fill",
- url: '/pages/user/center'
- }
- ]
+ tabbarList: [],
+ inactiveColor: '#C7CED7',
+ activeColor: '#017BFC',
+ // activeColor: '#003399'
}
},
watch: {
- tabList: {
+ list: {
handler(newVal) {
if (newVal && newVal.length > 0) {
- this.tabList = newVal
+ this.tabbarList = newVal;
+ if (uni.getStorageSync("activeRole").roleName == "民警") {
+ this.inactiveColor = "#AFB8C3";
+ this.activeColor = "#003399";
+ } else {
+ this.inactiveColor = "#C7CED7"
+ this.activeColor = "#017BFC";
+ }
}
},
deep: true,
immediate: true
- },
- currentTab: {
- handler(newVal) {
- this.currentTab = newVal
- },
- deep: true,
- immediate: true
- },
+ }
},
- mounted() {
- // this.getMessage()
- },
- destroyed() {
- },
methods: {
- change(e) {
- this.$store.commit("SET_TABBAT_INDEX", e)
- this.$emit("change", this.curTabList[e].url)
- let params = {
- recipient: this.userInfo.user_id,
- status: 0
- }
- messageCount(params).then(res => {
- this.$u.func.updateTabbar(res.data)
+ changeTabbar(url, index) {
+ if (this.current == index) return
+ uni.switchTab({
+ url
})
- },
-
+ this.$emit("change", index)
+ }
}
}
</script>
<style lang="scss" scoped>
- .u-page_item_slot_icon {
- width: 40rpx;
- height: 40rpx;
+ .tabbar-icon {
+ width: 56rpx;
+ height: 56rpx;
+ }
+
+ /deep/.u-tabbar {
+ box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(107, 134, 159, 0.2);
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3