Yansen hace 2 años
padre
commit
2689cc0919

+ 1
- 1
project.config.json Ver fichero

1
 {
1
 {
2
   "miniprogramRoot": "./dist",
2
   "miniprogramRoot": "./dist",
3
-  "projectname": "civilized-miniapp",
3
+  "projectname": "文明霍山",
4
   "description": "文明城市小程序",
4
   "description": "文明城市小程序",
5
   "appid": "wx39d721c54a0a11c4",
5
   "appid": "wx39d721c54a0a11c4",
6
   "setting": {
6
   "setting": {

+ 6
- 0
src/layouts/index.jsx Ver fichero

26
     }
26
     }
27
   }, [person, user]);
27
   }, [person, user]);
28
 
28
 
29
+  Taro.useShareAppMessage(() => {
30
+    return {
31
+      title: '文明霍山'
32
+    };
33
+  });
34
+
29
   return (
35
   return (
30
     <View className={laySty['page-wrapper']}>
36
     <View className={laySty['page-wrapper']}>
31
       <Notify id="vanNotify" />
37
       <Notify id="vanNotify" />

+ 22
- 0
src/pages/check/edit/components/AgePicker.jsx Ver fichero

1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Popup, Picker } from '@antmjs/vantui';
5
+
6
+const columns = ['18-35岁', '36-55岁', '56—65岁'];
7
+export default (props) => {
8
+
9
+  const { show, onShowChange, value, onChange } = props;
10
+
11
+  const onConfirm = (e) => {
12
+    const val = e.detail.value;
13
+    onChange(val);
14
+    onShowChange(false);
15
+  }
16
+  
17
+  return (
18
+    <Popup position="bottom" show={show} onClose={() => onShowChange(false)}>
19
+      <Picker columns={columns} onConfirm={onConfirm} />
20
+    </Popup>
21
+  )
22
+}

+ 33
- 1
src/pages/check/edit/components/LocForm.jsx Ver fichero

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 { CellGroup, Cell, Field } from '@antmjs/vantui';
4
+import { CellGroup, Cell, Field, RadioGroup, Radio } from '@antmjs/vantui';
5
 import Map from '@/components/map';
5
 import Map from '@/components/map';
6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7
 import mapIcon from '@/assets/icons/marker.png';
7
 import mapIcon from '@/assets/icons/marker.png';
8
+import AgePicker from './AgePicker';
8
 
9
 
9
 export default (props) => {
10
 export default (props) => {
10
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
11
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
11
 
12
 
12
   const [loc, setLoc] = React.useState();
13
   const [loc, setLoc] = React.useState();
14
+  const [showAgePicker, setShowAgePicker] = React.useState(false);
13
 
15
 
14
   const setLoading = (v) => {
16
   const setLoading = (v) => {
15
     if (onLoadingChange) {
17
     if (onLoadingChange) {
56
           onChange={e => setFieldChange('addr', e.detail)}
58
           onChange={e => setFieldChange('addr', e.detail)}
57
         />
59
         />
58
       </CellGroup>
60
       </CellGroup>
61
+      {
62
+        checkType == 'survey' && (
63
+          <CellGroup style={{marginTop: '20px'}}>
64
+            <Cell title="性别">
65
+              <View style={{textAlign: 'right'}}>
66
+                <RadioGroup
67
+                  direction="horizontal"
68
+                  value={answer?.sex}
69
+                  style={{display: 'inline-flex'}}
70
+                  onChange={(e) => setFieldChange('sex', e.detail)}
71
+                >
72
+                  <Radio name="1" checkedColor="var(--main-bg-color)">男</Radio>
73
+                  <Radio name="2" checkedColor="red">女</Radio>
74
+                </RadioGroup>
75
+              </View>
76
+            </Cell>
77
+            <Cell
78
+              title="年龄"
79
+              isLink
80
+              value={answer?.age}
81
+              onClick={() => setShowAgePicker(true)}
82
+            />
83
+            <AgePicker
84
+              show={showAgePicker}
85
+              onShowChange={setShowAgePicker}
86
+              onChange={(e) => setFieldChange('age', e)}
87
+            />
88
+          </CellGroup>
89
+        )
90
+      }
59
     </View>
91
     </View>
60
   )
92
   )
61
 }
93
 }

+ 17
- 13
src/pages/check/edit/components/Question.jsx Ver fichero

7
 
7
 
8
 
8
 
9
 export default (props) => {
9
 export default (props) => {
10
-  const { quInfo, answerItem, readonly, onChange, onLoadingChange } = props;
10
+  const { quInfo, answerItem, checkType, readonly, onChange, onLoadingChange } = props;
11
 
11
 
12
   const setLoading = (v) => {
12
   const setLoading = (v) => {
13
     if (onLoadingChange) {
13
     if (onLoadingChange) {
89
           }
89
           }
90
         />
90
         />
91
       </CellGroup>
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)}
92
+      {
93
+        checkType != 'survey' && (
94
+          <CellGroup style={{marginTop: '20px'}}>        
95
+            <Cell title="拍照或视频" border={false} />
96
+    
97
+            <Cell
98
+              renderTitle={
99
+                <Uploader
100
+                  disabled={readonly}
101
+                  value={answerItem?.attachList}
102
+                  onChange={e => setFieldChange('attachList',e)}
103
+                />
104
+              }
101
             />
105
             />
102
-          }
103
-        />
104
-      </CellGroup>
106
+          </CellGroup>
107
+        )
108
+      }
105
     </View>
109
     </View>
106
   )
110
   )
107
 }
111
 }

