fangmingyue 2 years ago
parent
commit
787ac087fe

+ 1
- 0
config/prod.js View File

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

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

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

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

4
 
4
 
5
 export default (props) => {
5
 export default (props) => {
6
   const { roles = [] } = props;
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
   return !roles.length || hasRights ? props.children : (
11
   return !roles.length || hasRights ? props.children : (
24
     <View style={{width: '100%', height: '100%', display: 'grid', placeItems: 'center'}}>
12
     <View style={{width: '100%', height: '100%', display: 'grid', placeItems: 'center'}}>

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

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

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

11
 export default (props) => {
11
 export default (props) => {
12
   const { className, style, roles, tabBar = false, loading } = props;
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
   const containerClass = `${laySty['page-conatiner']} ${tabBar ? laySty['with-tabbar'] : ''} ${className}`;
16
   const containerClass = `${laySty['page-conatiner']} ${tabBar ? laySty['with-tabbar'] : ''} ${className}`;
17
 
17
 
51
         }
51
         }
52
       </View>
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
     </View>
56
     </View>
57
   )
57
   )

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

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
   return (
43
   return (
44
     <View>
44
     <View>

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

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
   return (
42
   return (
43
     <View>
43
     <View>

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

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

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

1
 import React from 'react';
1
 import React from 'react';
2
 import Taro from '@tarojs/taro';
2
 import Taro from '@tarojs/taro';
3
 import { View } from '@tarojs/components';
3
 import { View } from '@tarojs/components';
4
-import { Cell, Tag } from '@antmjs/vantui';
4
+import { Cell, Tag, Notify } from '@antmjs/vantui';
5
 import Page from '@/layouts/index';
5
 import Page from '@/layouts/index';
6
 import PowerList from '@/components/PowerList';
6
 import PowerList from '@/components/PowerList';
7
 import { getTaCheckItem } from '@/services/tacheckitem';
7
 import { getTaCheckItem } from '@/services/tacheckitem';
22
   }), [checkId]);
22
   }), [checkId]);
23
 
23
 
24
   const onClick = (item) => {
24
   const onClick = (item) => {
25
+    if (item.answerNum >= item.num) {
26
+      Notify.show({
27
+        message: '当前测评问卷已收齐',
28
+        type: 'warning',
29
+      })
30
+      return;
31
+    }
32
+
25
     Taro.navigateTo({
33
     Taro.navigateTo({
26
       url: `/pages/check/edit/index?id=${item.itemId}&typ=${item.itemType}`
34
       url: `/pages/check/edit/index?id=${item.itemId}&typ=${item.itemType}`
27
     })
35
     })
40
             onClick={() => onClick(item)}
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
           </Cell>
53
           </Cell>
46
         )}
54
         )}

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

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

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

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 View File


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

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

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

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

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

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

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

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 View File

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

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

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 View File


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

17
   const router = Taro.useRouter();
17
   const router = Taro.useRouter();
18
   const { id, act } = router.params;
18
   const { id, act } = router.params;
19
 
19
 
20
-  const { user } = useModel('user');
20
+  const { user, duty } = useModel('user');
21
 
21
 
22
   const [loading, setLoading] = React.useState(false);
22
   const [loading, setLoading] = React.useState(false);
23
   const [issue, setIssue] = React.useState();
23
   const [issue, setIssue] = React.useState();
29
     canAssigned,
29
     canAssigned,
30
     canCancel,
30
     canCancel,
