|
@@ -1,68 +1,68 @@
|
1
|
|
-import React from 'react';
|
2
|
|
-import Taro from '@tarojs/taro';
|
3
|
|
-import { View, Image } from '@tarojs/components';
|
4
|
|
-import { Tabbar, TabbarItem } from '@antmjs/vantui';
|
|
1
|
+import React from "react";
|
|
2
|
+import Taro from "@tarojs/taro";
|
|
3
|
+import { View, Image } from "@tarojs/components";
|
|
4
|
+import { Tabbar, TabbarItem } from "@antmjs/vantui";
|
5
|
5
|
import {
|
6
|
6
|
ROLE_INSPECTOR,
|
7
|
7
|
ROLE_MANAGER,
|
8
|
8
|
ROLE_ORG_USER,
|
9
|
9
|
ROLE_ORG_MANAGER,
|
10
|
10
|
ROLE_QUERY_PERSON,
|
11
|
|
- ROLE_CITIZEN
|
12
|
|
-} from '@/utils/user';
|
13
|
|
-import homeIcon from '@/assets/tabbar/page.png';
|
14
|
|
-import homeActiveIcon from '@/assets/tabbar/page click.png';
|
15
|
|
-import noticeIcon from '@/assets/tabbar/notice.png';
|
16
|
|
-import noticeActiveIcon from '@/assets/tabbar/notice click.png';
|
17
|
|
-import issueIcon from '@/assets/tabbar/release.png';
|
18
|
|
-import issueActiveIcon from '@/assets/tabbar/release click.png';
|
19
|
|
-import checkIcon from '@/assets/tabbar/evaluation.png';
|
20
|
|
-import checkActiveIcon from '@/assets/tabbar/evaluation click.png';
|
21
|
|
-import mineIcon from '@/assets/tabbar/my.png';
|
22
|
|
-import mineActiveIcon from '@/assets/tabbar/my click.png';
|
|
11
|
+ ROLE_CITIZEN,
|
|
12
|
+} from "@/utils/user";
|
|
13
|
+import homeIcon from "@/assets/tabbar/page.png";
|
|
14
|
+import homeActiveIcon from "@/assets/tabbar/page click.png";
|
|
15
|
+import noticeIcon from "@/assets/tabbar/notice.png";
|
|
16
|
+import noticeActiveIcon from "@/assets/tabbar/notice click.png";
|
|
17
|
+import issueIcon from "@/assets/tabbar/release.png";
|
|
18
|
+import issueActiveIcon from "@/assets/tabbar/release click.png";
|
|
19
|
+import checkIcon from "@/assets/tabbar/evaluation.png";
|
|
20
|
+import checkActiveIcon from "@/assets/tabbar/evaluation click.png";
|
|
21
|
+import mineIcon from "@/assets/tabbar/my.png";
|
|
22
|
+import mineActiveIcon from "@/assets/tabbar/my click.png";
|
23
|
23
|
|
24
|
24
|
const home = {
|
25
|
|
- name: 'home',
|
26
|
|
- label: '首页',
|
|
25
|
+ name: "home",
|
|
26
|
+ label: "首页",
|
27
|
27
|
icon: homeIcon,
|
28
|
28
|
activeIcon: homeActiveIcon,
|
29
|
|
- page: '/pages/home/index'
|
30
|
|
-}
|
|
29
|
+ page: "/pages/home/index",
|
|
30
|
+};
|
31
|
31
|
const notice = {
|
32
|
|
- name: 'notice',
|
33
|
|
- label: '公告',
|
|
32
|
+ name: "notice",
|
|
33
|
+ label: "公告",
|
34
|
34
|
icon: noticeIcon,
|
35
|
35
|
activeIcon: noticeActiveIcon,
|
36
|
|
- page: '/pages/notice/index'
|
37
|
|
-}
|
|
36
|
+ page: "/pages/notice/index",
|
|
37
|
+};
|
38
|
38
|
const issue = {
|
39
|
|
- name: 'issue',
|
40
|
|
- label: '发布',
|
|
39
|
+ name: "issue",
|
|
40
|
+ label: "发布",
|
41
|
41
|
icon: issueIcon,
|
42
|
42
|
activeIcon: issueActiveIcon,
|
43
|
|
- page: '/pages/issue/edit/index'
|
44
|
|
-}
|
|
43
|
+ page: "/pages/issue/edit/index",
|
|
44
|
+};
|
45
|
45
|
const feedback = {
|
46
|
|
- name: 'feedback',
|
47
|
|
- label: '随手拍',
|
|
46
|
+ name: "feedback",
|
|
47
|
+ label: "随手拍",
|
48
|
48
|
icon: issueIcon,
|
49
|
49
|
activeIcon: issueActiveIcon,
|
50
|
|
- page: '/pages/feedback/issue/index'
|
51
|
|
-}
|
|
50
|
+ page: "/pages/feedback/issue/index",
|
|
51
|
+};
|
52
|
52
|
const check = {
|
53
|
|
- name: 'check',
|
54
|
|
- label: '测评标准',
|
|
53
|
+ name: "check",
|
|
54
|
+ label: "测评标准",
|
55
|
55
|
icon: checkIcon,
|
56
|
56
|
activeIcon: checkActiveIcon,
|
57
|
|
- page: '/pages/checkStand/index'
|
58
|
|
-}
|
|
57
|
+ page: "/pages/checkStand/list/index",
|
|
58
|
+};
|
59
|
59
|
const mine = {
|
60
|
|
- name: 'mine',
|
61
|
|
- label: '我的',
|
|
60
|
+ name: "mine",
|
|
61
|
+ label: "我的",
|
62
|
62
|
icon: mineIcon,
|
63
|
63
|
activeIcon: mineActiveIcon,
|
64
|
|
- page: '/pages/my/index'
|
65
|
|
-}
|
|
64
|
+ page: "/pages/my/index",
|
|
65
|
+};
|
66
|
66
|
|
67
|
67
|
export default (props) => {
|
68
|
68
|
const { active = -1, className, duty } = props;
|
|
@@ -70,51 +70,34 @@ export default (props) => {
|
70
|
70
|
const tabItems = React.useMemo(() => {
|
71
|
71
|
if (!duty) return [];
|
72
|
72
|
|
73
|
|
- if (duty == ROLE_INSPECTOR // 督察员
|
74
|
|
- || duty == ROLE_MANAGER // 管理员
|
|
73
|
+ if (
|
|
74
|
+ duty == ROLE_INSPECTOR || // 督察员
|
|
75
|
+ duty == ROLE_MANAGER // 管理员
|
75
|
76
|
) {
|
76
|
|
- return [
|
77
|
|
- home,
|
78
|
|
- notice,
|
79
|
|
- issue,
|
80
|
|
- check,
|
81
|
|
- mine
|
82
|
|
- ]
|
|
77
|
+ return [home, notice, issue, check, mine];
|
83
|
78
|
}
|
84
|
|
-
|
85
|
|
- if (duty == ROLE_QUERY_PERSON) { // 查询员
|
86
|
|
- return [
|
87
|
|
- home,
|
88
|
|
- notice,
|
89
|
|
- check,
|
90
|
|
- mine
|
91
|
|
- ]
|
|
79
|
+
|
|
80
|
+ if (duty == ROLE_QUERY_PERSON) {
|
|
81
|
+ // 查询员
|
|
82
|
+ return [home, notice, check, mine];
|
92
|
83
|
}
|
93
|
84
|
|
94
|
85
|
// 责任单位用户
|
95
|
86
|
if (duty == ROLE_ORG_USER || duty == ROLE_ORG_MANAGER) {
|
96
|
|
- return [
|
97
|
|
- home,
|
98
|
|
- notice,
|
99
|
|
- mine,
|
100
|
|
- ]
|
|
87
|
+ return [home, notice, mine];
|
101
|
88
|
}
|
102
|
89
|
|
103
|
90
|
if (duty == ROLE_CITIZEN) {
|
104
|
|
- return [
|
105
|
|
- home,
|
106
|
|
- feedback,
|
107
|
|
- mine,
|
108
|
|
- ]
|
|
91
|
+ return [home, feedback, mine];
|
109
|
92
|
}
|
110
|
93
|
|
111
|
94
|
return [];
|
112
|
95
|
}, [duty]);
|
113
|
96
|
|
114
|
97
|
const onChange = (e) => {
|
115
|
|
- const url = tabItems.filter(x => x.name === e.detail)[0].page;
|
116
|
|
- Taro.reLaunch({ url })
|
117
|
|
- }
|
|
98
|
+ const url = tabItems.filter((x) => x.name === e.detail)[0].page;
|
|
99
|
+ Taro.reLaunch({ url });
|
|
100
|
+ };
|
118
|
101
|
|
119
|
102
|
return (
|
120
|
103
|
<Tabbar
|
|
@@ -123,32 +106,28 @@ export default (props) => {
|
123
|
106
|
active={active}
|
124
|
107
|
onChange={onChange}
|
125
|
108
|
>
|
126
|
|
- {
|
127
|
|
- tabItems.map(item => (
|
128
|
|
- <TabbarItem
|
129
|
|
- key={item.name}
|
130
|
|
- name={item.name}
|
131
|
|
- renderIcon={
|
132
|
|
- <Image
|
133
|
|
- src={item.icon}
|
134
|
|
- mode="aspectFit"
|
135
|
|
- style="width: 30px; height: 20px;"
|
136
|
|
- ></Image>
|
137
|
|
- }
|
138
|
|
- renderIconActive={
|
139
|
|
- <Image
|
140
|
|
- src={item.activeIcon}
|
141
|
|
- mode="aspectFit"
|
142
|
|
- style="width: 30px; height: 20px;"
|
143
|
|
- ></Image>
|
144
|
|
- }
|
145
|
|
- >
|
146
|
|
- <View style={{fontSize: '14px'}}>
|
147
|
|
- {item.label}
|
148
|
|
- </View>
|
149
|
|
- </TabbarItem>
|
150
|
|
- ))
|
151
|
|
- }
|
|
109
|
+ {tabItems.map((item) => (
|
|
110
|
+ <TabbarItem
|
|
111
|
+ key={item.name}
|
|
112
|
+ name={item.name}
|
|
113
|
+ renderIcon={
|
|
114
|
+ <Image
|
|
115
|
+ src={item.icon}
|
|
116
|
+ mode="aspectFit"
|
|
117
|
+ style="width: 30px; height: 20px;"
|
|
118
|
+ ></Image>
|
|
119
|
+ }
|
|
120
|
+ renderIconActive={
|
|
121
|
+ <Image
|
|
122
|
+ src={item.activeIcon}
|
|
123
|
+ mode="aspectFit"
|
|
124
|
+ style="width: 30px; height: 20px;"
|
|
125
|
+ ></Image>
|
|
126
|
+ }
|
|
127
|
+ >
|
|
128
|
+ <View style={{ fontSize: "14px" }}>{item.label}</View>
|
|
129
|
+ </TabbarItem>
|
|
130
|
+ ))}
|
152
|
131
|
</Tabbar>
|
153
|
|
- )
|
154
|
|
-}
|
|
132
|
+ );
|
|
133
|
+};
|