+ 7
- 4
src/pages/check/edit/index.jsx Ver fichero

17
 import Question from './components/Question';
17
 import Question from './components/Question';
18
 import Footer from './components/Footer/index';
18
 import Footer from './components/Footer/index';
19
 
19
 
20
+const isNotEmpty = str => str !== undefined && str !== null && str.replace(/\s/g, '') !== '';
21
+
20
 export default (props) => {
22
 export default (props) => {
21
 
23
 
22
   const router = Taro.useRouter();
24
   const router = Taro.useRouter();
31
 
33
 
32
   React.useMemo(() => {
34
   React.useMemo(() => {
33
     if (typ == 'loc') {
35
     if (typ == 'loc') {
34
-      Taro.setNavigationBarTitle('实地测评');
36
+      Taro.setNavigationBarTitle({ title: '实地测评' });
35
     } else {
37
     } else {
36
-      Taro.setNavigationBarTitle('调查问卷');
38
+      Taro.setNavigationBarTitle({ title: '调查问卷' });
37
     }
39
     }
38
   }, [typ]);
40
   }, [typ]);
39
 
41
 
66
     const an = { ...(answer || {}) }
68
     const an = { ...(answer || {}) }
67
     const answerItemList = an.answerItemList || []
69
     const answerItemList = an.answerItemList || []
68
 
70
 
69
-    if ((answerItem.answerCode || answerItem.answer) &&
70
-      answerItem.attachList?.length) {
71
+    if ((isNotEmpty(answerItem.answerCode) || isNotEmpty(answerItem.answer)) &&
72
+      (typ == 'loc' ? answerItem.attachList?.length : true)) {
71
       // 说明这一题已经回答完毕
73
       // 说明这一题已经回答完毕
72
       quInfo.finished = true
74
       quInfo.finished = true
73
     } else {
75
     } else {
228
                 index == inx && (
230
                 index == inx && (
229
                   <Question
231
                   <Question
230
                     key={x.quId}
232
                     key={x.quId}
233
+                    checkType={typ}
231
                     cursor={inx}
234
                     cursor={inx}
232
                     readonly={readonly}
235
                     readonly={readonly}
233
                     quInfo={x}
236
                     quInfo={x}

+ 14
- 12
src/pages/check/loc/list/index.jsx Ver fichero

40
       <PowerList
40
       <PowerList
41
         request={getTaCheckItem}
41
         request={getTaCheckItem}
42
         params={params}
42
         params={params}
43
-        renderItem={item => (
44
-          <Cell
45
-            isLink
46
-            key={item.itemId}
47
-            title={item.name}
48
-            onClick={() => onClick(item)}
49
-          >
50
-            {
51
-              item.num <= item.answerNum ? <Tag color="var(--main-bg-color)">{`${item.answerNum}/${item.num}`}</Tag> : null
52
-            }
53
-          </Cell>
54
-        )}
43
+        renderItem={item => {
44
+          const color = item.answerNum >= item.num ? '#aeaeae' : 'var(--main-bg-color)';
45
+
46
+          return (
47
+            <Cell
48
+              isLink
49
+              key={item.itemId}
50
+              title={item.name}
51
+              onClick={() => onClick(item)}
52
+            >
53
+              <Tag color={color}>{`${item.answerNum}/${item.num}`}</Tag>
54
+            </Cell>
55
+          )
56
+        }}
55
         onLoadingChange={setLoading}
57
         onLoadingChange={setLoading}
56
       />
58
       />
57
     </Page>
59
     </Page>

+ 3
- 1
src/pages/home/index.config.js Ver fichero

1
+// eslint-disable-next-line no-undef
1
 export default definePageConfig({
2
 export default definePageConfig({
2
-  navigationBarTitleText: '首页'
3
+  navigationBarTitleText: '首页',
4
+  enableShareAppMessage: true,
3
 })
5
 })

+ 1
- 1
src/services/taorgissue.js Ver fichero

17
 /*
17
 /*
18
  * 通过ISSUE_ID查询单条数据
18
  * 通过ISSUE_ID查询单条数据
19
  */
19
  */
20
-export const getTaOrgIssueByIssueId = (issueId, orgId) => request(`/api/taIssue/${issueId}/orgIssue?orgId=${orgId}`);
20
+export const getTaOrgIssueByIssueId = (issueId, orgId = '') => request(`/api/taIssue/${issueId}/orgIssue?orgId=${orgId}`);
21
 
21
 
22
 /*
22
 /*
23
  * 更新数据
23
  * 更新数据