31
   ] = React.useMemo(() => {
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
       return [
34
       return [
38
         issue.processNode != 'start' && issue.processStatus != 'reject',
35
         issue.processNode != 'start' && issue.processStatus != 'reject',
39
         issue.processNode == 'start' || issue.processStatus == 'reject',
36
         issue.processNode == 'start' || issue.processStatus == 'reject',
43
     }
40
     }
44
 
41
 
45
     // 如果是管理员
42
     // 如果是管理员
46
-    if (user?.dutyList.indexOf(ROLE_MANAGER) > -1) {
43
+    if (duty == ROLE_MANAGER) {
47
       return [
44
       return [
48
         issue.processNode != 'start',
45
         issue.processNode != 'start',
49
         false,
46
         false,
53
     }
50
     }
54
 
51
 
55
     return [];
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
   React.useEffect(() => {
62
   React.useEffect(() => {
66
     if (id) {
63
     if (id) {

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

2
 import { Cell, CellGroup } from '@antmjs/vantui';
2
 import { Cell, CellGroup } from '@antmjs/vantui';
3
 import { View } from '@tarojs/components';
3
 import { View } from '@tarojs/components';
4
 import Taro from '@tarojs/taro';
4
 import Taro from '@tarojs/taro';
5
+import { getDtStr } from '@/utils/date';
5
 import style from './style.module.less';
6
 import style from './style.module.less';
6
 
7
 
7
 export default (props) => {
8
 export default (props) => {
8
 
9
 
10
+  const { dataset } = props;
11
+
12
+  const dateStr = React.useMemo(() => dataset?.createDate ? getDtStr(dataset.createDate) : '-', [dataset]);
13
+
9
   const onClick = () => {
14
   const onClick = () => {
10
     Taro.navigateTo({
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
     <View className={style['notice-card-wrapper']}>
21
     <View className={style['notice-card-wrapper']}>
17
       <CellGroup>
22
       <CellGroup>
18
         <Cell
23
         <Cell
19
-          title="关于2022年模拟测评报告"
24
+          title={dataset?.title}
20
           isLink size="large"
25
           isLink size="large"
21
           style={{ color: 'var(--main-bg-color)' }}
26
           style={{ color: 'var(--main-bg-color)' }}
22
           onClick={() => onClick()}
27
           onClick={() => onClick()}
23
         />
28
         />
24
         <Cell
29
         <Cell
25
           renderTitle={(<>
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 View File

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 View File

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 View File


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

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 View File

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 View File

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 View File

1
 import React from 'react';
1
 import React from 'react';
2
 import Page from '@/layouts/index';
2
 import Page from '@/layouts/index';
3
+import PowerList from '@/components/PowerList';
4
+import { getTaNotice } from '@/services/tanotice';
3
 import Card from './components/Card/index';
5
 import Card from './components/Card/index';
4
 
6
 
5
 export default (props) => {
7
 export default (props) => {
6
 
8
 
9
+  const [loading, setLoading] = React.useState(false);
10
+
7
   return (
11
   return (
8
     <Page tabBar="notice">
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
     </Page>
20
     </Page>
11
   )
21
   )
12
 }
22
 }

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

23
       title: {
23
       title: {
24
         text: '上报统计'
24
         text: '上报统计'
25
       },
25
       },
26
-      grid: {
27
-        containLabel: true
28
-      },
29
       tooltip: {
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
       series: [
53
       series: [
45
         {
54
         {
46
           name: 'Line 1',
55
           name: 'Line 1',
56
             color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
65
             color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
57
               {
66
               {
58
                 offset: 0,
67
                 offset: 0,
59
-                color: 'rgb(128, 255, 165)'
68
+                color: '#0A9071'
60
               },
69
               },
61
               {
70
               {
62
                 offset: 1,
71
                 offset: 1,
63
-                color: 'rgb(1, 191, 236)'
72
+                color: '#FFF'
64
               }
73
               }
65
             ])
74
             ])
66
           },
75
           },
67
           emphasis: {
76
           emphasis: {
68
             focus: 'series'
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
     onInit: initChart
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
   return (
211
   return (
84
     <Page>
212
     <Page>
85
       <View>
213
       <View>
87
           <Cell title="时间维度" isLink value="本周" />
215
           <Cell title="时间维度" isLink value="本周" />
88
         </CellGroup>
216
         </CellGroup>
89
       </View>
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
       </view>
226
       </view>
93
     </Page>
227
     </Page>
94
   )
228
   )

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

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 View File

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 View File

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 View File

6
 export default function useUser() {
6
 export default function useUser() {
7
   const [person, setPerson] = React.useState();
7
   const [person, setPerson] = React.useState();
8
   const [user, setUser] = React.useState();
8
   const [user, setUser] = React.useState();
9
+  const [duty, setDuty] = React.useState();
9
 
10
 
10
   const maLogin = (code) => {
11
   const maLogin = (code) => {
11
     login(code).then(res => {
12
     login(code).then(res => {
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
   const maSignIn = (params) => {
38
   const maSignIn = (params) => {
19
     const data = {
39
     const data = {
20
       ...params,
40
       ...params,
21
       password: md5(params.password)
41
       password: md5(params.password)
22
-    }
42
+    };
23
 
43
 
24
     return signin(data).then(res => {
44
     return signin(data).then(res => {
25
       setUser(res.user);
45
       setUser(res.user);
46
+      initDuty(res.user);
26
     })
47
     })
27
   }
48
   }
28
 
49
 
29
   const current = () => {
50
   const current = () => {
30
     currentUser().then(res => {
51
     currentUser().then(res => {
31
       setUser(res.user);
52
       setUser(res.user);
53
+      initDuty(res.user);
32
     })
54
     })
33
   }
55
   }
34
 
56
 
36
     user,
58
     user,
37
     person,
59
     person,
38
     current,
60
     current,
61
+    duty,
39
     signin: maSignIn,
62
     signin: maSignIn,
40
     login: maLogin,
63
     login: maLogin,
64
+    updateDuty,
41
   }
65
   }
42
 }
66
 }