fangmingyue преди 2 години
родител
ревизия
896d1bad13
променени са 45 файла, в които са добавени 1750 реда и са изтрити 353 реда
  1. 3
    0
      src/app.config.js
  2. 40
    28
      src/components/Pickerful/index.jsx
  3. 0
    13
      src/components/Pickerful/style.module.less
  4. 12
    1
      src/components/PowerList/index.jsx
  5. 30
    0
      src/components/VABC/index.jsx
  6. 19
    0
      src/components/VABC/style.module.less
  7. 2
    1
      src/components/map/index.jsx
  8. 2
    2
      src/layouts/TabBar.jsx
  9. 0
    26
      src/pages/check/edit/components/Choice.jsx
  10. 65
    0
      src/pages/check/edit/components/Footer/index.jsx
  11. 21
    0
      src/pages/check/edit/components/Footer/style.module.less
  12. 61
    0
      src/pages/check/edit/components/LocForm.jsx
  13. 68
    0
      src/pages/check/edit/components/QuSelect/index.jsx
  14. 50
    0
      src/pages/check/edit/components/QuSelect/style.module.less
  15. 107
    0
      src/pages/check/edit/components/Question.jsx
  16. 0
    13
      src/pages/check/edit/components/choice.module.less
  17. 3
    3
      src/pages/check/edit/index.config.js
  18. 250
    249
      src/pages/check/edit/index.jsx
  19. 51
    0
      src/pages/check/list/components/Card.jsx
  20. 39
    0
      src/pages/check/list/components/style.module.less
  21. 23
    10
      src/pages/check/list/index.jsx
  22. 65
    0
      src/pages/check/loc/edit/components/Footer/index.jsx
  23. 21
    0
      src/pages/check/loc/edit/components/Footer/style.module.less
  24. 61
    0
      src/pages/check/loc/edit/components/LocForm.jsx
  25. 68
    0
      src/pages/check/loc/edit/components/QuSelect/index.jsx
  26. 50
    0
      src/pages/check/loc/edit/components/QuSelect/style.module.less
  27. 107
    0
      src/pages/check/loc/edit/components/Question.jsx
  28. 4
    0
      src/pages/check/loc/edit/index.config.js
  29. 207
    0
      src/pages/check/loc/edit/index.jsx
  30. 4
    0
      src/pages/check/loc/list/index.config.js
  31. 51
    0
      src/pages/check/loc/list/index.jsx
  32. 1
    1
      src/pages/issue/components/Issue/index.jsx
  33. 33
    0
      src/pages/notice/components/Card/index.jsx
  34. 15
    0
      src/pages/notice/components/Card/style.module.less
  35. 20
    0
      src/pages/notice/components/Details/index.jsx
  36. 25
    0
      src/pages/notice/components/Details/style.module.less
  37. 4
    0
      src/pages/notice/edit/index.config.js
  38. 11
    0
      src/pages/notice/edit/index.jsx
  39. 4
    0
      src/pages/notice/list/index.config.js
  40. 12
    0
      src/pages/notice/list/index.jsx
  41. 29
    0
      src/services/tacheck.js
  42. 29
    0
      src/services/tacheckansweritem.js
  43. 46
    0
      src/services/tacheckitem.js
  44. 29
    0
      src/services/tacheckitemqu.js
  45. 8
    6
      src/utils/request.js

+ 3
- 0
src/app.config.js Целия файл

