| | |
| | | return obj[i] |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | export const getTabbarList = (roleType) => { |
| | | if (roleType == 2) { |
| | | return [{ |
| | | name: '首页', |
| | | iconPathSelected: '/static/img/tabbar-01-selected.png', |
| | | iconPath: '/static/img/tabbar-01.png', |
| | | url: '/pages/home/index' |
| | | }, |
| | | |
| | | { |
| | | name: '驾驶舱', |
| | | iconPathSelected: '/static/img/tabbar-02-selected.png', |
| | | iconPath: '/static/img/tabbar-02.png', |
| | | |
| | | url: '/pages/statistics/index' |
| | | }, |
| | | |
| | | |
| | | { |
| | | name: '个人中心', |
| | | iconPathSelected: '/static/img/tabbar-03-selected.png', |
| | | iconPath: '/static/img/tabbar-03.png', |
| | | |
| | | url: '/pages/user/center' |
| | | } |
| | | ] |
| | | } else { |
| | | return [{ |
| | | name: '首页', |
| | | iconPathSelected: '/static/img/tabbar-01-selected.png', |
| | | iconPath: '/static/img/tabbar-01.png', |
| | | url: '/pages/home/index' |
| | | }, |
| | | |
| | | { |
| | | name: '圈子', |
| | | iconPathSelected: '/static/img/tabbar-02-selected.png', |
| | | iconPath: '/static/img/tabbar-02.png', |
| | | url: '/pages/circle/index' |
| | | }, |
| | | { |
| | | name: '个人中心', |
| | | iconPathSelected: '/static/img/tabbar-03-selected.png', |
| | | iconPath: '/static/img/tabbar-03.png', |
| | | url: '/pages/user/center' |
| | | } |
| | | ] |
| | | } |
| | | } |
| | |
| | | <view> |
| | | <u-tabbar class="custom-tabbar" zIndex="100" :value="current" :fixed="true" :active-color="activeColor" |
| | | :inactive-color="inactiveColor"> |
| | | <u-tabbar-item text="首页" @click="changeTabbar('/pages/home/index')"> |
| | | <image class="tabbar-icon" slot="active-icon" src="/static/img/tabbar-01-selected.png"></image> |
| | | <image class="tabbar-icon" slot="inactive-icon" src="/static/img/tabbar-01.png"></image> |
| | | </u-tabbar-item> |
| | | <!-- <u-tabbar-item text="圈子"> |
| | | <image class="tabbar-icon" slot="active-icon" src="/static/img/tabbar-02-selected.png"></image> |
| | | <image class="tabbar-icon" slot="inactive-icon" src="/static/img/tabbar-02.png"></image> |
| | | </u-tabbar-item> --> |
| | | <u-tabbar-item text="驾驶舱" v-if="roleType == 2" @click="changeTabbar('/pages/statistics/index')"> |
| | | <image class="tabbar-icon" slot="active-icon" src="/static/img/tabbar-02-selected.png"></image> |
| | | <image class="tabbar-icon" slot="inactive-icon" src="/static/img/tabbar-02.png"></image> |
| | | </u-tabbar-item> |
| | | <u-tabbar-item text="个人中心" @click="changeTabbar('/pages/user/center')"> |
| | | <image class="tabbar-icon" slot="active-icon" src="/static/img/tabbar-03-selected.png"></image> |
| | | <image class="tabbar-icon" slot="inactive-icon" src="/static/img/tabbar-03.png"></image> |
| | | <u-tabbar-item :text="item.name" @click="changeTabbar(item.url,index)" 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> |
| | |
| | | export default { |
| | | props: { |
| | | current: Number, |
| | | isShowTabbarItem: false |
| | | list: { |
| | | type: Array, |
| | | default: () => [] |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | |
| | | roleType: "", |
| | | curRole: {}, |
| | | inactiveColor: '#909399', |
| | | activeColor: '#328CFA', |
| | | |
| | | curTabList: [{ |
| | | name: '首页', |
| | | iconPathSelected: '/static/img/tabbar-01-selected.png', |
| | | iconPath: '/static/img/tabbar-01.png', |
| | | // icon: "home", |
| | | url: '/pages/home/index' |
| | | }, |
| | | |
| | | { |
| | | name: '圈子', |
| | | iconPathSelected: '/static/img/tabbar-02-selected.png', |
| | | iconPath: '/static/img/tabbar-02.png', |
| | | // icon: "home", |
| | | url: '/pages/home/index' |
| | | }, |
| | | { |
| | | name: '驾驶舱', |
| | | iconPathSelected: '/static/img/tabbar-02-selected.png', |
| | | iconPath: '/static/img/tabbar-02.png', |
| | | // icon: "home", |
| | | url: '/pages/statistics/index' |
| | | }, |
| | | |
| | | |
| | | { |
| | | name: '个人中心', |
| | | iconPathSelected: '/static/img/tabbar-03-selected.png', |
| | | iconPath: '/static/img/tabbar-03.png', |
| | | // icon: "account-fill", |
| | | url: '/pages/user/center' |
| | | } |
| | | ] |
| | | tabbarList: [], |
| | | inactiveColor: '#AFB8C3', |
| | | activeColor: '#5086FA', |
| | | } |
| | | }, |
| | | watch: { |
| | | 'curRole.roleName': { |
| | | handler(newVal) { |
| | | if (newVal == "民警") { |
| | | this.roleType = 2 |
| | | } |
| | | }, |
| | | deep: true, |
| | | immediate: true |
| | | }, |
| | | |
| | | |
| | | tabList: { |
| | | list: { |
| | | handler(newVal) { |
| | | if (newVal && newVal.length > 0) { |
| | | this.tabList = newVal |
| | | this.tabbarList = newVal |
| | | } |
| | | }, |
| | | deep: true, |
| | | immediate: true |
| | | }, |
| | | currentTab: { |
| | | handler(newVal) { |
| | | this.currentTab = newVal |
| | | }, |
| | | deep: true, |
| | | immediate: true |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | mounted() { |
| | | |
| | | this.curRole = uni.getStorageSync("activeRole"); |
| | | |
| | | // this.getMessage() |
| | | }, |
| | | destroyed() { |
| | | |
| | | }, |
| | | methods: { |
| | | |
| | | |
| | | changeTabbar(url) { |
| | | uni.reLaunch({ |
| | | changeTabbar(url, index) { |
| | | if (this.current == index) return |
| | | uni.switchTab({ |
| | | url |
| | | }) |
| | | }, |
| | | |
| | | |
| | | change(e) { |
| | | console.log(e); |
| | | uni.reLaunch({ |
| | | url: this.curTabList[e].url, |
| | | complete: (res) => { |
| | | console.log("===>", res); |
| | | } |
| | | }) |
| | | // this.$emit("change", this.curTabList[e].url) |
| | | }, |
| | | |
| | | this.$emit("change", index) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .tabbar-icon { |
| | | width: 45rpx; |
| | | height: 45rpx; |
| | | width: 56rpx; |
| | | height: 56rpx; |
| | | } |
| | | </style> |
| | |
| | | "backgroundColor": "#4586FE" |
| | | }, |
| | | "tabBar": { |
| | | // "custom": true, |
| | | "custom": true, |
| | | "color": "#AFB8C3", |
| | | "selectedColor": "#5086FA", |
| | | "borderStyle": "white", |
| | |
| | | "iconPath": "static/img/tabbar-01.png", |
| | | "text": "首页" |
| | | }, |
| | | // { |
| | | // "pagePath": "pages/circle/index", |
| | | // "iconPath": "static/img/tabbar-02.png", |
| | | // "selectedIconPath": "static/img/tabbar-02-selected.png", |
| | | // "text": "圈子" |
| | | // }, |
| | | { |
| | | "pagePath": "pages/circle/index", |
| | | "iconPath": "static/img/tabbar-02.png", |
| | | "selectedIconPath": "static/img/tabbar-02-selected.png", |
| | | "text": "圈子" |
| | | }, |
| | | { |
| | | "pagePath": "pages/statistics/index", |
| | | "iconPath": "static/img/tabbar-02.png", |
| | |
| | | </view> |
| | | </view> |
| | | </z-paging> |
| | | |
| | | <tabBar :current="1" :list="tabList" /> |
| | | |
| | | </view> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import tabBar from "@/components/tabBar/tabBar.vue" |
| | | import { |
| | | getList, |
| | | handleLike, |
| | |
| | | import { |
| | | minioBaseUrl |
| | | } from "@/common/setting.js" |
| | | import { |
| | | getTabbarList |
| | | } from "@/common/common.js" |
| | | export default { |
| | | components: { |
| | | tabBar |
| | | }, |
| | | data() { |
| | | return { |
| | | keyword: "", |
| | |
| | | page: 1, |
| | | isSearch: false, |
| | | commentList: [], |
| | | envVersion:"" |
| | | envVersion: "", |
| | | tabList: [] |
| | | } |
| | | }, |
| | | |
| | | onLoad() { |
| | | this.tabList = getTabbarList(1); |
| | | let role = uni.getStorageSync('activeRole') |
| | | if (role.roleAlias == "inhabitant") { |
| | | this.roleType = 0 |
| | | } else { |
| | | |
| | | this.roleType = 1; |
| | | } |
| | | // this.getCircleList() |
| | |
| | | this.$refs.paging.reload(); |
| | | }) |
| | | }, |
| | | |
| | | |
| | | onShow(){ |
| | | |
| | | |
| | | onShow() { |
| | | let accountInfo = wx.getAccountInfoSync(); |
| | | this.envVersion = accountInfo.miniProgram.envVersion; |
| | | }, |
| | |
| | | // }, |
| | | |
| | | methods: { |
| | | |
| | | |
| | | showAvatar(src){ |
| | | |
| | | |
| | | showAvatar(src) { |
| | | return `${minioBaseUrl}${src}` |
| | | }, |
| | | |
| | |
| | | @close="selectBoxShow = false" :show="selectBoxShow" keyName="name" ref="uPicker" :columns="siteColumns"
|
| | | @confirm="confirmSite" @change="changeSite" @cancel="selectBoxShow = false"></u-picker>
|
| | | </view>
|
| | | <!-- <tabBar :current="0" /> -->
|
| | | <tabBar :current="0" :list="tabList" />
|
| | | </view>
|
| | | </template>
|
| | |
|
| | |
| | | } from "@/api/task/task.js"
|
| | |
|
| | | import tabBar from "@/components/tabBar/tabBar.vue"
|
| | |
|
| | | import {
|
| | | getTabbarList
|
| | | } from "@/common/common.js"
|
| | | export default {
|
| | | components: {
|
| | | noticeList,
|
| | |
| | | background: {
|
| | | top: "#017BFC",
|
| | | banner: "linear-gradient(180deg, #017BFC 0%, rgba(1, 123, 252, 0) 100%)"
|
| | | }
|
| | | },
|
| | | tabList: []
|
| | |
|
| | | }
|
| | | },
|
| | |
| | | let type = null
|
| | | let roleName = this.selectRole.roleName
|
| | | if (roleName == '网格员' || roleName == '系统管理员') {
|
| | | this.tabList = getTabbarList(1);
|
| | | type = 1
|
| | | this.roleType = 1;
|
| | | this.roleTypeName = "街道社区网格"
|
| | |
| | | "linear-gradient(180deg, #017BFC 0%, rgba(1, 123, 252, 0) 100%)");
|
| | |
|
| | | } else if (roleName == '居民') {
|
| | | this.tabList = getTabbarList(1);
|
| | | type = 2
|
| | | this.roleType = 2
|
| | | this.roleTypeName = "居民"
|
| | |
| | | "linear-gradient(180deg, #017BFC 0%, rgba(1, 123, 252, 0) 100%)");
|
| | |
|
| | | } else if (roleName == '民警') {
|
| | | this.tabList = getTabbarList(2);
|
| | | type = 1
|
| | | this.roleType = 3
|
| | | this.roleTypeName = "街道社区"
|
| | |
| | | </view> |
| | | |
| | | </view> |
| | | <!-- <tabBar :current="1" /> --> |
| | | <tabBar :current="1" :list="tabList" @change="changeTabbar" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | import captionRow from "@/components/caption/caption.vue" |
| | | import * as statisticsModal from "@/api/statistics/statistics.js" |
| | | import tabBar from "@/components/tabBar/tabBar.vue" |
| | | import { |
| | | getTabbarList |
| | | } from "@/common/common.js" |
| | | export default { |
| | | components: { |
| | | captionRow, |
| | |
| | | }, |
| | | gridData: {}, |
| | | houseLabelData: [], |
| | | sexData: [] |
| | | sexData: [], |
| | | tabList: [] |
| | | } |
| | | }, |
| | | onTabItemTap(e) { |
| | | // tab 点击时执行,此处直接接收单击事件 |
| | | console.log(e) |
| | | this.refreshData(); |
| | | }, |
| | | // onLoad() { |
| | | |
| | | // onTabItemTap(e) { |
| | | // // tab 点击时执行,此处直接接收单击事件 |
| | | // console.log(e) |
| | | // this.refreshData(); |
| | | // }, |
| | | onLoad() { |
| | | this.tabList = getTabbarList(2); |
| | | }, |
| | | |
| | | |
| | | onShow() { |
| | | this.refreshData(); |
| | | }, |
| | | |
| | | methods: { |
| | | refreshData(){ |
| | | |
| | | changeTabbar(e) { |
| | | console.log("==>", e) |
| | | // this.refreshData(); |
| | | }, |
| | | |
| | | refreshData() { |
| | | this.getHouseHoldData(); |
| | | this.getHouseData(); |
| | | this.getHouseLabelData(); |
| | |
| | | </u-cell> |
| | | </u-cell-group> |
| | | </view> |
| | | <!-- <tabBar :current="2" /> --> |
| | | <tabBar :current="2" :list="tabList" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | minioBaseUrl |
| | | } from "@/common/setting.js" |
| | | import tabBar from "@/components/tabBar/tabBar.vue" |
| | | import { |
| | | getTabbarList |
| | | } from "@/common/common.js" |
| | | export default { |
| | | components: { |
| | | tabBar |
| | |
| | | ], |
| | | roleType: 1, |
| | | addressType: 1, |
| | | user_info: {} |
| | | user_info: {}, |
| | | tabList: [] |
| | | }; |
| | | }, |
| | | |
| | |
| | | // this.getUserInfo(); |
| | | let role = uni.getStorageSync('activeRole') |
| | | if (role.roleAlias == "inhabitant") { |
| | | this.tabList = getTabbarList(1); |
| | | this.roleType = 1 |
| | | } else { |
| | | this.tabList = getTabbarList(2); |
| | | this.roleType = 2; |
| | | } |
| | | this.addressType = uni.getStorageSync("siteInfo").addressType; |
| | |
| | | // }, |
| | | //设置当前激活的角色 |
| | | setActiveRole(state, role) { |
| | | console.log("role===>", role); |
| | | state.activeRole = role |
| | | uni.setStorageSync('activeRole', role) |
| | | }, |
| | |
| | | |
| | | }, |
| | | actions: { |
| | | |
| | | |
| | | getMenuList({ |
| | | commit |
| | | }) { |