fangmingyue 2 anni fa
parent
commit
787ac087fe

+ 1
- 0
config/prod.js Vedi File

@@ -4,6 +4,7 @@ module.exports = {
4 4
   },
5 5
   defineConstants: {
6 6
     HOST: '"http://localhost:9087"'
7
+    // HOST: '"https://t.njyz.tech"'
7 8
   },
8 9
   mini: {},
9 10
   h5: {

+ 2
- 3
src/app.config.js Vedi File

@@ -13,8 +13,7 @@ export default defineAppConfig({
13 13
     'pages/apply/verify/index',
14 14
     'pages/apply/detail/index',
15 15
     'pages/message/list/index',
16
-    'pages/index3/index',
17
-    'pages/index4/index',
16
+    'pages/checkStand/index',
18 17
     'pages/reporting/index',
19 18
     'pages/reporting/detail/index',
20 19
     'pages/reset-password/index',
@@ -22,7 +21,7 @@ export default defineAppConfig({
22 21
     'pages/check/loc/list/index',
23 22
     'pages/check/edit/index',
24 23
     'pages/notice/index',
25
-    'pages/notice/edit/index',
24
+    'pages/notice/detail/index',
26 25
     'pages/my/index',
27 26
     'pages/my/edit/index',
28 27
     'pages/statistics/index'

+ 2
- 14
src/components/Auth.jsx Vedi File

@@ -4,21 +4,9 @@ import { useModel } from '@/store';
4 4
 
5 5
 export default (props) => {
6 6
   const { roles = [] } = props;
7
-  const { user } = useModel('user');
7
+  const { duty } = useModel('user');
8 8
 
9
-  const targets = user?.dutyList || [];
10
-
11
-  let hasRights = false;
12
-  for(let role of roles) {
13
-    if (hasRights) {
14
-      continue;
15
-    }
16
-
17
-    const found = targets.indexOf(role) > -1;
18
-    if (found) {
19
-      hasRights = found;
20
-    }
21
-  }
9
+  const hasRights = roles.indexOf(duty) > -1;
22 10
 
23 11
   return !roles.length || hasRights ? props.children : (
24 12
     <View style={{width: '100%', height: '100%', display: 'grid', placeItems: 'center'}}>

+ 7
- 7
src/layouts/TabBar.jsx Vedi File

@@ -47,7 +47,7 @@ const check = {
47 47
   label: '测评标准',
48 48
   icon: checkIcon,
49 49
   activeIcon: checkActiveIcon,
50
-  page: '/pages/index4/index'
50
+  page: '/pages/checkStand/index'
51 51
 }
52 52
 const mine = {
53 53
   name: 'mine',
@@ -59,13 +59,13 @@ const mine = {
59 59
 }
60 60
 
61 61
 export default (props) => {
62
-  const { active = -1, className, user } = props;
62
+  const { active = -1, className, duty } = props;
63 63
 
64 64
   const tabItems = React.useMemo(() => {
65
-    if (!user) return [];
65
+    if (!duty) return [];
66 66
 
67
-    if (user.dutyList.indexOf(ROLE_INSPECTOR) > -1 // 督察员
68
-      || user.dutyList.indexOf(ROLE_MANAGER) > -1 // 管理员
67
+    if (duty == ROLE_INSPECTOR // 督察员
68
+      || duty == ROLE_MANAGER // 管理员
69 69
     ) {
70 70
       return [
71 71
         home,
@@ -76,7 +76,7 @@ export default (props) => {
76 76
       ]
77 77
     }
78 78
 
79
-    if (user.dutyList.indexOf(ROLE_ORG_USER) > -1) {
79
+    if (duty == ROLE_ORG_USER) {
80 80
       return [
81 81
         home,
82 82
         notice,
@@ -85,7 +85,7 @@ export default (props) => {
85 85
     }
86 86
 
87 87
     return [];
88
-  }, [user]);
88
+  }, [duty]);
89 89
 
90 90
   const onChange = (e) => {
91 91
     const url = tabItems.filter(x => x.name === e.detail)[0].page;

+ 2
- 2
src/layouts/index.jsx Vedi File

@@ -11,7 +11,7 @@ import laySty from './layout.module.less';
11 11
 export default (props) => {
12 12
   const { className, style, roles, tabBar = false, loading } = props;
13 13
 
14
-  const { person, user } = useModel('user');
14
+  const { person, user, duty } = useModel('user');
15 15
 
16 16
   const containerClass = `${laySty['page-conatiner']} ${tabBar ? laySty['with-tabbar'] : ''} ${className}`;
17 17
 
@@ -51,7 +51,7 @@ export default (props) => {
51 51
         }
52 52
       </View>
53 53
       {
54
-        tabBar && <TabBar className={laySty['page-tabbar']} active={tabBar} user={user} />
54
+        tabBar && <TabBar className={laySty['page-tabbar']} active={tabBar} duty={duty} />
55 55
       }
56 56
     </View>
57 57
   )

+ 14
- 14
src/pages/check/edit/components/LocForm.jsx Vedi File

@@ -25,20 +25,20 @@ export default (props) => {
25 25
     })
26 26
   }
27 27
 
28
-  // 获取答题主记录信息
29
-  React.useEffect(() => {
30
-    if (checkItemInfo?.itemId) {
31
-      setLoading(true);
32
-      getTaCheckItemAnswer(checkItemInfo?.itemId).then((res) => {
33
-        if (res) {
34
-          onChange(res);
35
-        }
36
-        setLoading(false);
37
-      }).catch(() => {
38
-        setLoading(false);
39
-      });
40
-    }
41
-  }, [checkItemInfo?.itemId])
28
+  // // 获取答题主记录信息
29
+  // React.useEffect(() => {
30
+  //   if (checkItemInfo?.itemId) {
31
+  //     setLoading(true);
32
+  //     getTaCheckItemAnswer(checkItemInfo?.itemId).then((res) => {
33
+  //       if (res) {
34
+  //         onChange(res);
35
+  //       }
36
+  //       setLoading(false);
37
+  //     }).catch(() => {
38
+  //       setLoading(false);
39
+  //     });
40
+  //   }
41
+  // }, [checkItemInfo?.itemId])
42 42
   
43 43
   return (
44 44
     <View>

+ 13
- 13
src/pages/check/edit/components/Question.jsx Vedi File

@@ -25,19 +25,19 @@ export default (props) => {
25 25
     })
26 26
   }
27 27
 
28
-  React.useEffect(() => {
29
-    if (quInfo?.quId) {
30
-      setLoading(true);
31
-      getTaCheckAnswerItem({ quId: quInfo.quId, isMine: true }).then(res => {
32
-        if (res && res[0]) {
33
-          onChange(res[0]);
34
-        }
35
-        setLoading(false);
36
-      }).catch(() => {
37
-        setLoading(false);
38
-      });
39
-    }
40
-  }, [quInfo?.quId]);
28
+  // React.useEffect(() => {
29
+  //   if (quInfo?.quId) {
30
+  //     setLoading(true);
31
+  //     getTaCheckAnswerItem({ quId: quInfo.quId, isMine: true }).then(res => {
32
+  //       if (res && res[0]) {
33
+  //         onChange(res[0]);
34
+  //       }
35
+  //       setLoading(false);
36
+  //     }).catch(() => {
37
+  //       setLoading(false);
38
+  //     });
39
+  //   }
40
+  // }, [quInfo?.quId]);
41 41
   
42 42
   return (
43 43
     <View>

+ 2
- 2
src/pages/check/edit/index.jsx Vedi File

@@ -178,8 +178,8 @@ export default (props) => {
178 178
         }
179 179
 
180 180
         // 查询我的答案
181
-        getTaCheckItemAnswer(itemId).then(setAnswer);
182
-
181
+        // getTaCheckItemAnswer(itemId).then(setAnswer);
182
+    
183 183
         // 查询当前测评主记录的所有问题
184 184
         getTaCheckItemQu({ pageSize: 200, itemId }).then(res => {
185 185
           setLoading(false);

+ 10
- 2
src/pages/check/loc/list/index.jsx Vedi File

@@ -1,7 +1,7 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 3
 import { View } from '@tarojs/components';
4
-import { Cell, Tag } from '@antmjs/vantui';
4
+import { Cell, Tag, Notify } from '@antmjs/vantui';
5 5
 import Page from '@/layouts/index';
6 6
 import PowerList from '@/components/PowerList';
7 7
 import { getTaCheckItem } from '@/services/tacheckitem';
@@ -22,6 +22,14 @@ export default (props) => {
22 22
   }), [checkId]);
23 23
 
24 24
   const onClick = (item) => {
25
+    if (item.answerNum >= item.num) {
26
+      Notify.show({
27
+        message: '当前测评问卷已收齐',
28
+        type: 'warning',
29
+      })
30
+      return;
31
+    }
32
+
25 33
     Taro.navigateTo({
26 34
       url: `/pages/check/edit/index?id=${item.itemId}&typ=${item.itemType}`
27 35
     })
@@ -40,7 +48,7 @@ export default (props) => {
40 48
             onClick={() => onClick(item)}
41 49
           >
42 50
             {
43
-              item.readonly ? <Tag color="var(--main-bg-color)">已答完</Tag> : null
51
+              item.num <= item.answerNum ? <Tag color="var(--main-bg-color)">{`${item.answerNum}/${item.num}`}</Tag> : null
44 52
             }
45 53
           </Cell>
46 54
         )}

+ 3
- 0
src/pages/checkStand/index.config.js Vedi File

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '测评标准'
3
+})

+ 31
- 0
src/pages/checkStand/index.jsx Vedi File

@@ -0,0 +1,31 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import Page from '@/layouts/index';
4
+import { View, RichText } from '@tarojs/components';
5
+import { getTaCheckStandById } from '@/services/tacheckstand';
6
+
7
+export default (props) => {
8
+
9
+  const [loading, setLoading] = React.useState(false);
10
+  const [detail, setDetail] = React.useState();
11
+
12
+  React.useEffect(() => {
13
+    setLoading(true);
14
+
15
+    // ID 固定是 1
16
+    getTaCheckStandById(1).then((res) => {
17
+      setDetail(res);
18
+      setLoading(false);
19
+    }).catch(() => {
20
+      setLoading(false);
21
+    });
22
+  }, []);
23
+  
24
+  return (
25
+    <Page tabBar="check" loading={loading}>
26
+      <View style={{ padding: 'var(--main-space)' }}>
27
+        <RichText style={{ lineHeight: '2em' }} nodes={detail?.content} />
28
+      </View>
29
+    </Page>
30
+  )
31
+}

src/pages/index3/index.less → src/pages/checkStand/index.less Vedi File


+ 27
- 3
src/pages/home/components/Head.jsx Vedi File

@@ -1,25 +1,49 @@
1 1
 import React from 'react';
2 2
 import { View, Image } from '@tarojs/components';
3
+import { ActionSheet, Cell } from '@antmjs/vantui';
3 4
 import { ROLES, ROLE_CITIZEN } from '@/utils/user';
4 5
 import logo from '@/assets/image/logo.png';
5 6
 import avatar from '@/assets/icons/avatar.png';
6 7
 import style from './head.module.less';
7 8
 
8 9
 export default (props) => {
9
-  const { user = {} } = props;
10
+  const { user = {}, duty, onDutyChange } = props;
10 11
   const { dutyList = [] } = user;
11
-  const role = ROLES[dutyList[0] || ROLE_CITIZEN];
12
+  const role = ROLES[duty || ROLE_CITIZEN];
13
+
14
+  const [show, setShow] = React.useState(false);
15
+
16
+  const actions = React.useMemo(() => {
17
+    return dutyList.map(x => ({name: ROLES[x], value: x}));
18
+  }, [dutyList]);
19
+
20
+  const onClick = () => {
21
+    if (dutyList.length < 1) return;
22
+    setShow(true);
23
+  }
24
+
25
+  const onSelect = (e) => {
26
+    onDutyChange(e.detail.value)
27
+  }
12 28
 
13 29
   return (
14 30
     <View className={style.head}>
15 31
       <View className={style.profile}>
16 32
         <View style={{ letterSpacing: '2px' }}>Hi, {user.name}!</View>
17
-        <View className={style.badge}>
33
+        <View className={style.badge} onClick={onClick}>
18 34
           <View className={style.icon}>
19 35
             <Image src={avatar} />
20 36
           </View>
21 37
           <View>{role}</View>
22 38
         </View>
39
+        <ActionSheet
40
+          title="请选择身份"
41
+          position="bottom"
42
+          show={show}
43
+          actions={actions}
44
+          onClose={() => setShow(false)}
45
+          onSelect={onSelect}
46
+        />
23 47
       </View>
24 48
       <View className={style.avatar}>
25 49
         <Image src={user.avatar || logo}></Image>

+ 22
- 11
src/pages/home/index.jsx Vedi File

@@ -3,52 +3,63 @@ import { View, Text, Image } from '@tarojs/components'
3 3
 import Page from '@/layouts/index';
4 4
 import { useModel } from '@/store';
5 5
 import MenuIcon from '@/components/MenuIcon';
6
-import { ROLE_INSPECTOR, ROLE_MANAGER, ROLE_ORG_USER } from '@/utils/user';
6
+import { ROLE_INSPECTOR, ROLE_MANAGER, ROLE_ORG_USER, ROLE_QUERY_PERSON } from '@/utils/user';
7 7
 import Head from './components/Head';
8 8
 import BannerCard from './components/BannerCard';
9 9
 import './index.less';
10 10
 
11 11
 const menus = {
12
+  // 督察员
12 13
   [ROLE_INSPECTOR]: [
13 14
     { icon: 'icon9', text: '我的上报', link: '/pages/issue/list/index' },
14
-    { icon: 'icon11', text: '消息通知', link: '' },
15
+    { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
15 16
     { icon: 'icon10', text: '模拟测评', link: '/pages/check/list/index' },
16 17
   ],
17 18
 
19
+  // 平台管理员
18 20
   [ROLE_MANAGER]: [
19 21
     { icon: 'icon1', text: '待 交 办', link: '/pages/issue/list2/index?title=待交办&bizStatus=start' },
20 22
     { icon: 'icon2', text: '已 交 办', link: '/pages/issue/list2/index?title=已交办&bizStatus=assigned' },
21
-    { icon: 'icon3', text: '已 办 结', link: '/pages/issue/list2/index?title=已办结&bizStatus=end' },
23
+    { icon: 'icon3', text: '已 办 结', link: '/pages/issue/list2/index?title=已办结&bizStatus=end' },
22 24
     { icon: 'icon4', text: '消单申请', link: '/pages/apply/list/index?title=消单申请&applyType=end' },
23 25
     { icon: 'icon5', text: '逾期警告', link: '/pages/issue/list2/index?title=逾期警告&bizStatus=expired' },
24 26
     { icon: 'icon6', text: '延期申请', link: '/pages/apply/list/index?title=延期申请&applyType=delay' },
25 27
     { icon: 'icon7', text: '统计查询', link: '' },
26 28
     { icon: 'icon9', text: '我的上报', link: '/pages/issue/list2/index?title=我的上报&mine=true' },
27
-    { icon: 'icon11', text: '消息通知', link: '' },
29
+    { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
28 30
   ],
29 31
 
32
+  // 责任单位用户
30 33
   [ROLE_ORG_USER]: [
31 34
     { icon: 'icon2', text: '处 理 中', link: '/pages/org/issue/list/index?title=处理中&bizStatus=assigned' },
32
-    { icon: 'icon3', text: '已 办 结', link: '/pages/org/issue/list/index?title=已办结&bizStatus=end' },
35
+    { icon: 'icon3', text: '已 办 结', link: '/pages/org/issue/list/index?title=已办结&bizStatus=end' },
33 36
     { icon: 'icon5', text: '已 逾 期', link: '' },
34 37
     { icon: 'icon7', text: '统计查询', link: '' },
35 38
     { icon: 'icon11', text: '消息通知', link: '/pages/message/list/index' },
36
-  ]
39
+  ],
40
+
41
+  // 查询人员
42
+  [ROLE_QUERY_PERSON]: [
43
+    { icon: 'icon1', text: '未 处 理', link: '/pages/issue/list2/index?title=未处理&bizStatus=start' },
44
+    { icon: 'icon2', text: '处 理 中', link: '/pages/issue/list2/index?title=处理中&bizStatus=assigned' },
45
+    { icon: 'icon3', text: '已 办 结', link: '/pages/issue/list2/index?title=已办结&bizStatus=end' },
46
+    { icon: 'icon7', text: '统计查询', link: '' },
47
+  ],
37 48
 }
38 49
 
39 50
 export default (props) => {
40 51
 
41
-  const { user } = useModel('user');
52
+  const { user, duty, updateDuty } = useModel('user');
42 53
 
43 54
   const menuArr = React.useMemo(() => {
44
-    if (!user || !user.dutyList) return [];
55
+    if (!duty) return [];
45 56
 
46
-    return menus[user.dutyList[0]];
47
-  }, [user])
57
+    return menus[duty];
58
+  }, [duty])
48 59
 
49 60
   return (
50 61
     <Page tabBar="home" className='home-page'>
51
-      <Head user={user} />
62
+      <Head user={user} duty={duty} onDutyChange={updateDuty} />
52 63
       <BannerCard />
53 64
 
54 65
       <View className="menu-icons">

+ 0
- 3
src/pages/index3/index.config.js Vedi File

@@ -1,3 +0,0 @@
1
-export default definePageConfig({
2
-  navigationBarTitleText: '首页'
3
-})

+ 0
- 24
src/pages/index3/index.jsx Vedi File

@@ -1,24 +0,0 @@
1
-import { Component } from 'react'
2
-import { View, Text } from '@tarojs/components'
3
-import './index.less'
4
-
5
-export default class Index extends Component {
6
-
7
-  componentWillMount () { }
8
-
9
-  componentDidMount () { }
10
-
11
-  componentWillUnmount () { }
12
-
13
-  componentDidShow () { }
14
-
15
-  componentDidHide () { }
16
-
17
-  render () {
18
-    return (
19
-      <View className='index'>
20
-        <Text>Hello world!</Text>
21
-      </View>
22
-    )
23
-  }
24
-}

+ 0
- 3
src/pages/index4/index.config.js Vedi File

@@ -1,3 +0,0 @@
1
-export default definePageConfig({
2
-  navigationBarTitleText: '首页'
3
-})

+ 0
- 24
src/pages/index4/index.jsx Vedi File

@@ -1,24 +0,0 @@
1
-import { Component } from 'react'
2
-import { View, Text } from '@tarojs/components'
3
-import './index.less'
4
-
5
-export default class Index extends Component {
6
-
7
-  componentWillMount () { }
8
-
9
-  componentDidMount () { }
10
-
11
-  componentWillUnmount () { }
12
-
13
-  componentDidShow () { }
14
-
15
-  componentDidHide () { }
16
-
17
-  render () {
18
-    return (
19
-      <View className='index'>
20
-        <Text>Hello world!</Text>
21
-      </View>
22
-    )
23
-  }
24
-}

+ 0
- 0
src/pages/index4/index.less Vedi File


+ 10
- 13
src/pages/issue/edit/index.jsx Vedi File

@@ -17,7 +17,7 @@ export default (props) => {
17 17
   const router = Taro.useRouter();
18 18
   const { id, act } = router.params;
19 19
 
20
-  const { user } = useModel('user');
20
+  const { user, duty } = useModel('user');
21 21
 
22 22
   const [loading, setLoading] = React.useState(false);
23 23
   const [issue, setIssue] = React.useState();
@@ -29,11 +29,8 @@ export default (props) => {
29 29
     canAssigned,
30 30
     canCancel,
31 31
   ] = React.useMemo(() => {
32
-    if (!issue) return [];
33
-    if (!user) return [];
34
-
35 32
     // 如果是督察员
36
-    if (user.dutyList.indexOf(ROLE_INSPECTOR) > -1) {
33
+    if (duty == ROLE_INSPECTOR) {
37 34
       return [
38 35
         issue.processNode != 'start' && issue.processStatus != 'reject',
39 36
         issue.processNode == 'start' || issue.processStatus == 'reject',
@@ -43,7 +40,7 @@ export default (props) => {
43 40
     }
44 41
 
45 42
     // 如果是管理员
46
-    if (user?.dutyList.indexOf(ROLE_MANAGER) > -1) {
43
+    if (duty == ROLE_MANAGER) {
47 44
       return [
48 45
         issue.processNode != 'start',
49 46
         false,
@@ -53,14 +50,14 @@ export default (props) => {
53 50
     }
54 51
 
55 52
     return [];
56
-  }, [issue, user]);
53
+  }, [issue, duty]);
57 54
 
58
-  const onIssueChange = (val = {}) => {
59
-    setIssue({
60
-      ...(issue || {}),
61
-      ...val,
62
-    })
63
-  }
55
+  // const onIssueChange = (val = {}) => {
56
+  //   setIssue({
57
+  //     ...(issue || {}),
58
+  //     ...val,
59
+  //   })
60
+  // }
64 61
   
65 62
   React.useEffect(() => {
66 63
     if (id) {

+ 9
- 3
src/pages/notice/components/Card/index.jsx Vedi File

@@ -2,13 +2,18 @@ import React from 'react';
2 2
 import { Cell, CellGroup } from '@antmjs/vantui';
3 3
 import { View } from '@tarojs/components';
4 4
 import Taro from '@tarojs/taro';
5
+import { getDtStr } from '@/utils/date';
5 6
 import style from './style.module.less';
6 7
 
7 8
 export default (props) => {
8 9
 
10
+  const { dataset } = props;
11
+
12
+  const dateStr = React.useMemo(() => dataset?.createDate ? getDtStr(dataset.createDate) : '-', [dataset]);
13
+
9 14
   const onClick = () => {
10 15
     Taro.navigateTo({
11
-      url: `/pages/notice/edit/index`
16
+      url: `/pages/notice/detail/index?id=${dataset.noticeId}`
12 17
     })
13 18
   }
14 19
 
@@ -16,14 +21,15 @@ export default (props) => {
16 21
     <View className={style['notice-card-wrapper']}>
17 22
       <CellGroup>
18 23
         <Cell
19
-          title="关于2022年模拟测评报告"
24
+          title={dataset?.title}
20 25
           isLink size="large"
21 26
           style={{ color: 'var(--main-bg-color)' }}
22 27
           onClick={() => onClick()}
23 28
         />
24 29
         <Cell
25 30
           renderTitle={(<>
26
-            <View className={style['notice-card-title']}>日期: </View><View className={style['notice-card-title2']}>2022-12-06 12:00</View>
31
+            <View className={style['notice-card-title']}>日期: </View>
32
+            <View className={style['notice-card-title2']}>{dateStr}</View>
27 33
           </>
28 34
           )}
29 35
         />

+ 0
- 20
src/pages/notice/components/Details/index.jsx Vedi File

@@ -1,20 +0,0 @@
1
-import React from 'react';
2
-import { View } from '@tarojs/components';
3
-import style from './style.module.less';
4
-
5
-export default (props) => {
6
-  return (
7
-    <View className={style['notice-wrapper']} style={style}>
8
-      <View className={style['notice-hd']}>
9
-        【关于2022年模拟测评公告】
10
-        <View className={style['notice-hd2']}>2022-12-06 12:00</View>
11
-      </View>
12
-      <View className={style['notice-bd']}>
13
-
14
-      </View>
15
-      <View className={style['notice-ft']}>
16
-
17
-      </View>
18
-    </View>
19
-  )
20
-}

+ 0
- 25
src/pages/notice/components/Details/style.module.less Vedi File

@@ -1,25 +0,0 @@
1
-.notice-wrapper {
2
-  height: 100%;
3
-  display: flex;
4
-  flex-direction: column;
5
-
6
-  .notice-hd {
7
-    flex: none;
8
-    margin: var(--main-space);
9
-    font-weight: bold;
10
-    .notice-hd2 {
11
-      font-weight: 400;
12
-      margin-left: var(--main-space);
13
-    }
14
-  }
15
-
16
-  .notice-bd {
17
-    flex: 1;
18
-    overflow: hidden;
19
-    margin: var(--main-space);
20
-  }
21
-
22
-  .notice-ft {
23
-    flex: none;
24
-  }
25
-}

src/pages/notice/edit/index.config.js → src/pages/notice/detail/index.config.js Vedi File


+ 65
- 0
src/pages/notice/detail/index.jsx Vedi File

@@ -0,0 +1,65 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, Image, RichText } from '@tarojs/components';
4
+import Page from '@/layouts/index';
5
+import { getTaNoticeById } from '@/services/tanotice';
6
+import { getDtStr } from '@/utils/date';
7
+import style from './style.module.less';
8
+
9
+export default (props) => {
10
+
11
+  const [loading, setLoading] = React.useState(false);
12
+  const [detail, setDetail] = React.useState();
13
+  const dateStr = React.useMemo(() => detail?.createDate ? getDtStr(detail.createDate) : '-', [detail]);
14
+
15
+  const router = Taro.useRouter();
16
+  const { id } = router.params;
17
+
18
+  const onPreview = () => {
19
+    if (!detail?.thumb) return;
20
+
21
+    Taro.previewMedia({
22
+      sources: [
23
+        {
24
+          url: detail.thumb,
25
+        },        
26
+      ],
27
+      current: 0,
28
+    })
29
+  }
30
+
31
+  React.useEffect(() => {
32
+    if (id) {
33
+      setLoading(true);
34
+      getTaNoticeById(id).then((res) => {
35
+        setDetail(res);
36
+        Taro.setNavigationBarTitle({
37
+          title: res.title,
38
+        })
39
+        setLoading(false);
40
+      }).catch(er => {
41
+        console.error(er);
42
+        setLoading(false);
43
+      });
44
+    }
45
+  }, [id]);
46
+
47
+  
48
+  return (
49
+    <Page loading={loading}>
50
+      <View className={style['notice-wrapper']} style={style}>
51
+        <View className={style['notice-hd']}>
52
+          {detail?.title}
53
+          <View className={style['notice-hd2']}>{dateStr}</View>
54
+        </View>
55
+        <View className={style['notice-bd']}>
56
+          <Image src={detail?.thumb} onClick={onPreview}></Image>
57
+          <RichText nodes={detail?.content} />
58
+        </View>
59
+        <View className={style['notice-ft']}>
60
+
61
+        </View>
62
+      </View>
63
+    </Page>
64
+  )
65
+}

+ 30
- 0
src/pages/notice/detail/style.module.less Vedi File

@@ -0,0 +1,30 @@
1
+.notice-wrapper {
2
+  height: 100%;
3
+  overflow-y: auto;
4
+  padding: var(--main-space);
5
+
6
+  .notice-hd {
7
+    font-size: 36px;
8
+    line-height: 2em;
9
+    text-align: center;
10
+
11
+    .notice-hd2 {
12
+      text-align: right;
13
+      font-size: 24px;
14
+      margin-left: var(--main-space);
15
+    }
16
+  }
17
+
18
+  .notice-bd {
19
+    image {
20
+      width: 100%;
21
+    }
22
+
23
+    rich-text {
24
+      line-height: 2em;
25
+    }
26
+  }
27
+
28
+  .notice-ft {
29
+  }
30
+}

+ 0
- 11
src/pages/notice/edit/index.jsx Vedi File

@@ -1,11 +0,0 @@
1
-import React from 'react';
2
-import Page from '@/layouts/index';
3
-import Details from '../components/Details/index';
4
-
5
-export default (props) => {
6
-  return (
7
-    <Page>
8
-      <Details />
9
-    </Page>
10
-  )
11
-}

+ 11
- 1
src/pages/notice/index.jsx Vedi File

@@ -1,12 +1,22 @@
1 1
 import React from 'react';
2 2
 import Page from '@/layouts/index';
3
+import PowerList from '@/components/PowerList';
4
+import { getTaNotice } from '@/services/tanotice';
3 5
 import Card from './components/Card/index';
4 6
 
5 7
 export default (props) => {
6 8
 
9
+  const [loading, setLoading] = React.useState(false);
10
+
7 11
   return (
8 12
     <Page tabBar="notice">
9
-      <Card />
13
+      <PowerList
14
+        request={getTaNotice}
15
+        params={{status: 1}}
16
+        renderItem={(item) => (
17
+          <Card key={item.noticeId} dataset={item} />
18
+        )}
19
+      />
10 20
     </Page>
11 21
   )
12 22
 }

+ 154
- 20
src/pages/statistics/index.jsx Vedi File

@@ -23,24 +23,33 @@ export default (props) => {
23 23
       title: {
24 24
         text: '上报统计'
25 25
       },
26
-      grid: {
27
-        containLabel: true
28
-      },
29 26
       tooltip: {
30
-        show: true,
31
-        trigger: 'axis'
32
-      },
33
-      xAxis: {
34
-        type: 'category',
35
-        boundaryGap: false,
36
-        data: ['12/01', '12/02', '12/03', '12/04', '12/05', '12/06', '12/07'],
37
-        // show: false
27
+        trigger: 'axis',
28
+        axisPointer: {
29
+          type: 'cross',
30
+          label: {
31
+            backgroundColor: '#0A9071'
32
+          }
33
+        }
38 34
       },
39
-      yAxis: {
40
-        x: 'center',
41
-        type: 'value',
42
-        // show: false
35
+      grid: {
36
+        left: '3%',
37
+        right: '4%',
38
+        bottom: '3%',
39
+        containLabel: true
43 40
       },
41
+      xAxis: [
42
+        {
43
+          type: 'category',
44
+          boundaryGap: false,
45
+          data: ['12/01', '12/02', '12/03', '12/04', '12/05', '12/06', '12/07']
46
+        }
47
+      ],
48
+      yAxis: [
49
+        {
50
+          type: 'value'
51
+        }
52
+      ],
44 53
       series: [
45 54
         {
46 55
           name: 'Line 1',
@@ -56,18 +65,18 @@ export default (props) => {
56 65
             color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
57 66
               {
58 67
                 offset: 0,
59
-                color: 'rgb(128, 255, 165)'
68
+                color: '#0A9071'
60 69
               },
61 70
               {
62 71
                 offset: 1,
63
-                color: 'rgb(1, 191, 236)'
72
+                color: '#FFF'
64 73
               }
65 74
             ])
66 75
           },
67 76
           emphasis: {
68 77
             focus: 'series'
69 78
           },
70
-          data: [180, 332, 191, 294, 210, 151, 230]
79
+          data: [1.8, 3.3, 1.9, 2.9, 2.1, 1.5, 2.3]
71 80
         }
72 81
       ]
73 82
     };
@@ -80,6 +89,125 @@ export default (props) => {
80 89
     onInit: initChart
81 90
   };
82 91
 
92
+  function initChart2 (canvas, width, height, dpr) {
93
+
94
+    console.log('---------->', canvas, width, height)
95
+
96
+    const chart = echarts.init(canvas, null, {
97
+      width: width,
98
+      height: height,
99
+      devicePixelRatio: dpr // new
100
+    });
101
+    canvas.setChart(chart);
102
+
103
+    var option = {
104
+      title: {
105
+        text: '交办统计'
106
+      },
107
+      grid: {
108
+        left: '3%',
109
+        right: '4%',
110
+        bottom: '3%',
111
+        containLabel: true
112
+      },
113
+      xAxis: [
114
+        {
115
+          type: 'category',
116
+          boundaryGap: false,
117
+          data: ['已处理', '未处理', '逾期'],
118
+          boundaryGap: true,
119
+          axisTick: {
120
+            alignWithLabel: true,
121
+          }
122
+        }
123
+      ],
124
+      yAxis: [
125
+        {
126
+          type: 'value'
127
+        }
128
+      ],
129
+      series: [
130
+        {
131
+          type: 'bar',
132
+          itemStyle: {
133
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
134
+              { offset: 0, color: '#F772D1' },
135
+              { offset: 0.5, color: '#C872F2' },
136
+              { offset: 1, color: '#E5BEF8' }
137
+            ])
138
+          },
139
+          data: [2, 3, 1]
140
+        }
141
+      ]
142
+    };
143
+
144
+    chart.setOption(option);
145
+    return chart;
146
+  }
147
+
148
+  const ec2 = {
149
+    onInit: initChart2
150
+  };
151
+
152
+  function initChart3 (canvas, width, height, dpr) {
153
+
154
+    console.log('---------->', canvas, width, height)
155
+
156
+    const chart = echarts.init(canvas, null, {
157
+      width: width,
158
+      height: height,
159
+      devicePixelRatio: dpr // new
160
+    });
161
+    canvas.setChart(chart);
162
+
163
+    var option = {
164
+      title: {
165
+        text: '问题分类'
166
+      },
167
+      grid: {
168
+        left: '3%',
169
+        right: '4%',
170
+        bottom: '3%',
171
+        containLabel: true
172
+      },
173
+      xAxis: [
174
+        {
175
+          type: 'category',
176
+          boundaryGap: false,
177
+          data: ['公益宣传', '环境卫生', '基础设施', '文明素养', '公共秩序', '其他'],
178
+          boundaryGap: true,
179
+          axisTick: {
180
+            alignWithLabel: true,
181
+          }
182
+        }
183
+      ],
184
+      yAxis: [
185
+        {
186
+          type: 'value'
187
+        }
188
+      ],
189
+      series: [
190
+        {
191
+          type: 'bar',
192
+          itemStyle: {
193
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
194
+              { offset: 0, color: '#FB9900' },
195
+              { offset: 1, color: '#FFD38F' }
196
+            ])
197
+          },
198
+          data: [2, 1, 2, 3, 2, 1]
199
+        }
200
+      ]
201
+    };
202
+
203
+    chart.setOption(option);
204
+    return chart;
205
+  }
206
+
207
+  const ec3 = {
208
+    onInit: initChart3
209
+  };
210
+
83 211
   return (
84 212
     <Page>
85 213
       <View>
@@ -87,8 +215,14 @@ export default (props) => {
87 215
           <Cell title="时间维度" isLink value="本周" />
88 216
         </CellGroup>
89 217
       </View>
90
-      <view class="container" style={{ height: '500px' }}>
91
-        <ec-canvas canvasId="mychart-bar" ec={ec}></ec-canvas>
218
+      <view class="container">
219
+        <ec-canvas canvasId="mychart-line" ec={ec}></ec-canvas>
220
+      </view>
221
+      <view class="container">
222
+        <ec-canvas canvasId="mychart-bar" ec={ec2}></ec-canvas>
223
+      </view>
224
+      <view class="container">
225
+        <ec-canvas canvasId="mychart-bar" ec={ec3}></ec-canvas>
92 226
       </view>
93 227
     </Page>
94 228
   )

+ 7
- 0
src/pages/statistics/index.less Vedi File

@@ -0,0 +1,7 @@
1
+.container {
2
+  box-shadow: 0px 18px 22px 0px rgba(0, 0, 0, 0.06);
3
+  border-radius: 8px;
4
+  margin: var(--main-space);
5
+  height: 24%;
6
+  margin-bottom: 20px;
7
+}

+ 29
- 0
src/services/tacheckstand.js Vedi File

@@ -0,0 +1,29 @@
1
+import request from '@/utils/request';
2
+
3
+/*
4
+ * 分页查询
5
+ */
6
+export const getTaCheckStand = (params) => request('/api/taCheckStand', { params });
7
+
8
+/*
9
+ * 新增数据
10
+ */
11
+export const postTaCheckStand = (data) => request('/api/taCheckStand', { data, method: 'post' });
12
+
13
+/*
14
+ * 通过ID查询单条数据
15
+ */
16
+export const getTaCheckStandById = (id) => request(`/api/taCheckStand/${id}`);
17
+
18
+/**
19
+ * 更新数据
20
+ * @param {*} id
21
+ * @param {*} data
22
+ * @returns
23
+ */
24
+export const putTaCheckStand = (id, data) => request(`/api/taCheckStand/${id}`, { data, method: 'put' });
25
+
26
+/*
27
+ * 通过主键删除数据
28
+ */
29
+export const deleteTaCheckStand = (id) => request(`/api/taCheckStand/${id}`, { method: 'delete' });

+ 26
- 0
src/services/tanotice.js Vedi File

@@ -0,0 +1,26 @@
1
+import request from '@/utils/request';
2
+
3
+/*
4
+ * 分页查询
5
+ */
6
+export const getTaNotice = (params) => request('/api/taNotice', { params });
7
+
8
+/*
9
+ * 新增数据
10
+ */
11
+export const postTaNotice = (data) => request('/api/taNotice', { data, method: 'post' });
12
+
13
+/*
14
+ * 通过ID查询单条数据
15
+ */
16
+export const getTaNoticeById = (id) => request(`/api/taNotice/${id}`);
17
+
18
+/*
19
+ * 更新数据
20
+ */
21
+export const putTaNotice = (id, data) => request(`/api/taNotice/${id}`, { data, method: 'put' });
22
+
23
+/*
24
+ * 通过主键删除数据
25
+ */
26
+export const deleteTaNotice = (id) => request(`/api/taNotice/${id}`, { method: 'delete' });

+ 25
- 1
src/store/user.js Vedi File

@@ -6,6 +6,7 @@ import { login, signin, currentUser } from '@/services/wxma';
6 6
 export default function useUser() {
7 7
   const [person, setPerson] = React.useState();
8 8
   const [user, setUser] = React.useState();
9
+  const [duty, setDuty] = React.useState();
9 10
 
10 11
   const maLogin = (code) => {
11 12
     login(code).then(res => {
@@ -15,20 +16,41 @@ export default function useUser() {
15 16
     });
16 17
   }
17 18
 
19
+  const updateDuty = (d) => {
20
+    setDuty(d);
21
+    Taro.setStorageSync('duty', d);
22
+  }
23
+
24
+  const initDuty = (u) => {
25
+    const d = Taro.getStorageSync('duty');
26
+    const dutyList = u?.dutyList || [];
27
+    if (d) {
28
+      if (dutyList.indexOf(d) < 0) {
29
+        updateDuty(dutyList[0]);
30
+      } else {
31
+        updateDuty(d);
32
+      }
33
+    } else {
34
+      updateDuty(dutyList[0]);
35
+    }
36
+  }
37
+
18 38
   const maSignIn = (params) => {
19 39
     const data = {
20 40
       ...params,
21 41
       password: md5(params.password)
22
-    }
42
+    };
23 43
 
24 44
     return signin(data).then(res => {
25 45
       setUser(res.user);
46
+      initDuty(res.user);
26 47
     })
27 48
   }
28 49
 
29 50
   const current = () => {
30 51
     currentUser().then(res => {
31 52
       setUser(res.user);
53
+      initDuty(res.user);
32 54
     })
33 55
   }
34 56
 
@@ -36,7 +58,9 @@ export default function useUser() {
36 58
     user,
37 59
     person,
38 60
     current,
61
+    duty,
39 62
     signin: maSignIn,
40 63
     login: maLogin,
64
+    updateDuty,
41 65
   }
42 66
 }