@@ -20,7 +20,10 @@ export default defineAppConfig({
20 20
     'pages/reporting/detail/index',
21 21
     'pages/reset-password/index',
22 22
     'pages/check/list/index',
23
+    'pages/check/loc/list/index',
23 24
     'pages/check/edit/index',
25
+    'pages/notice/list/index',
26
+    'pages/notice/edit/index',
24 27
   ],
25 28
   window: {
26 29
     // backgroundColor: '#1A7565',

+ 40
- 28
src/components/Pickerful/index.jsx Целия файл

@@ -1,7 +1,13 @@
1 1
 import React from 'react';
2 2
 import { View, ScrollView } from '@tarojs/components';
3 3
 import { Button, Popup, Search, Cell, Icon } from '@antmjs/vantui';
4
-import style from './style.module.less';
4
+import VABC from '@/components/VABC';
5
+
6
+const wrapperStyle = {
7
+  width: '90vw',
8
+  height: '100vh',
9
+  paddingBottom: 'env(safe-area-inset-bottom)',
10
+}
5 11
 
6 12
 export default (props) => {
7 13
   const { show, value, keyValue, labelValue = 'name', dictAPI, onChange, onCancel } = props;
@@ -37,33 +43,39 @@ export default (props) => {
37 43
   
38 44
   return (
39 45
     <Popup position="right" show={show} onClose={onCancel}>
40
-      <View className={style['pickerful-box']}>
41
-        <Search
42
-          onChange={(e) => setSearchText(e.detail)}
43
-          placeholder="请输入搜索关键词"
44
-          onSearch={onSearch}
45
-          clearable
46
-        />
47
-        <ScrollView scrollY style={{ flex: 1 }}>
48
-          {
49
-            list.map(item => (
50
-              <Cell
51
-                key={item[keyValue]}
52
-                title={item[labelValue]}
53
-                renderRightIcon={
54
-                  checked && checked[keyValue] == item[keyValue] ?
55
-                  <Icon name="success" color="#1A7565" /> :
56
-                  null
57
-                }
58
-                onClick={() => setChecked(item)}
59
-              />
60
-            ))
61
-          }
62
-        </ScrollView>
63
-        <View style={{ padding: '8px 2em' }}>
64
-          <Button block type="primary" disabled={!checked} onClick={onClick}>确定</Button>
65
-        </View>
66
-      </View>
46
+      <VABC
47
+        header={(
48
+          <Search
49
+            onChange={(e) => setSearchText(e.detail)}
50
+            placeholder="请输入搜索关键词"
51
+            onSearch={onSearch}
52
+            clearable
53
+          />
54
+        )}
55
+        footer={(
56
+          <View style={{ padding: '8px 2em' }}>
57
+            <Button block type="primary" disabled={!checked} onClick={onClick}>确定</Button>
58
+          </View>
59
+        )}
60
+        style={wrapperStyle}
61
+      >
62
+          <ScrollView scrollY style={{ height: '100%' }}>
63
+            {
64
+              list.map(item => (
65
+                <Cell
66
+                  key={item[keyValue]}
67
+                  title={item[labelValue]}
68
+                  renderRightIcon={
69
+                    checked && checked[keyValue] == item[keyValue] ?
70
+                    <Icon name="success" color="#1A7565" /> :
71
+                    null
72
+                  }
73
+                  onClick={() => setChecked(item)}
74
+                />
75
+              ))
76
+            }
77
+          </ScrollView>
78
+      </VABC>
67 79
     </Popup>
68 80
   )
69 81
 }

+ 0
- 13
src/components/Pickerful/style.module.less Целия файл

@@ -1,13 +0,0 @@
1
-
2
-.pickerful-box {
3
-  width: 90vw;
4
-  height: 100vh;
5
-  padding-bottom: env(safe-area-inset-bottom);
6
-  display: flex;
7
-  flex-direction: column;
8
-
9
-  & > view {
10
-    flex: none;
11
-  }
12
-}
13
-

+ 12
- 1
src/components/PowerList/index.jsx Целия файл

@@ -4,17 +4,26 @@ import { View } from '@tarojs/components';
4 4
 import { PowerScrollView } from '@antmjs/vantui';
5 5
 
6 6
 export default (props) => {
7
-  const { request, params, renderItem } = props;
7
+  const { request, params, renderItem, onLoadingChange } = props;
8 8
 
9 9
   const pageSize = 20;
10 10
   const pageNumRef = React.useRef(1);
11 11
   const listRef = React.useRef([]);
12
+  const [loading, setLoading] = React.useState(false);
12 13
   const [list, setList] = React.useState([]);
13 14
   const [finished, setFinished] = React.useState(true);
14 15
   listRef.current = list;
15 16
 
17
+  const changeLoading = (val) => {
18
+    setLoading(val);
19
+    if (onLoadingChange) {
20
+      onLoadingChange(val);
21
+    }
22
+  }
23
+
16 24
   const queryData = React.useCallback((options = {}) => {
17 25
     return new Promise((resolve, reject) => {
26
+      changeLoading(true);
18 27
       request({
19 28
         pageSize,
20 29
         ...(params || {}),
@@ -29,8 +38,10 @@ export default (props) => {
29 38
         }
30 39
 
31 40
         setFinished(current >= pages);
41
+        changeLoading(false);
32 42
         resolve();
33 43
       }).catch((err) => {
44
+        changeLoading(false);
34 45
         reject(err);
35 46
       });
36 47
     });

+ 30
- 0
src/components/VABC/index.jsx Целия файл

@@ -0,0 +1,30 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import clsScope from './style.module.less';
5
+
6
+export default (props) => {
7
+  const { style, header, footer  } = props;
8
+  
9
+  return (
10
+    <View className={clsScope['v-abc-wrapper']} style={style}>
11
+      {
12
+        header && (
13
+          <View className={clsScope['v-abc-hd']}>
14
+            {header}
15
+          </View>
16
+        )
17
+      }
18
+      <View className={clsScope['v-abc-bd']}>
19
+        {props.children}
20
+      </View>
21
+      {
22
+        footer && (
23
+          <View className={clsScope['v-abc-ft']}>
24
+            {footer}
25
+          </View>
26
+        )
27
+      }
28
+    </View>
29
+  )
30
+}

+ 19
- 0
src/components/VABC/style.module.less Целия файл

@@ -0,0 +1,19 @@
1
+
2
+.v-abc-wrapper {
3
+  height: 100%;
4
+  display: flex;
5
+  flex-direction: column;
6
+
7
+  .v-abc-hd {
8
+    flex: none;
9
+  }
10
+
11
+  .v-abc-bd {
12
+    flex: 1;
13
+    overflow: hidden;
14
+  }
15
+
16
+  .v-abc-ft {
17
+    flex: none;
18
+  }
19
+}

+ 2
- 1
src/components/map/index.jsx Целия файл

@@ -6,7 +6,7 @@ import iconPath from '@/assets/icons/marker.png';
6 6
 import style from './style.module.less';
7 7
 
8 8
 export default (props) => {
9
-  const { location } = props;
9
+  const { location, onLocChange } = props;
10 10
 
11 11
   const [currentPos, setCurPos] = React.useState();
12 12
   const [lngLat, setLngLat] = React.useState([,]);
@@ -39,6 +39,7 @@ export default (props) => {
39 39
   React.useEffect(() => {
40 40
     getLocation().then((res) => {
41 41
       setCurPos(res);
42
+      onLocChange([res.longitude, res.latitude].join(','))
42 43
     }).catch((err) => {
43 44
       Taro.showToast({
44 45
         title: '定位失败',

+ 2
- 2
src/layouts/TabBar.jsx Целия файл

@@ -33,7 +33,7 @@ const notice = {
33 33
   label: '公告',
34 34
   icon: noticeIcon,
35 35
   activeIcon: noticeActiveIcon,
36
-  page: '/pages/index3/index'
36
+  page: '/pages/notice/list/index'
37 37
 }
38 38
 const issue = {
39 39
   name: 'issue',
@@ -62,7 +62,7 @@ export default (props) => {
62 62
 
63 63
   const tabItems = React.useMemo(() => {
64 64
     if (!user) return [];
65
-    
65
+
66 66
     if (user.dutyList.indexOf(ROLE_INSPECTOR) > -1 // 督察员
67 67
       || user.dutyList.indexOf(ROLE_MANAGER) > -1 // 管理员
68 68
     ) {

+ 0
- 26
src/pages/check/edit/components/Choice.jsx Целия файл

@@ -1,26 +0,0 @@
1
-import React from 'react';
2
-import { View } from '@tarojs/components';
3
-import { Radio, RadioGroup, Row, Col, CellGroup, Cell } from '@antmjs/vantui'
4
-import style from './choice.module.less';
5
-
6
-export default (props) => {
7
-  const { value } = props;
8
-  return (
9
-    <CellGroup className={style['cell']}>
10
-      <Cell title="测评内容" border={false} size="large" />
11
-      <Cell className={style['text']} title="在显著位置看到市民公约或居民公约展示" border={false} />
12
-      <Row>
13
-        <Col offset="3" span="12">
14
-          <RadioGroup value={value}>
15
-            <Cell border={false}>
16
-              <Radio checkedColor="var(--main-bg-color)">A.符合</Radio>
17
-            </Cell>
18
-            <Cell border={false} className={style['radio']}>
19
-              <Radio checkedColor="var(--main-bg-color)">B.不符合</Radio>
20
-            </Cell>
21
-          </RadioGroup>
22
-        </Col>
23
-      </Row>
24
-    </CellGroup>
25
-  )
26
-}

+ 65
- 0
src/pages/check/edit/components/Footer/index.jsx Целия файл

@@ -0,0 +1,65 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Button } from '@antmjs/vantui';
5
+import QuSelect from '../QuSelect';
6
+import style from './style.module.less';
7
+
8
+export default (props) => {
9
+  const { value, list, readonly, onChange, onSubmit } = props;
10
+
11
+  const [isPrev, isFinished] = React.useMemo(() => {
12
+    const total = list?.length || 0;
13
+
14
+    return [
15
+      value > 0,
16
+      value >= total - 1,
17
+    ]
18
+  }, [value, list]);
19
+
20
+  const onPrev = () => {
21
+    onChange(value - 1);
22
+  }
23
+
24
+  const onNext = () => {
25
+    if (isFinished) {
26
+      onSubmit()
27
+    } else {
28
+      onChange(value + 1);
29
+    }
30
+  }
31
+  
32
+  return (
33
+    <View className={style['qu-footer-wrapper']}>
34
+      {
35
+        !readonly && value > -1 && (
36
+          <View className={style['qu-footer-sel']}>
37
+            <QuSelect
38
+              value={value}
39
+              list={list}
40
+              onChange={onChange}
41
+            />
42
+          </View>
43
+        )
44
+      }
45
+      <View className={style['qu-footer-act']}>
46
+        {
47
+          isPrev && <Button type="primary" block plain hairline style={{flex: 1}} onClick={onPrev}>上一题</Button>
48
+        }
49
+        {
50
+          value == -1 ? (
51
+            <Button type="primary" block style={{flex: 1, marginLeft: isPrev ? '1em' : 0 }} onClick={onNext}>
52
+              {readonly ? '查看测评' : '开始测评'}
53
+            </Button>
54
+          ) : (
55
+            !(readonly && isFinished) && (
56
+              <Button type="primary" block style={{flex: 1, marginLeft: isPrev ? '1em' : 0 }} onClick={onNext}>
57
+                {isFinished ? '提交' : '下一题'}
58
+              </Button>
59
+              )
60
+          )
61
+        }
62
+      </View>
63
+    </View>
64
+  )
65
+}

+ 21
- 0
src/pages/check/edit/components/Footer/style.module.less Целия файл

@@ -0,0 +1,21 @@
1
+
2
+.qu-footer-wrapper {
3
+  width: 100%;
4
+  overflow: hidden;
5
+  padding: var(--main-space) 0;
6
+  background: #fff;
7
+  display: flex;
8
+  align-items: center;
9
+
10
+  .qu-footer-sel {
11
+    flex: none;
12
+    margin-right: 2em;
13
+  }
14
+
15
+  .qu-footer-act {
16
+    flex: 1;
17
+    display: flex;
18
+    overflow: hidden;
19
+    padding: 0 var(--main-space);
20
+  }
21
+}

+ 61
- 0
src/pages/check/edit/components/LocForm.jsx Целия файл

@@ -0,0 +1,61 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { CellGroup, Cell, Field } from '@antmjs/vantui';
5
+import Map from '@/components/map';
6
+import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7
+import mapIcon from '@/assets/icons/marker.png';
8
+
9
+export default (props) => {
10
+  const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
11
+
12
+  const [loc, setLoc] = React.useState();
13
+
14
+  const setLoading = (v) => {
15
+    if (onLoadingChange) {
16
+      onLoadingChange(v)
17
+    }
18
+  }
19
+  
20
+  const setFieldChange = (key, val) => {
21
+    onChange({
22
+      location: loc,
23
+      ...answer || {},
24
+      [key]: val,
25
+    })
26
+  }
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])
42
+  
43
+  return (
44
+    <View>
45
+      <Map location={answer?.location} onLocChange={setLoc} />
46
+      <CellGroup>
47
+        <Cell
48
+          title="点位"
49
+          value={checkItemInfo?.name}
50
+        />
51
+        <Field
52
+          readonly={readonly}
53
+          placeholder={checkType == 'loc' ? '请输入地址' : '请填写小区名称'}
54
+          value={answer?.addr}
55
+          leftIcon={mapIcon}
56
+          onChange={e => setFieldChange('addr', e.detail)}
57
+        />
58
+      </CellGroup>
59
+    </View>
60
+  )
61
+}

+ 68
- 0
src/pages/check/edit/components/QuSelect/index.jsx Целия файл

@@ -0,0 +1,68 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, Text } from '@tarojs/components';
4
+import { Popup, Cell, Icon } from '@antmjs/vantui';
5
+import RatioView from '@/components/RatioView';
6
+import style from './style.module.less';
7
+
8
+const Bar = (props) => {
9
+  const {cursor, total, onClick} =  props;
10
+
11
+  const handleClick = (e) => {
12
+    if (onClick) {
13
+      onClick(e);
14
+    }
15
+  }
16
+
17
+  return (
18
+    <View className={style['qu-board-title']} onClick={handleClick}>
19
+      <Icon name="weapp-nav" size={60} color="var(--main-bg-color)" />
20
+      <Text>{cursor + 1}</Text>
21
+      <Text> / </Text>
22
+      <Text>{total}</Text>
23
+    </View>
24
+  )
25
+}
26
+
27
+
28
+export default (props) => {
29
+  const { value = 0, list, onChange } = props;
30
+
31
+  const [show, setShow] = React.useState(false);
32
+
33
+  const handleClick = (e, inx) => {
34
+    e.stopPropagation();
35
+    setShow(false);
36
+
37
+    if (onChange) {
38
+      onChange(inx);
39
+    }
40
+  }
41
+  
42
+  return (
43
+    <View className={style['qu-board-bar']}>
44
+      <Bar cursor={value} total={list?.length} onClick={() => setShow(true)} />
45
+      <Popup position="bottom" show={show} onClose={() => setShow(false)}>
46
+        <View className={style['qu-board-wrapper']}>
47
+          <Bar cursor={value} total={list?.length} />
48
+          <View className={style['qu-board-bd']}>
49
+            {
50
+              list?.map((it, inx) => {
51
+                const cls = [
52
+                  style['qu-board-bd-item'],
53
+                  it?.finished ? style['qu-board-bd-active'] : false,
54
+                ].filter(Boolean).join(' ')
55
+
56
+                return (
57
+                  <RatioView key={inx}>
58
+                    <View className={cls} onClick={e => handleClick(e, inx)}>{inx + 1}</View>
59
+                  </RatioView>
60
+                )
61
+              })
62
+            }
63
+          </View>
64
+        </View>
65
+      </Popup>
66
+    </View>
67
+  )
68
+}

+ 50
- 0
src/pages/check/edit/components/QuSelect/style.module.less Целия файл

@@ -0,0 +1,50 @@
1
+.qu-board-bar {
2
+  display: inline-block;
3
+}
4
+
5
+.qu-board-title {
6
+  font-size: 28px;
7
+  color: #999;
8
+  font-weight: bold;
9
+  display: flex;
10
+  align-items: center;
11
+  padding: 0 var(--main-space);
12
+
13
+  & > text {
14
+    line-height: 3em;
15
+    &:first-of-type {
16
+      margin-left: 0.6em;
17
+    }
18
+  }
19
+}
20
+
21
+.qu-board-wrapper {
22
+  background: #fff;
23
+
24
+  .qu-board-bd {
25
+    padding: var(--main-space) calc(var(--main-space) * 2);
26
+    display: grid;
27
+    grid-template-columns: repeat(5, 1fr);
28
+    row-gap: 36px;
29
+    column-gap: 36px;
30
+
31
+    .qu-board-bd-item {
32
+      width: 100%;
33
+      height: 100%;
34
+      border-radius: 50%;
35
+      overflow: hidden;
36
+      display: grid;
37
+      place-items: center;
38
+      font-size: 30px;
39
+      color: #666;
40
+      font-weight: bold;
41
+      border: 2px solid var(--main-bg-color);
42
+
43
+      &.qu-board-bd-active {
44
+        color: #fff;
45
+        border: 2px solid transparent;
46
+        background-color: var(--main-bg-color);
47
+      }
48
+    }
49
+  }
50
+}

+ 107
- 0
src/pages/check/edit/components/Question.jsx Целия файл

@@ -0,0 +1,107 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, RichText, Text } from '@tarojs/components';
4
+import { CellGroup, Cell, Field, Radio, RadioGroup, Button } from '@antmjs/vantui';
5
+import Uploader from '@/components/Uploader/index';
6
+import { getTaCheckAnswerItem } from '@/services/tacheckansweritem';
7
+
8
+
9
+export default (props) => {
10
+  const { quInfo, answerItem, readonly, onChange, onLoadingChange } = props;
11
+
12
+  const setLoading = (v) => {
13
+    if (onLoadingChange) {
14
+      onLoadingChange(v);
15
+    }
16
+  }
17
+
18
+  const setFieldChange = (key, val) => {
19
+    if (readonly) return;
20
+
21
+    onChange({
22
+      ...(answerItem || {}),
23
+      quId: quInfo.quId,
24
+      [key]: val,
25
+    })
26
+  }
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]);
41
+  
42
+  return (
43
+    <View>
44
+      <RadioGroup value={answerItem?.answerCode}>
45
+        <CellGroup>
46
+          <Cell
47
+            border={false}
48
+            renderTitle={(
49
+              <View style={{fontWeight: 'bold'}}>
50
+                <Text>{quInfo?.sortNo}、</Text>
51
+                <Text>{quInfo?.title}</Text>
52
+              </View>
53
+            )}
54
+          />
55
+          {
56
+            quInfo?.quType == 'fill' && (
57
+              <Field
58
+                label="答案:"
59
+                clearable
60
+                readonly={readonly}
61
+                value={answerItem?.answer}
62
+                placeholder="填写数字"
63
+                renderButton={quInfo?.fillUnit}
64
+                onChange={(e) => setFieldChange('answer', e.detail - 0)}
65
+              />
66
+            )
67
+          }
68
+          {
69
+            (quInfo?.answerList || []).map((it) => {              
70
+              return (
71
+                <Cell
72
+                  key={it.answerId}
73
+                  title={it.answer}
74
+                  clickable
75
+                  border={false}
76
+                  onClick={() => setFieldChange('answerCode', it.answerCode)}
77
+                  renderRightIcon={<Radio checkedColor="var(--main-bg-color)" readonly={readonly} name={it.answerCode}></Radio>}
78
+                />
79
+              );
80
+            })
81
+          }
82
+        </CellGroup>
83
+      </RadioGroup>
84
+      <CellGroup style={{marginTop: '20px'}}>
85
+        <Cell title="测评标准" />
86
+        <Cell
87
+          renderTitle={
88
+            <RichText nodes={quInfo?.stand} />
89
+          }
90
+        />
91
+      </CellGroup>
92
+      <CellGroup style={{marginTop: '20px'}}>        
93
+        <Cell title="拍照或视频" border={false} />
94
+
95
+        <Cell
96
+          renderTitle={
97
+            <Uploader
98
+              disabled={readonly}
99
+              value={answerItem?.attachList}
100
+              onChange={e => setFieldChange('attachList',e)}
101
+            />
102
+          }
103
+        />
104
+      </CellGroup>
105
+    </View>
106
+  )
107
+}

+ 0
- 13
src/pages/check/edit/components/choice.module.less Целия файл

@@ -1,13 +0,0 @@
1
-.cell {
2
-  margin-bottom: 40px;
3
-  .text {
4
-    text-align: center;
5
-    color: var(--main-bg-color);
6
-    padding-top: 0px;
7
-    padding-bottom: 0px;
8
-  }
9
-  .radio {
10
-    padding-top: 0px;
11
-    margin-bottom: 40px;
12
-  }
13
-}

+ 3
- 3
src/pages/check/edit/index.config.js Целия файл

@@ -1,4 +1,4 @@
1
-// eslint-disable-next-line no-undef
2
-export default definePageConfig({
3
-  navigationBarTitleText: '实地测评'
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '实地测评'
4 4
 })

+ 250
- 249
src/pages/check/edit/index.jsx Целия файл

@@ -1,249 +1,250 @@
1
-import React from 'react';
2
-import Map from '@/components/map';
3
-import Page from '@/layouts/index';
4
-import { Button, Field, Cell, CellGroup, Row, Col, Image } from '@antmjs/vantui';
5
-import mapIcon from '@/assets/icons/marker.png';
6
-import LocType from '@/components/LocType';
7
-import { View, Input } from '@tarojs/components';
8
-import Uploader from '@/components/Uploader/index';
9
-import ScrollPage from '@/components/ScrollPage/index';
10
-import icon from '@/assets/icons/box.png';
11
-import Choice from "./components/Choice";
12
-
13
-export default (props) => {
14
-  const {
15
-    issue,
16
-    readOnly,
17
-    showOrg,
18
-    showExpireDate,
19
-    renderFields,
20
-    renderAction,
21
-  } = props;
22
-
23
-  const [inx, setInx] = React.useState(-1);
24
-
25
-  const num = 1;
26
-  const count = 15;
27
-
28
-  const [formData, setFormData] = React.useState({
29
-    typeId: undefined,
30
-    typeName: undefined,
31
-    locId: undefined,
32
-    locName: undefined,
33
-    location: undefined,
34
-    addr: undefined,
35
-    content: undefined,
36
-    attachList: [],
37
-  });
38
-
39
-  const [showLocType, setShowLocType] = React.useState(false);
40
-  const [evaluationPage, setEvaluationPage] = React.useState(false);
41
-  const [evaluationPage2, setEvaluationPage2] = React.useState(false);
42
-  const [evaluationPage3, setEvaluationPage3] = React.useState(true);
43
-  console.log('fff', evaluationPage3);
44
-  const onLocTypeChange = (_, it) => {
45
-    setFormData({
46
-      ...formData,
47
-      locId: it.typeId,
48
-      locName: it.name,
49
-    });
50
-    setShowLocType(false);
51
-  }
52
-
53
-  const setFieldChange = (field, value) => {
54
-    setFormData({
55
-      ...formData,
56
-      [field]: value,
57
-    })
58
-  }
59
-
60
-  const onChangePage = () => {
61
-    setEvaluationPage(false);
62
-    setEvaluationPage2(true);
63
-  }
64
-
65
-  const onChangePage2 = () => {
66
-    setEvaluationPage2(false);
67
-    setEvaluationPage3(true);
68
-    console.log('ff', evaluationPage3);
69
-  }
70
-
71
-
72
-
73
-  const onChangePage3 = () => {
74
-    setEvaluationPage3(false);
75
-  }
76
-
77
-  return (
78
-    <>
79
-      <Page>
80
-        {/* {
81
-          evaluationPage && (<>
82
-            <LocType
83
-              show={showLocType}
84
-              value={formData.addr}
85
-              onCancel={() => setShowLocType(false)}
86
-              onChange={onLocTypeChange}
87
-            />
88
-            <Map location={formData.location} />
89
-            <CellGroup>
90
-              <Cell
91
-                title="点位"
92
-                isLink
93
-                value={formData.locName}
94
-                onClick={() => !readOnly && setShowLocType(true)}
95
-              />
96
-              <Field
97
-                placeholder="请输入地址"
98
-                value={formData.addr}
99
-                leftIcon={mapIcon}
100
-              // readonly={readOnly}
101
-              // onChange={e => setFieldChange('addr', e.detail)}
102
-              />
103
-            </CellGroup>
104
-
105
-            <CellGroup style={{ padding: 'var(--main-space)', position: 'relative', top: '330px' }}>
106
-              <Button
107
-                type="primary"
108
-                block
109
-                onClick={onChangePage}
110
-              >
111
-                下一步
112
-              </Button>
113
-            </CellGroup>
114
-          </>)
115
-        }
116
-
117
-        {
118
-          evaluationPage2 && (
119
-            <View style={{ flex: '1' }}>
120
-
121
-              <Choice />
122
-
123
-              <CellGroup>
124
-                <Cell title="评测标准" border={false} size="large" />
125
-                <Row>
126
-                  <Col offset="2" span="20">
127
-                    <Cell
128
-                      title="
129
-                  在显著位置看到市民公约或居民公约展示"
130
-                      border={false}
131
-                      style={{ paddingTop: '0px' }}
132
-                    />
133
-                  </Col>
134
-                </Row>
135
-              </CellGroup>
136
-
137
-              <CellGroup style={{ marginTop: '20px' }}>
138
-                <Cell title="拍照" border={false} size="large" />
139
-
140
-                <Cell
141
-                  renderTitle={
142
-                    <Uploader
143
-                      value={formData.attachList}
144
-                      disabled={readOnly}
145
-                      onChange={e => setFieldChange('attachList', e)}
146
-                    />
147
-                  }
148
-                />
149
-              </CellGroup>
150
-
151
-              <View style={{ position: 'relative', marginBottom: '20px', flex: 'none' }}>
152
-                <View style={{ position: 'absolute', width: '100%', top: '100px' }}>
153
-                  <CellGroup style={{ marginTop: '20px', padding: 'var(--main-space)' }}>
154
-                    <Button
155
-                      type="primary"
156
-                      block
157
-                      onClick={onChangePage2}
158
-                    >
159
-                      下一题
160
-                    </Button>
161
-                  </CellGroup>
162
-
163
-                  <CellGroup>
164
-                    <Cell
165
-                      style={{ textAlign: 'right' }}
166
-                    >
167
-                      <Image src={icon} width="25px" height="25px"
168
-                        style={{ verticalAlign: 'middle', marginRight: '10px' }}
169
-                      />
170
-                      {num + '/' + count}
171
-                    </Cell>
172
-                  </CellGroup>
173
-                </View>
174
-              </View>
175
-            </View>)
176
-        } */}
177
-
178
-        {
179
-          evaluationPage3 && (
180
-            <>
181
-              <ScrollPage>
182
-                <CellGroup>
183
-                  <Cell title="测评内容" border={false} size="large" style={{ paddingBottom: '0px' }} />
184
-                  <View style={{ padding: 'var(--main-space)', paddingTop: '0px' }}>
185
-                    <View style={{ padding: 'var(--main-space)', fontSize: '14px', color: 'var(--main-bg-color)' }}>
186
-                      垃圾乱扔,乱张贴(具体标准),测评结果:<Input type="text" style={{ width: '45px', display: 'inline-block', verticalAlign: 'middle' }} />处。(此处填写数字)
187
-                    </View>
188
-                  </View>
189
-                </CellGroup>
190
-
191
-                <CellGroup>
192
-                  <Cell title="评测标准" border={false} size="large" />
193
-                  <Row>
194
-                    <Col offset="2" span="20">
195
-                      <Cell
196
-                        title="
197
-                    (1)每看到1处垃圾乱扔(1平方米以内的垃圾算作1处)计为1处;
198
-                    (2)每看到1处乱张贴乱涂写乱刻画《1平米内出现的算作1 处在统一设置的信息栏中张贴的小广告不算作失分点)计为1处;
199
-                    (3)每看到建筑物外立面的1处大面积破损污损《高3米以上、宽2米以上)计为1处。"
200
-                        border={false}
201
-                        style={{ paddingTop: '0px' }}
202
-                      />
203
-                    </Col>
204
-                  </Row>
205
-                </CellGroup>
206
-
207
-                <CellGroup style={{ marginTop: '20px' }}>
208
-                  <Cell title="拍照" border={false} size="large" />
209
-
210
-                  <Cell
211
-                    renderTitle={
212
-                      <Uploader
213
-                        value={formData.attachList}
214
-                        disabled={readOnly}
215
-                        onChange={e => setFieldChange('attachList', e)}
216
-                      />
217
-                    }
218
-                  />
219
-                </CellGroup>
220
-
221
-                <CellGroup style={{ marginTop: '20px', padding: 'var(--main-space)' }}>
222
-                  <Row>
223
-                    <Col offset="1" span="10">
224
-                      <Button
225
-                        type="primary"
226
-                        block
227
-                      >
228
-                        上一题
229
-                      </Button>
230
-                    </Col>
231
-                    <Col offset="2" span="10">
232
-                      <Button
233
-                        type="primary"
234
-                        block
235
-                      // onClick={onChangePage3}
236
-                      >
237
-                        下一题
238
-                      </Button>
239
-                    </Col>
240
-                  </Row>
241
-                </CellGroup>
242
-              </ScrollPage>
243
-            </>
244
-          )
245
-        }
246
-      </Page >
247
-    </>
248
-  )
249
-}
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, ScrollView } from '@tarojs/components';
4
+import { Notify } from '@antmjs/vantui';
5
+import Page from '@/layouts/index';
6
+import {
7
+  getTaCheckItemById,
8
+  getTaCheckItemByCheck,
9
+  preCheck,
10
+  getTaCheckItemAnswer,
11
+  putTaCheckItemAnswer,
12
+} from '@/services/tacheckitem';
13
+import { getTaCheckItemQu } from '@/services/tacheckitemqu';
14
+import VABC from '@/components/VABC';
15
+import { ROLE_INSPECTOR } from '@/utils/user';
16
+import LocForm from './components/LocForm';
17
+import Question from './components/Question';
18
+import Footer from './components/Footer/index';
19
+
20
+export default (props) => {
21
+
22
+  const router = Taro.useRouter();
23
+  const { id, checkId, typ } = router.params;
24
+
25
+  const [loading, setLoading] = React.useState(false);
26
+  const [readonly, setReadonly] = React.useState(false);
27
+  const [checkItemInfo, setCheckItemInfo] = React.useState();
28
+  const [quList, setQuList] = React.useState([]);
29
+  const [index, setIndex] = React.useState(-1);
30
+  const [answer, setAnswer] = React.useState();
31
+
32
+  React.useMemo(() => {
33
+    if (typ == 'loc') {
34
+      Taro.setNavigationBarTitle('实地测评');
35
+    } else {
36
+      Taro.setNavigationBarTitle('调查问卷');
37
+    }
38
+  }, [typ]);
39
+
40
+  const onIndexChange = (n) => {
41
+    if (index == -1 && n != -1) {
42
+      if (!readonly) {
43
+        if (!answer?.addr) {
44
+          Notify.show({
45
+            message: typ == 'loc' ? '请填写地址' : '请填写小区名称',
46
+            type: 'warning',
47
+          })
48
+          return;
49
+        }
50
+        if (!answer?.location) {
51
+          Notify.show({
52
+            message: '未能获取定位信息, 请重试',
53
+            type: 'warning',
54
+          })
55
+          return;
56
+        }
57
+      }
58
+    }
59
+
60
+    setIndex(n);
61
+  }
62
+
63
+  const onAnswerItemChange = (answerItem, quInfo) => {
64
+    if (!answerItem) return;
65
+
66
+    const an = { ...(answer || {}) }
67
+    const answerItemList = an.answerItemList || []
68
+
69
+    if ((answerItem.answerCode || answerItem.answer) &&
70
+      answerItem.attachList?.length) {
71
+      // 说明这一题已经回答完毕
72
+      quInfo.finished = true
73
+    } else {
74
+      quInfo.finished = false
75
+    }
76
+
77
+    // 更新问题列表中是否作答的标志位
78
+    setQuList(quList.map(x => x.quId == quInfo.quId ? quInfo : x));
79
+
80
+    if (answerItemList.length) {
81
+      let found = false;
82
+      an.answerItemList = answerItemList.map(x => {
83
+        if (x.quId == answerItem.quId) {
84
+          found = true;
85
+          return answerItem;
86
+        } else {
87
+          return x;
88
+        }
89
+      });
90
+
91
+      if (!found) {
92
+        answerItemList.push(answerItem);
93
+        an.answerItemList = answerItemList;
94
+      }
95
+    } else {
96
+      answerItemList.push(answerItem);
97
+      an.answerItemList = answerItemList;
98
+    }
99
+
100
+    setAnswer(an);
101
+  }
102
+
103
+  // 作答
104
+  const onSubmit = () => {
105
+    if (readonly) return;
106
+
107
+    const finished = quList.filter(x => x.finished).length == quList.length;
108
+    if (!answer || !answer.answerItemList || !finished) {
109
+      Notify.show({
110
+        message: '请作答完成所有题目',
111
+        type: 'warning',
112
+      })
113
+      return;
114
+    }
115
+
116
+    setLoading(true);
117
+    putTaCheckItemAnswer(id, answer).then(() => {
118
+      setLoading(false);
119
+      const t = setTimeout(() => {
120
+        clearTimeout(t);
121
+        Taro.navigateBack({ delta: 1 });
122
+      }, 1000);
123
+    }).catch(() => {
124
+      setLoading(false);
125
+    });
126
+  }
127
+
128
+  // 查询当前测评点位主记录
129
+  React.useEffect(() => {
130
+    if (id) {
131
+      setLoading(true);
132
+      getTaCheckItemById(id).then(res => {
133
+        setLoading(false);
134
+        setCheckItemInfo(res);
135
+      }).catch(() => {
136
+        setLoading(false);
137
+      });
138
+    }
139
+  }, [id]);
140
+
141
+  // 查询当前测评调查问卷主记录
142
+  React.useEffect(() => {
143
+    if (checkId && typ == 'survey') {
144
+      setLoading(true);
145
+      getTaCheckItemByCheck(checkId, typ).then(res => {
146
+        setLoading(false);
147
+        setCheckItemInfo(res);
148
+      }).catch(() => {
149
+        setLoading(false);
150
+      });
151
+    }
152
+  }, [checkId, typ]);
153
+
154
+  // 查询其他信息
155
+  React.useEffect(() => {
156
+    if (checkItemInfo?.itemId) {
157
+      const { itemId } = checkItemInfo;
158
+      setLoading(true);
159
+
160
+      preCheck(itemId, { noSuccesTip: true }).then((checkRes) => {
161
+        if (checkRes.errorCode < 0) {
162
+          setLoading(false);
163
+          Notify.show({
164
+            message: checkRes.message,
165
+            type: 'warning',
166
+          })
167
+
168
+          Taro.navigateBack({ delta: 1 })
169
+          return;
170
+        }
171
+
172
+        if (checkRes.errorCode > 0) {
173
+          setReadonly(true);
174
+          // Notify.show({
175
+          //   message: checkRes.message,
176
+          //   type: 'warning',
177
+          // })
178
+        }
179
+
180
+        // 查询我的答案
181
+        getTaCheckItemAnswer(itemId).then(setAnswer);
182
+
183
+        // 查询当前测评主记录的所有问题
184
+        getTaCheckItemQu({ pageSize: 200, itemId }).then(res => {
185
+          setLoading(false);
186
+          setQuList(res.records || []);
187
+        }).catch(() => {
188
+          setLoading(false);
189
+        });
190
+
191
+      }).catch(() => {
192
+        setLoading(false);
193
+      });
194
+    }
195
+  }, [checkItemInfo]);
196
+
197
+  return (
198
+    <Page loading={loading} roles={[ROLE_INSPECTOR]}>
199
+      <VABC
200
+        footer={(
201
+          <Footer
202
+            value={index}
203
+            readonly={readonly}
204
+            list={quList}
205
+            onChange={onIndexChange}
206
+            onSubmit={onSubmit}
207
+          />
208
+        )}
209
+      >
210
+        <ScrollView scrollY style={{ height: '100%' }}>
211
+          {
212
+            index == -1 && (
213
+              <LocForm
214
+                checkType={typ}
215
+                readonly={readonly}
216
+                checkItemInfo={checkItemInfo}
217
+                answer={answer}
218
+                onChange={setAnswer}
219
+                onLoadingChange={setLoading}
220
+              />
221
+            )
222
+          }
223
+          {
224
+            quList.map((x, inx) => {
225
+              const answerItem = answer?.answerItemList?.filter(y => y.quId == x.quId)[0];
226
+
227
+              return (
228
+                index == inx && (
229
+                  <Question
230
+                    key={x.quId}
231
+                    cursor={inx}
232
+                    readonly={readonly}
233
+                    quInfo={x}
234
+                    answerItem={answerItem}
235
+                    total={quList?.length}
236
+                    onChange={e => onAnswerItemChange(e, x)}
237
+                    onPrev={() => onIndexChange(null, -1)}
238
+                    onNext={() => onIndexChange(null, 1)}
239
+                    onLoadingChange={setLoading}
240
+                  />
241
+                )
242
+              )
243
+            })
244
+          }
245
+
246
+        </ScrollView>
247
+      </VABC>
248
+    </Page>
249
+  )
250
+}

+ 51
- 0
src/pages/check/list/components/Card.jsx Целия файл

@@ -0,0 +1,51 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, Text } from '@tarojs/components';
4
+import { Cell, Button } from '@antmjs/vantui';
5
+import style from './style.module.less';
6
+
7
+export default (props) => {
8
+  const { detail, onClick } = props;
9
+
10
+  const handleClick = (e) => {
11
+    if (onClick) {
12
+      onClick(e)
13
+    }
14
+  }
15
+  
16
+  return (
17
+    <View className={style['check-card-wrapper']}>
18
+      <Cell
19
+        renderTitle={(
20
+          <View className={style['check-card-title']}>
21
+            <View>{detail?.title}</View>
22
+            <View className={style['check-card-subtitle']}>
23
+              <View>{detail?.startDate}</View>
24
+              <View>{detail?.endDate}</View>
25
+            </View>
26
+          </View>
27
+        )}
28
+        renderLabel={(
29
+          <View className={style['check-card-actions']}>
30
+            <View>
31
+              <Button
32
+                plain
33
+                type="primary"
34
+                icon="location-o"
35
+                onClick={() => handleClick('loc')}
36
+              >实地测评</Button>
37
+            </View>
38
+            <View>
39
+              <Button
40
+                plain
41
+                type="primary"
42
+                icon="orders-o"
43
+                onClick={() => handleClick('survey')}
44
+              >调查问卷</Button>
45
+            </View>
46
+          </View>
47
+        )}
48
+      />
49
+    </View>
50
+  )
51
+}

+ 39
- 0
src/pages/check/list/components/style.module.less Целия файл

@@ -0,0 +1,39 @@
1
+
2
+.check-card-wrapper {
3
+  width: calc(100% - var(--main-space) * 2);
4
+  margin: var(--main-space);
5
+  background: #FFFFFF;
6
+  box-shadow: 0px 18px 22px 1px rgba(0,0,0,0.06);
7
+  border-radius: 8px;
8
+  overflow: hidden;
9
+
10
+  .check-card-title {
11
+    font-size: 30px;
12
+    color: #333;
13
+
14
+    display: flex;
15
+
16
+    & > View {
17
+      flex: 1;
18
+    }
19
+
20
+    .check-card-subtitle {
21
+      flex: none;
22
+      font-size: 24px;
23
+      color: #757575;
24
+      margin-left: 1em;
25
+    }
26
+  }
27
+
28
+  .check-card-actions {
29
+    display: flex;
30
+    align-items: center;
31
+    width: 100%;
32
+
33
+    & > view {
34
+      flex: 1;
35
+      text-align: center;
36
+      font-size: 28px;
37
+    }
38
+  }
39
+}

+ 23
- 10
src/pages/check/list/index.jsx Целия файл

@@ -5,20 +5,33 @@ import { ROLE_INSPECTOR, ROLE_MANAGER } from '@/utils/user';
5 5
 import { View } from '@tarojs/components';
6 6
 import Taro from '@tarojs/taro';
7 7
 import PowerList from '@/components/PowerList';
8
-import List from "../components/List";
9
-
8
+import { getTaCheck } from '@/services/tacheck';
9
+import Card from './components/Card';
10 10
 
11
+const queryParams = {isValid: true};
11 12
 export default (props) => {
13
+
14
+  const onClick = (typ, item) => {
15
+    if (typ == 'loc') {
16
+      Taro.navigateTo({
17
+        url: `/pages/check/loc/list/index?checkId=${item.checkId}`
18
+      })
19
+    } else {
20
+      Taro.navigateTo({
21
+        url: `/pages/check/edit/index?checkId=${item.checkId}&typ=${typ}`
22
+      })
23
+    }
24
+  }
25
+
12 26
   return (
13 27
     <Page roles={[ROLE_INSPECTOR]}>
14
-      <Tabs sticky>
15
-        <Tab title="实地测评">
16
-          <List />
17
-        </Tab>
18
-        <Tab title="问卷调查">
19
-
20
-        </Tab>
21
-      </Tabs>
28
+      <PowerList
29
+        request={getTaCheck}
30
+        params={queryParams}
31
+        renderItem={item => (
32
+          <Card key={item.checkId} detail={item} onClick={(e) => onClick(e, item)} />
33
+        )}
34
+      />
22 35
     </Page>
23 36
   )
24 37
 }

+ 65
- 0
src/pages/check/loc/edit/components/Footer/index.jsx Целия файл

@@ -0,0 +1,65 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Button } from '@antmjs/vantui';
5
+import QuSelect from '../QuSelect';
6
+import style from './style.module.less';
7
+
8
+export default (props) => {
9
+  const { value, list, readonly, onChange, onSubmit } = props;
10
+
11
+  const [isPrev, isFinished] = React.useMemo(() => {
12
+    const total = list?.length || 0;
13
+
14
+    return [
15
+      value > 0,
16
+      value >= total - 1,
17
+    ]
18
+  }, [value, list]);
19
+
20
+  const onPrev = () => {
21
+    onChange(value - 1);
22
+  }
23
+
24
+  const onNext = () => {
25
+    if (isFinished) {
26
+      onSubmit()
27
+    } else {
28
+      onChange(value + 1);
29
+    }
30
+  }
31
+  
32
+  return (
33
+    <View className={style['qu-footer-wrapper']}>
34
+      {
35
+        !readonly && value > -1 && (
36
+          <View className={style['qu-footer-sel']}>
37
+            <QuSelect
38
+              value={value}
39
+              list={list}
40
+              onChange={onChange}
41
+            />
42
+          </View>
43
+        )
44
+      }
45
+      <View className={style['qu-footer-act']}>
46
+        {
47
+          isPrev && <Button type="primary" block plain hairline style={{flex: 1}} onClick={onPrev}>上一题</Button>
48
+        }
49
+        {
50
+          value == -1 ? (
51
+            <Button type="primary" block style={{flex: 1, marginLeft: isPrev ? '1em' : 0 }} onClick={onNext}>
52
+              {readonly ? '查看测评' : '开始测评'}
53
+            </Button>
54
+          ) : (
55
+            !(readonly && isFinished) && (
56
+              <Button type="primary" block style={{flex: 1, marginLeft: isPrev ? '1em' : 0 }} onClick={onNext}>
57
+                {isFinished ? '提交' : '下一题'}
58
+              </Button>
59
+              )
60
+          )
61
+        }
62
+      </View>
63
+    </View>
64
+  )
65
+}

+ 21
- 0
src/pages/check/loc/edit/components/Footer/style.module.less Целия файл

@@ -0,0 +1,21 @@
1
+
2
+.qu-footer-wrapper {
3
+  width: 100%;
4
+  overflow: hidden;
5
+  padding: var(--main-space) 0;
6
+  background: #fff;
7
+  display: flex;
8
+  align-items: center;
9
+
10
+  .qu-footer-sel {
11
+    flex: none;
12
+    margin-right: 2em;
13
+  }
14
+
15
+  .qu-footer-act {
16
+    flex: 1;
17
+    display: flex;
18
+    overflow: hidden;
19
+    padding: 0 var(--main-space);
20
+  }
21
+}

+ 61
- 0
src/pages/check/loc/edit/components/LocForm.jsx Целия файл

@@ -0,0 +1,61 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { CellGroup, Cell, Field } from '@antmjs/vantui';
5
+import Map from '@/components/map';
6
+import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7
+import mapIcon from '@/assets/icons/marker.png';
8
+
9
+export default (props) => {
10
+  const { checkItemInfo, answer, readonly, onChange, onLoadingChange } = props;
11
+
12
+  const [loc, setLoc] = React.useState();
13
+
14
+  const setLoading = (v) => {
15
+    if (onLoadingChange) {
16
+      onLoadingChange(v)
17
+    }
18
+  }
19
+  
20
+  const setFieldChange = (key, val) => {
21
+    onChange({
22
+      location: loc,
23
+      ...answer || {},
24
+      [key]: val,
25
+    })
26
+  }
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])
42
+  
43
+  return (
44
+    <View>
45
+      <Map location={answer?.location} onLocChange={setLoc} />
46
+      <CellGroup>
47
+        <Cell
48
+          title="点位"
49
+          value={checkItemInfo?.name}
50
+        />
51
+        <Field
52
+          readonly={readonly}
53
+          placeholder="请输入地址"
54
+          value={answer?.addr}
55
+          leftIcon={mapIcon}
56
+          onChange={e => setFieldChange('addr', e.detail)}
57
+        />
58
+      </CellGroup>
59
+    </View>
60
+  )
61
+}

+ 68
- 0
src/pages/check/loc/edit/components/QuSelect/index.jsx Целия файл

@@ -0,0 +1,68 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, Text } from '@tarojs/components';
4
+import { Popup, Cell, Icon } from '@antmjs/vantui';
5
+import RatioView from '@/components/RatioView';
6
+import style from './style.module.less';
7
+
8
+const Bar = (props) => {
9
+  const {cursor, total, onClick} =  props;
10
+
11
+  const handleClick = (e) => {
12
+    if (onClick) {
13
+      onClick(e);
14
+    }
15
+  }
16
+
17
+  return (
18
+    <View className={style['qu-board-title']} onClick={handleClick}>
19
+      <Icon name="weapp-nav" size={60} color="var(--main-bg-color)" />
20
+      <Text>{cursor + 1}</Text>
21
+      <Text> / </Text>
22
+      <Text>{total}</Text>
23
+    </View>
24
+  )
25
+}
26
+
27
+
28
+export default (props) => {
29
+  const { value = 0, list, onChange } = props;
30
+
31
+  const [show, setShow] = React.useState(false);
32
+
33
+  const handleClick = (e, inx) => {
34
+    e.stopPropagation();
35
+    setShow(false);
36
+
37
+    if (onChange) {
38
+      onChange(inx);
39
+    }
40
+  }
41
+  
42
+  return (
43
+    <View className={style['qu-board-bar']}>
44
+      <Bar cursor={value} total={list?.length} onClick={() => setShow(true)} />
45
+      <Popup position="bottom" show={show} onClose={() => setShow(false)}>
46
+        <View className={style['qu-board-wrapper']}>
47
+          <Bar cursor={value} total={list?.length} />
48
+          <View className={style['qu-board-bd']}>
49
+            {
50
+              list?.map((it, inx) => {
51
+                const cls = [
52
+                  style['qu-board-bd-item'],
53
+                  it?.finished ? style['qu-board-bd-active'] : false,
54
+                ].filter(Boolean).join(' ')
55
+
56
+                return (
57
+                  <RatioView key={inx}>
58
+                    <View className={cls} onClick={e => handleClick(e, inx)}>{inx + 1}</View>
59
+                  </RatioView>
60
+                )
61
+              })
62
+            }
63
+          </View>
64
+        </View>
65
+      </Popup>
66
+    </View>
67
+  )
68
+}

+ 50
- 0
src/pages/check/loc/edit/components/QuSelect/style.module.less Целия файл

@@ -0,0 +1,50 @@
1
+.qu-board-bar {
2
+  display: inline-block;
3
+}
4
+
5
+.qu-board-title {
6
+  font-size: 28px;
7
+  color: #999;
8
+  font-weight: bold;
9
+  display: flex;
10
+  align-items: center;
11
+  padding: 0 var(--main-space);
12
+
13
+  & > text {
14
+    line-height: 3em;
15
+    &:first-of-type {
16
+      margin-left: 0.6em;
17
+    }
18
+  }
19
+}
20
+
21
+.qu-board-wrapper {
22
+  background: #fff;
23
+
24
+  .qu-board-bd {
25
+    padding: var(--main-space) calc(var(--main-space) * 2);
26
+    display: grid;
27
+    grid-template-columns: repeat(5, 1fr);
28
+    row-gap: 36px;
29
+    column-gap: 36px;
30
+
31
+    .qu-board-bd-item {
32
+      width: 100%;
33
+      height: 100%;
34
+      border-radius: 50%;
35
+      overflow: hidden;
36
+      display: grid;
37
+      place-items: center;
38
+      font-size: 30px;
39
+      color: #666;
40
+      font-weight: bold;
41
+      border: 2px solid var(--main-bg-color);
42
+
43
+      &.qu-board-bd-active {
44
+        color: #fff;
45
+        border: 2px solid transparent;
46
+        background-color: var(--main-bg-color);
47
+      }
48
+    }
49
+  }
50
+}

+ 107
- 0
src/pages/check/loc/edit/components/Question.jsx Целия файл

@@ -0,0 +1,107 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, RichText, Text } from '@tarojs/components';
4
+import { CellGroup, Cell, Field, Radio, RadioGroup, Button } from '@antmjs/vantui';
5
+import Uploader from '@/components/Uploader/index';
6
+import { getTaCheckAnswerItem } from '@/services/tacheckansweritem';
7
+
8
+
9
+export default (props) => {
10
+  const { quInfo, answerItem, readonly, onChange, onLoadingChange } = props;
11
+
12
+  const setLoading = (v) => {
13
+    if (onLoadingChange) {
14
+      onLoadingChange(v);
15
+    }
16
+  }
17
+
18
+  const setFieldChange = (key, val) => {
19
+    if (readonly) return;
20
+
21
+    onChange({
22
+      ...(answerItem || {}),
23
+      quId: quInfo.quId,
24
+      [key]: val,
25
+    })
26
+  }
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]);
41
+  
42
+  return (
43
+    <View>
44
+      <RadioGroup value={answerItem?.answerCode}>
45
+        <CellGroup>
46
+          <Cell
47
+            border={false}
48
+            renderTitle={(
49
+              <View style={{fontWeight: 'bold'}}>
50
+                <Text>{quInfo?.sortNo}、</Text>
51
+                <Text>{quInfo?.title}</Text>
52
+              </View>
53
+            )}
54
+          />
55
+          {
56
+            quInfo?.quType == 'fill' && (
57
+              <Field
58
+                label="答案:"
59
+                clearable
60
+                readonly={readonly}
61
+                value={answerItem?.answer}
62
+                placeholder="填写数字"
63
+                renderButton={quInfo?.fillUnit}
64
+                onChange={(e) => setFieldChange('answer', e.detail - 0)}
65
+              />
66
+            )
67
+          }
68
+          {
69
+            (quInfo?.answerList || []).map((it) => {              
70
+              return (
71
+                <Cell
72
+                  key={it.answerId}
73
+                  title={it.answer}
74
+                  clickable
75
+                  border={false}
76
+                  onClick={() => setFieldChange('answerCode', it.answerCode)}
77
+                  renderRightIcon={<Radio checkedColor="var(--main-bg-color)" readonly={readonly} name={it.answerCode}></Radio>}
78
+                />
79
+              );
80
+            })
81
+          }
82
+        </CellGroup>
83
+      </RadioGroup>
84
+      <CellGroup style={{marginTop: '20px'}}>
85
+        <Cell title="测评标准" />
86
+        <Cell
87
+          renderTitle={
88
+            <RichText nodes={quInfo?.stand} />
89
+          }
90
+        />
91
+      </CellGroup>
92
+      <CellGroup style={{marginTop: '20px'}}>        
93
+        <Cell title="拍照或视频" border={false} />
94
+
95
+        <Cell
96
+          renderTitle={
97
+            <Uploader
98
+              disabled={readonly}
99
+              value={answerItem?.attachList}
100
+              onChange={e => setFieldChange('attachList',e)}
101
+            />
102
+          }
103
+        />
104
+      </CellGroup>
105
+    </View>
106
+  )
107
+}

+ 4
- 0
src/pages/check/loc/edit/index.config.js Целия файл

@@ -0,0 +1,4 @@
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '实地测评'
4
+})

