Yansen 2 vuotta sitten
vanhempi
commit
2689cc0919

+ 1
- 1
project.config.json Näytä tiedosto

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

+ 6
- 0
src/layouts/index.jsx Näytä tiedosto

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

+ 22
- 0
src/pages/check/edit/components/AgePicker.jsx Näytä tiedosto

@@ -0,0 +1,22 @@
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 Näytä tiedosto

@@ -1,15 +1,17 @@
1 1
 import React from 'react';
2 2
 import Taro from '@tarojs/taro';
3 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 5
 import Map from '@/components/map';
6 6
 import { getTaCheckItemAnswer } from '@/services/tacheckitem';
7 7
 import mapIcon from '@/assets/icons/marker.png';
8
+import AgePicker from './AgePicker';
8 9
 
9 10
 export default (props) => {
10 11
   const { checkItemInfo, checkType, answer, readonly, onChange, onLoadingChange } = props;
11 12
 
12 13
   const [loc, setLoc] = React.useState();
14
+  const [showAgePicker, setShowAgePicker] = React.useState(false);
13 15
 
14 16
   const setLoading = (v) => {
15 17
     if (onLoadingChange) {
@@ -56,6 +58,36 @@ export default (props) => {
56 58
           onChange={e => setFieldChange('addr', e.detail)}
57 59
         />
58 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 91
     </View>
60 92
   )
61 93
 }

+ 17
- 13
src/pages/check/edit/components/Question.jsx Näytä tiedosto

@@ -7,7 +7,7 @@ import { getTaCheckAnswerItem } from '@/services/tacheckansweritem';
7 7
 
8 8
 
9 9
 export default (props) => {
10
-  const { quInfo, answerItem, readonly, onChange, onLoadingChange } = props;
10
+  const { quInfo, answerItem, checkType, readonly, onChange, onLoadingChange } = props;
11 11
 
12 12
   const setLoading = (v) => {
13 13
     if (onLoadingChange) {
@@ -89,19 +89,23 @@ export default (props) => {
89 89
           }
90 90
         />
91 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 109
     </View>
106 110
   )
107 111
 }

+ 7
- 4
src/pages/check/edit/index.jsx Näytä tiedosto

@@ -17,6 +17,8 @@ import LocForm from './components/LocForm';
17 17
 import Question from './components/Question';
18 18
 import Footer from './components/Footer/index';
19 19
 
20
+const isNotEmpty = str => str !== undefined && str !== null && str.replace(/\s/g, '') !== '';
21
+
20 22
 export default (props) => {
21 23
 
22 24
   const router = Taro.useRouter();
@@ -31,9 +33,9 @@ export default (props) => {
31 33
 
32 34
   React.useMemo(() => {
33 35
     if (typ == 'loc') {
34
-      Taro.setNavigationBarTitle('实地测评');
36
+      Taro.setNavigationBarTitle({ title: '实地测评' });
35 37
     } else {
36
-      Taro.setNavigationBarTitle('调查问卷');
38
+      Taro.setNavigationBarTitle({ title: '调查问卷' });
37 39
     }
38 40
   }, [typ]);
39 41
 
@@ -66,8 +68,8 @@ export default (props) => {
66 68
     const an = { ...(answer || {}) }
67 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 74
       quInfo.finished = true
73 75
     } else {
@@ -228,6 +230,7 @@ export default (props) => {
228 230
                 index == inx && (
229 231
                   <Question
230 232
                     key={x.quId}
233
+                    checkType={typ}
231 234
                     cursor={inx}
232 235
                     readonly={readonly}
233 236
                     quInfo={x}

+ 14
- 12
src/pages/check/loc/list/index.jsx Näytä tiedosto

@@ -40,18 +40,20 @@ export default (props) => {
40 40
       <PowerList
41 41
         request={getTaCheckItem}
42 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 57
         onLoadingChange={setLoading}
56 58
       />
57 59
     </Page>

+ 3
- 1
src/pages/home/index.config.js Näytä tiedosto

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

+ 1
- 1
src/services/taorgissue.js Näytä tiedosto

@@ -17,7 +17,7 @@ export const getTaOrgIssueById = (id) => request(`/api/taOrgIssue/${id}`);
17 17
 /*
18 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
  * 更新数据