Yansen 2 years ago
parent
commit
17f46e9edb
4 changed files with 29 additions and 8 deletions
  1. 3
    2
      src/components/Icon.jsx
  2. 14
    2
      src/components/MenuIcon.jsx
  3. 10
    4
      src/pages/home/index.jsx
  4. 2
    0
      src/services/taissueapply.js

+ 3
- 2
src/components/Icon.jsx View File

@@ -1,6 +1,7 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { Image } from '@tarojs/components';
4
+import { Icon } from '@antmjs/vantui';
4 5
 import icon1 from '@/assets/icons/icon1.png';
5 6
 import icon2 from '@/assets/icons/icon2.png';
6 7
 import icon3 from '@/assets/icons/icon3.png';
@@ -30,9 +31,9 @@ const icons = {
30 31
 }
31 32
 
32 33
 export default (props) => {
33
-  const { className, style, name } = props;
34
+  const { className, style, name, info } = props;
34 35
   
35 36
   return (
36
-    <Image src={icons[name]} className={className} style={style} />
37
+    <Icon name={icons[name]} className={className} style={style} info={info} />
37 38
   )
38 39
 }

+ 14
- 2
src/components/MenuIcon.jsx View File

@@ -27,7 +27,9 @@ const txtStyle = {
27 27
 
28 28
 export default (props) => {
29 29
   
30
-  const { icon, text, link } = props;
30
+  const { icon, text, link, request } = props;
31
+
32
+  const [info, setInfo] = React.useState();
31 33
 
32 34
   const onClick = () => {
33 35
     Taro.navigateTo({
@@ -35,11 +37,21 @@ export default (props) => {
35 37
     })
36 38
   }
37 39
 
40
+  React.useEffect(() => {
41
+    if (request) {
42
+      request().then(res => {
43
+        if (res) {
44
+          res > 99 ? setInfo('99+') : setInfo(res);
45
+        }
46
+      });
47
+    }
48
+  }, [request]);
49
+
38 50
   return (
39 51
     <RatioView>
40 52
       <View style={wrapperStyle} onClick={onClick}>
41 53
         <View>
42
-          <Icon name={icon} style={iconStyle} />
54
+          <Icon name={icon} style={iconStyle} info={info} />
43 55
           <View style={txtStyle}>{text}</View>
44 56
         </View>
45 57
       </View>

+ 10
- 4
src/pages/home/index.jsx View File

@@ -5,11 +5,17 @@ import { useModel } from '@/store';
5 5
 import MenuIcon from '@/components/MenuIcon';
6 6
 import { ROLE_CITIZEN, ROLE_INSPECTOR, ROLE_MANAGER, ROLE_ORG_MANAGER, ROLE_ORG_USER, ROLE_QUERY_PERSON } from '@/utils/user';
7 7
 import { PROCESS_APPLY_DELAY, PROCESS_APPLY_END, PROCESS_APPLY_REJECT, PROCESS_APPLY_VERIFY, PROCESS_ASSIGNED, PROCESS_END, PROCESS_START } from '@/utils/biz';
8
+import { getApplyNum } from '@/services/taissueapply';
8 9
 import Head from './components/Head';
9 10
 import Banner from './components/Banner';
10 11
 import StatCard from './components/StatCard';
11 12
 import './index.less';
12 13
 
14
+const getRejctApply = () => getApplyNum({ applyType: PROCESS_APPLY_REJECT });
15
+const getDelayApply = () => getApplyNum({ applyType: PROCESS_APPLY_DELAY });
16
+const getVerifyApply = () => getApplyNum({ applyType: PROCESS_APPLY_VERIFY });
17
+const getEdnApply = () => getApplyNum({ applyType: PROCESS_APPLY_END });
18
+
13 19
 const menus = {
14 20
   // 督查员
15 21
   [ROLE_INSPECTOR]: [
@@ -23,10 +29,10 @@ const menus = {
23 29
     { icon: 'icon1', text: '待 交 办', link: `/pages/issue/list2/index?title=待交办&bizStatus=${PROCESS_START}` },
24 30
     { icon: 'icon2', text: '已 交 办', link: `/pages/issue/list2/index?title=已交办&bizStatus=${PROCESS_ASSIGNED}`, },
25 31
     { icon: 'icon3', text: '已 办 结', link: `/pages/issue/list2/index?title=已办结&bizStatus=${PROCESS_END}` },
26
-    { icon: 'icon4', text: '消单申请', link: `/pages/apply/list/index?title=消单申请&applyType=${PROCESS_APPLY_END}` },
32
+    { icon: 'icon4', text: '消单申请', request: getEdnApply, link: `/pages/apply/list/index?title=消单申请&applyType=${PROCESS_APPLY_END}` },
27 33
     { icon: 'icon5', text: '逾期警告', link: `/pages/issue/list2/index?title=逾期警告&bizStatus=expired` },
28
-    { icon: 'icon6', text: '延期申请', link: `/pages/apply/list/index?title=延期申请&applyType=${PROCESS_APPLY_DELAY}` },
29
-    { icon: 'icon12', text: '驳回申请', link: `/pages/apply/list/index?title=驳回申请&applyType=${PROCESS_APPLY_REJECT}` },
34
+    { icon: 'icon6', text: '延期申请', request: getDelayApply, link: `/pages/apply/list/index?title=延期申请&applyType=${PROCESS_APPLY_DELAY}` },
35
+    { icon: 'icon12', text: '驳回申请', request: getRejctApply, link: `/pages/apply/list/index?title=驳回申请&applyType=${PROCESS_APPLY_REJECT}` },
30 36
     { icon: 'icon7', text: '统计查询', link: '/subpkg1/pages/statistics/index' },
31 37
     { icon: 'icon9', text: '我的上报', link: '/pages/issue/list2/index?title=我的上报&mine=true' },
32 38
     { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
@@ -45,7 +51,7 @@ const menus = {
45 51
     { icon: 'icon2', text: '处 理 中', link: `/pages/org/issue/list/index?title=处理中&bizStatus=${PROCESS_ASSIGNED}` },
46 52
     { icon: 'icon3', text: '已 办 结', link: `/pages/org/issue/list/index?title=已办结&bizStatus=${PROCESS_END}` },
47 53
     { icon: 'icon5', text: '已 逾 期', link: '/pages/org/issue/list/index?title=已办结&bizStatus=expired' },
48
-    { icon: 'icon9', text: '审核申请', link: `/pages/apply/list/index?title=审核申请&applyType=${PROCESS_APPLY_VERIFY}` },
54
+    { icon: 'icon9', text: '审核申请', request: getVerifyApply, link: `/pages/apply/list/index?title=审核申请&applyType=${PROCESS_APPLY_VERIFY}` },
49 55
     { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
50 56
   ],
51 57
 

+ 2
- 0
src/services/taissueapply.js View File

@@ -27,3 +27,5 @@ export const putTaIssueApply = (id, data) => request(`/api/taIssueApply/${id}`,
27 27
  * 通过主键删除数据
28 28
  */
29 29
 export const deleteTaIssueApply = (id) => request(`/api/taIssueApply/${id}`, { method: 'delete' });
30
+
31
+export const getApplyNum = params => request('/api/taIssueApply/nums', { params });