+ 207
- 0
src/pages/check/loc/edit/index.jsx Целия файл

@@ -0,0 +1,207 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View, ScrollView } from '@tarojs/components';
4
+import { Notify } from '@antmjs/vantui';
5
+import Page from '@/layouts/index';
6
+import { getTaCheckItemById, preCheck, getTaCheckItemAnswer, putTaCheckItemAnswer } from '@/services/tacheckitem';
7
+import { getTaCheckItemQu } from '@/services/tacheckitemqu';
8
+import VABC from '@/components/VABC';
9
+import { ROLE_INSPECTOR } from '@/utils/user';
10
+import LocForm from './components/LocForm';
11
+import Question from './components/Question';
12
+import Footer from './components/Footer/index';
13
+
14
+export default (props) => {
15
+
16
+  const router = Taro.useRouter();
17
+  const { id } = router.params;
18
+
19
+  const [loading, setLoading] = React.useState(false);
20
+  const [readonly, setReadonly] = React.useState(false);
21
+  const [checkItemInfo, setCheckItemInfo] = React.useState();
22
+  const [quList, setQuList] = React.useState([]);
23
+  const [index, setIndex] = React.useState(-1);
24
+  const [answer, setAnswer] = React.useState();
25
+
26
+  const onIndexChange = (n) => {
27
+    if (index == -1 && n != -1) {
28
+      if (!readonly) {
29
+        if (!answer?.addr) {
30
+          Notify.show({
31
+            message: '请填写地址',
32
+            type: 'warning',
33
+          })
34
+          return;
35
+        }
36
+        if (!answer?.location) {
37
+          Notify.show({
38
+            message: '未能获取定位信息, 请重试',
39
+            type: 'warning',
40
+          })
41
+          return;
42
+        }
43
+      }
44
+    }
45
+
46
+    setIndex(n);
47
+  }
48
+
49
+  const onAnswerItemChange = (answerItem, quInfo) => {
50
+    if (!answerItem) return;
51
+
52
+    const an = {...(answer || {})}
53
+    const answerItemList = an.answerItemList || []
54
+
55
+    if ((answerItem.answerCode || answerItem.answer) &&
56
+      answerItem.attachList?.length) {
57
+        // 说明这一题已经回答完毕
58
+        quInfo.finished = true
59
+      } else {
60
+        quInfo.finished = false
61
+      }
62
+    
63
+    // 更新问题列表中是否作答的标志位
64
+    setQuList(quList.map(x => x.quId == quInfo.quId ? quInfo : x));
65
+
66
+    if (answerItemList.length) {
67
+      let found = false;
68
+      an.answerItemList = answerItemList.map(x => {
69
+        if (x.quId == answerItem.quId) {
70
+          found = true;
71
+          return answerItem;
72
+        } else {
73
+          return x;
74
+        }
75
+      });
76
+
77
+      if (!found) {
78
+        answerItemList.push(answerItem);
79
+        an.answerItemList = answerItemList;
80
+      }
81
+    } else {
82
+      answerItemList.push(answerItem);
83
+      an.answerItemList = answerItemList;
84
+    }
85
+
86
+    setAnswer(an);
87
+  }
88
+
89
+  // 作答
90
+  const onSubmit = () => {
91
+    if (readonly) return;
92
+
93
+    const finished = quList.filter(x => x.finished).length == quList.length;
94
+    if (!answer || !answer.answerItemList || !finished) {
95
+      Notify.show({
96
+        message: '请作答完成所有题目',
97
+        type: 'warning',
98
+      })
99
+      return;
100
+    }
101
+
102
+    setLoading(true);
103
+    putTaCheckItemAnswer(id, answer).then(() => {
104
+      setLoading(false);
105
+      const t = setTimeout(() => {
106
+        clearTimeout(t);
107
+        Taro.navigateBack({delta: 1});
108
+      }, 1000);      
109
+    }).catch(() => {
110
+      setLoading(false);
111
+    });
112
+  }
113
+
114
+  React.useEffect(() => {
115
+    setLoading(true);
116
+    preCheck(id, { noSuccesTip: true }).then((checkRes) => {
117
+      if (checkRes.errorCode < 0) {
118
+        Notify.show({
119
+          message: checkRes.message,
120
+          type: 'warning',
121
+        })
122
+
123
+        Taro.navigateBack({delta: 1})
124
+        return;
125
+      }
126
+
127
+      if (checkRes.errorCode > 0) {
128
+        setReadonly(true);
129
+        // Notify.show({
130
+        //   message: checkRes.message,
131
+        //   type: 'warning',
132
+        // })
133
+      }
134
+
135
+      // 查询当前测评点位(问卷)主记录
136
+      getTaCheckItemById(id).then(res => {
137
+        setCheckItemInfo(res);
138
+      });
139
+      
140
+      // 查询我的答案
141
+      getTaCheckItemAnswer(id).then(setAnswer);
142
+  
143
+      // 查询当前测评主记录的所有问题
144
+      getTaCheckItemQu({pageSize: 200, itemId: id}).then(res => {
145
+        setLoading(false);
146
+        setQuList(res.records || []);
147
+      }).catch(() => {
148
+        setLoading(false);
149
+      });
150
+    }).catch(() => {
151
+      setLoading(false);
152
+    });
153
+  }, [id]);
154
+  
155
+  return (
156
+    <Page loading={loading} roles={[ROLE_INSPECTOR]}>
157
+      <VABC
158
+        footer={(
159
+          <Footer
160
+            value={index}
161
+            readonly={readonly}
162
+            list={quList}
163
+            onChange={onIndexChange}
164
+            onSubmit={onSubmit}
165
+          />
166
+        )}
167
+      >
168
+        <ScrollView scrollY style={{height: '100%'}}>
169
+        {
170
+          index == -1 && (
171
+            <LocForm
172
+              readonly={readonly}
173
+              checkItemInfo={checkItemInfo}
174
+              answer={answer}
175
+              onChange={setAnswer}
176
+              onLoadingChange={setLoading}
177
+            />
178
+          )
179
+        }
180
+        {
181
+          quList.map((x, inx) => {
182
+            const answerItem = answer?.answerItemList?.filter(y => y.quId == x.quId)[0];
183
+
184
+            return (
185
+              index == inx && (
186
+                <Question
187
+                  key={x.quId}
188
+                  cursor={inx}
189
+                  readonly={readonly}
190
+                  quInfo={x}
191
+                  answerItem={answerItem}
192
+                  total={quList?.length}
193
+                  onChange={e => onAnswerItemChange(e, x)}
194
+                  onPrev={() => onIndexChange(null, -1)}
195
+                  onNext={() => onIndexChange(null, 1)}
196
+                  onLoadingChange={setLoading}
197
+                />
198
+              )
199
+            )
200
+          })
201
+        }
202
+          
203
+        </ScrollView>
204
+      </VABC>
205
+    </Page>
206
+  )
207
+}

+ 4
- 0
src/pages/check/loc/list/index.config.js Целия файл

@@ -0,0 +1,4 @@
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '实地测评'
4
+})

+ 51
- 0
src/pages/check/loc/list/index.jsx Целия файл

@@ -0,0 +1,51 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Cell, Tag } from '@antmjs/vantui';
5
+import Page from '@/layouts/index';
6
+import PowerList from '@/components/PowerList';
7
+import { getTaCheckItem } from '@/services/tacheckitem';
8
+import { ROLE_INSPECTOR } from '@/utils/user';
9
+
10
+export default (props) => {
11
+
12
+  const router = Taro.useRouter();
13
+  const { checkId } = router.params;
14
+
15
+  const [loading, setLoading] = React.useState(false);
16
+
17
+  const params = React.useMemo(() => ({
18
+    checkId,
19
+    itemType: 'loc',
20
+    pageSize: 100,
21
+    mustValid: true,
22
+  }), [checkId]);
23
+
24
+  const onClick = (item) => {
25
+    Taro.navigateTo({
26
+      url: `/pages/check/edit/index?id=${item.itemId}&typ=${item.itemType}`
27
+    })
28
+  }
29
+  
30
+  return (
31
+    <Page loading={loading} roles={[ROLE_INSPECTOR]}>
32
+      <PowerList
33
+        request={getTaCheckItem}
34
+        params={params}
35
+        renderItem={item => (
36
+          <Cell
37
+            isLink
38
+            key={item.itemId}
39
+            title={item.name}
40
+            onClick={() => onClick(item)}
41
+          >
42
+            {
43
+              item.readonly ? <Tag color="var(--main-bg-color)">已答完</Tag> : null
44
+            }
45
+          </Cell>
46
+        )}
47
+        onLoadingChange={setLoading}
48
+      />
49
+    </Page>
50
+  )
51
+}

+ 1
- 1
src/pages/issue/components/Issue/index.jsx Целия файл

@@ -108,7 +108,7 @@ export default (props) => {
108 108
     <View>
109 109
       <LocType
110 110
         show={showLocType}
111
-        value={formData.addr}
111
+        value={formData.locId}
112 112
         onCancel={() => setShowLocType(false)}
113 113
         onChange={onLocTypeChange}
114 114
       />

+ 33
- 0
src/pages/notice/components/Card/index.jsx Целия файл

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

+ 15
- 0
src/pages/notice/components/Card/style.module.less Целия файл

@@ -0,0 +1,15 @@
1
+.notice-card-wrapper {
2
+  width: calc(100% - var(--main-space) * 2);
3
+  margin: var(--main-space);
4
+  background: #ffffff;
5
+  box-shadow: 0px 18px 22px 1px rgba(0, 0, 0, 0.06);
6
+  border-radius: 8px;
7
+  overflow: hidden;
8
+  .notice-card-title {
9
+    font-weight: bold;
10
+    display: inline-block;
11
+  }
12
+  .notice-card-title2 {
13
+    display: inline-block;
14
+  }
15
+}

+ 20
- 0
src/pages/notice/components/Details/index.jsx Целия файл

@@ -0,0 +1,20 @@
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
+}

+ 25
- 0
src/pages/notice/components/Details/style.module.less Целия файл

@@ -0,0 +1,25 @@
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
+}

+ 4
- 0
src/pages/notice/edit/index.config.js Целия файл

@@ -0,0 +1,4 @@
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '详情'
4
+})

+ 11
- 0
src/pages/notice/edit/index.jsx Целия файл

@@ -0,0 +1,11 @@
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
+}

+ 4
- 0
src/pages/notice/list/index.config.js Целия файл

@@ -0,0 +1,4 @@
1
+// eslint-disable-next-line no-undef
2
+export default definePageConfig({
3
+  navigationBarTitleText: '公告'
4
+})

+ 12
- 0
src/pages/notice/list/index.jsx Целия файл

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

+ 29
- 0
src/services/tacheck.js Целия файл

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

+ 29
- 0
src/services/tacheckansweritem.js Целия файл

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

+ 46
- 0
src/services/tacheckitem.js Целия файл

@@ -0,0 +1,46 @@
1
+import request from '@/utils/request';
2
+
3
+/*
4
+ * 分页查询
5
+ */
6
+export const getTaCheckItem = (params) => request('/api/taCheckItem', { params });
7
+
8
+/*
9
+ * 新增数据
10
+ */
11
+export const postTaCheckItem = (data) => request('/api/taCheckItem', { data, method: 'post' });
12
+
13
+/*
14
+ * 通过ID查询单条数据
15
+ */
16
+export const getTaCheckItemById = (id) => request(`/api/taCheckItem/${id}`);
17
+
18
+/**
19
+ * 更新数据
20
+ * @param {*} id
21
+ * @param {*} data
22
+ * @returns
23
+ */
24
+export const putTaCheckItem = (id, data) => request(`/api/taCheckItem/${id}`, { data, method: 'put' });
25
+
26
+/*
27
+ * 通过主键删除数据
28
+ */
29
+export const deleteTaCheckItem = (id) => request(`/api/taCheckItem/${id}`, { method: 'delete' });
30
+
31
+export const preCheck = (id, opts = {}) => request(`/api/taCheckItem/${id}/answer/pre-check`, { method: 'put', ...opts });
32
+
33
+/*
34
+ * 获取当前答案
35
+ */
36
+export const getTaCheckItemAnswer = (id) => request(`/api/taCheckItem/${id}/answer`);
37
+
38
+/*
39
+ * 获取当前答案
40
+ */
41
+export const putTaCheckItemAnswer = (id, data) => request(`/api/taCheckItem/${id}/answer`, { method: 'put', data });
42
+
43
+/*
44
+ * 通过测评ID获取测评ITEM
45
+ */
46
+export const getTaCheckItemByCheck = (checkId, typ) => request(`/api/taCheck/${checkId}/item/${typ}`);

+ 29
- 0
src/services/tacheckitemqu.js Целия файл

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

+ 8
- 6
src/utils/request.js Целия файл

@@ -13,7 +13,7 @@ const getQueryStrByParams = params => {
13 13
 
14 14
 export default function request(api, options = {}) {
15 15
   return new Promise((resolve, reject) => {
16
-    const { method = 'GET', params, data = {}, header = {}, silent = false, ...cfgs } = options;
16
+    const { method = 'GET', params, data = {}, header = {}, silent = false, noSuccesTip, ...cfgs } = options;
17 17
     const queryStr = params ? getQueryStrByParams(params) : undefined;
18 18
     // eslint-disable-next-line no-undef
19 19
     const url = queryStr ? `${HOST}${api}?${queryStr}` : `${HOST}${api}`;
@@ -53,15 +53,17 @@ export default function request(api, options = {}) {
53 53
       }
54 54
 
55 55
       if (data.code === 1000) {
56
-        if (data.data.token) {
56
+        if (data.data?.token) {
57 57
           setToken(data.data.token);
58 58
         }
59 59
 
60 60
         if (!silent && 'GET' !== method.toUpperCase()) {
61
-          Taro.showToast({
62
-            title: '操作成功',
63
-            icon: 'none',
64
-          })
61
+          if (!noSuccesTip) {
62
+            Taro.showToast({
63
+              title: '操作成功',
64
+              icon: 'none',
65
+            })
66
+          }
65 67
         }
66 68
 
67 69
         resolve(data.data);