fangmingyue vor 2 Jahren
Ursprung
Commit
80de8294c9

+ 2
- 1
src/app.config.js Datei anzeigen

@@ -24,7 +24,8 @@ export default defineAppConfig({
24 24
     'pages/notice/detail/index',
25 25
     'pages/my/index',
26 26
     'pages/my/edit/index',
27
-    'pages/statistics/index'
27
+    'pages/statistics/index',
28
+    'pages/feedback/index'
28 29
   ],
29 30
   window: {
30 31
     // backgroundColor: '#1A7565',

+ 1
- 1
src/layouts/TabBar.jsx Datei anzeigen

@@ -47,7 +47,7 @@ const feedback = {
47 47
   label: '发布',
48 48
   icon: issueIcon,
49 49
   activeIcon: issueActiveIcon,
50
-  page: '/pages/issue/edit/index'
50
+  page: '/pages/feedback/index'
51 51
 }
52 52
 const check = {
53 53
   name: 'check',

+ 3
- 0
src/pages/feedback/index.config.js Datei anzeigen

@@ -0,0 +1,3 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '新建随手拍'
3
+})

+ 184
- 0
src/pages/feedback/index.jsx Datei anzeigen

@@ -0,0 +1,184 @@
1
+import React from 'react';
2
+import Taro from '@tarojs/taro';
3
+import { View } from '@tarojs/components';
4
+import { Button, Notify, Field, Cell, CellGroup } from '@antmjs/vantui';
5
+import LocType from '@/components/LocType';
6
+import IssueType from '@/components/IssueType';
7
+import OrgPicker from '@/components/OrgPicker';
8
+import DatePicker from '@/components/DatePicker';
9
+import Map from '@/components/map';
10
+import Uploader from '@/components/Uploader/index';
11
+import { getIssueStatus } from '@/utils/biz';
12
+import { getDateStr } from '@/utils/date';
13
+import mapIcon from '@/assets/icons/marker.png';
14
+
15
+export default (props) => {
16
+  const today = new Date();
17
+
18
+  const {
19
+    issue,
20
+    readOnly,
21
+    showOrg,
22
+    showExpireDate,
23
+    renderFields,
24
+    renderAction
25
+  } = props;
26
+
27
+  const [formData, setFormData] = React.useState({
28
+    typeId: undefined,
29
+    typeName: undefined,
30
+    locId: undefined,
31
+    locName: undefined,
32
+    location: undefined,
33
+    addr: undefined,
34
+    content: undefined,
35
+    attachList: [],
36
+  });
37
+  const [showLocType, setShowLocType] = React.useState(false);
38
+  const [showIssueType, setShowIssueType] = React.useState(false);
39
+  const [showOrgPicker, setShowOrgPicker] = React.useState(false);
40
+  const [showDatePicker, setShowDatePicker] = React.useState(false);
41
+  const [bizStatus, setBizStatus] = React.useState();
42
+  const [issueProcess, setIssueProcess] = React.useState([]);
43
+
44
+  const issueReject = React.useMemo(() => {
45
+    if (!issueProcess || !issueProcess.length) return {};
46
+
47
+    return issueProcess.filter(x => x.processStatus === 'reject')[0] || {};
48
+  }, [issueProcess]);
49
+
50
+  const onLocTypeChange = (_, it) => {
51
+    setFormData({
52
+      ...formData,
53
+      locId: it.typeId,
54
+      locName: it.name,
55
+    });
56
+    setShowLocType(false);
57
+  }
58
+
59
+  const onIssueTypeChange = (_, it) => {
60
+    setFormData({
61
+      ...formData,
62
+      typeId: it.typeId,
63
+      typeName: it.name,
64
+    });
65
+    setShowIssueType(false);
66
+  }
67
+
68
+  const onOrgChange = (_, it) => {
69
+    setFormData({
70
+      ...formData,
71
+      orgId: it.orgId,
72
+      orgName: it.name,
73
+    });
74
+    setShowOrgPicker(false);
75
+  }
76
+
77
+  const onDateChange = (dt) => {
78
+    const date = getDateStr(dt);
79
+    setFormData({
80
+      ...formData,
81
+      expireDate: date,
82
+    });
83
+    setShowDatePicker(false);
84
+  }
85
+
86
+  const setFieldChange = (field, value) => {
87
+    setFormData({
88
+      ...formData,
89
+      [field]: value,
90
+    })
91
+  }
92
+
93
+  React.useEffect(() => {
94
+    if (issue) {
95
+      setFormData(issue);
96
+      setBizStatus(getIssueStatus(issue));
97
+
98
+      // if (issue.processStatus == 'reject') {
99
+      //   getIssueProcess({ pageSize: 100, issueId: issue.issueId }).then(res => {
100
+      //     setIssueProcess(res.records || []);
101
+      //   })
102
+      // }
103
+    }
104
+  }, [issue]);
105
+
106
+  return (
107
+    <View>
108
+      {/* <LocType
109
+        show={showLocType}
110
+        value={formData.locId}
111
+        onCancel={() => setShowLocType(false)}
112
+        onChange={onLocTypeChange}
113
+      />
114
+
115
+      <IssueType
116
+        show={showIssueType}
117
+        value={formData.typeName}
118
+        onCancel={() => setShowIssueType(false)}
119
+        onChange={onIssueTypeChange}
120
+      />
121
+
122
+      <OrgPicker
123
+        show={showOrgPicker}
124
+        value={formData.orgName}
125
+        onCancel={() => setShowOrgPicker(false)}
126
+        onChange={onOrgChange}
127
+      />
128
+
129
+      <DatePicker
130
+        type="date"
131
+        minDate={today}
132
+        show={showDatePicker}
133
+        value={formData.expireDate}
134
+        onCancel={() => setShowDatePicker(false)}
135
+        onChange={onDateChange}
136
+      /> */}
137
+
138
+      <Map location={formData.location} />
139
+
140
+      <CellGroup>
141
+        <Field
142
+          placeholder="阳光丽景小区"
143
+          value={formData.addr}
144
+          leftIcon={mapIcon}
145
+          readonly={readOnly}
146
+          onChange={e => setFieldChange('addr', e.detail)}
147
+        />
148
+      </CellGroup>
149
+
150
+      <CellGroup style={{ marginTop: '20px' }}>
151
+
152
+        <Cell title="问题描述" size="large" border={false} />
153
+
154
+        <Field
155
+          type="textarea"
156
+          placeholder="请输入问题描述"
157
+          readonly={readOnly}
158
+          autosize={{ minHeight: '120px' }}
159
+          value={formData.content}
160
+          onChange={e => setFieldChange('content', e.detail)}
161
+        />
162
+      </CellGroup>
163
+
164
+      <CellGroup style={{ marginTop: '20px' }}>
165
+        <Cell title="拍照" size="large" border={false} />
166
+
167
+        <Cell
168
+          renderTitle={
169
+            <Uploader
170
+              value={formData.attachList}
171
+              disabled={readOnly}
172
+              onChange={e => setFieldChange('attachList', e)}
173
+            />
174
+          }
175
+        />
176
+      </CellGroup>
177
+
178
+      <View style={{ padding: 'var(--main-space)', background: '#fff' }}>
179
+        <Button block type="primary">提交</Button>
180
+      </View>
181
+
182
+    </View>
183
+  )
184
+}

+ 13
- 3
src/pages/home/components/Head.jsx Datei anzeigen

@@ -1,9 +1,10 @@
1 1
 import React from 'react';
2
-import { View, Image } from '@tarojs/components';
2
+import { View, Image, Button } from '@tarojs/components';
3 3
 import { ActionSheet, Cell } from '@antmjs/vantui';
4 4
 import { ROLES, ROLE_CITIZEN } from '@/utils/user';
5 5
 import logo from '@/assets/image/logo.png';
6 6
 import Icon from '@/assets/icons/avatar.png';
7
+import { useModel } from '@/store';
7 8
 import style from './head.module.less';
8 9
 
9 10
 export default (props) => {
@@ -21,7 +22,7 @@ export default (props) => {
21 22
   }, [user, person]);
22 23
 
23 24
   const actions = React.useMemo(() => {
24
-    return dutyList.map(x => ({name: ROLES[x], value: x}));
25
+    return dutyList.map(x => ({ name: ROLES[x], value: x }));
25 26
   }, [dutyList]);
26 27
 
27 28
   const onClick = () => {
@@ -33,6 +34,13 @@ export default (props) => {
33 34
     onDutyChange(e.detail.value)
34 35
   }
35 36
 
37
+  const { getAvatar } = useModel('user');
38
+
39
+  const onChooseAvatar = (e) => {
40
+    const code = e.detail.code;
41
+    getAvatar(code).then(props.onSuccess);
42
+  }
43
+
36 44
   return (
37 45
     <View className={style.head}>
38 46
       <View className={style.profile}>
@@ -53,7 +61,9 @@ export default (props) => {
53 61
         />
54 62
       </View>
55 63
       <View className={style.avatar}>
56
-        <Image src={avatar}></Image>
64
+        <Button openType="chooseAvatar" onChooseAvatar={onChooseAvatar}>
65
+          <Image src={avatar}></Image>
66
+        </Button>
57 67
       </View>
58 68
     </View>
59 69
   )

+ 6
- 3
src/pages/home/components/head.module.less Datei anzeigen

@@ -1,4 +1,3 @@
1
-
2 1
 .head {
3 2
   width: 100vw;
4 3
   height: 30vw;
@@ -21,7 +20,7 @@
21 20
       margin-top: var(--main-space);
22 21
       height: 48px;
23 22
       line-height: 46px; // 向上偏移2像素
24
-      background: linear-gradient(0, #E36A00, #FFA658);
23
+      background: linear-gradient(0, #e36a00, #ffa658);
25 24
       border-radius: 22px;
26 25
       font-size: 24px;
27 26
       text-align: center;
@@ -50,9 +49,13 @@
50 49
     border-radius: 50%;
51 50
     border: 4px solid #fff;
52 51
 
52
+    button {
53
+      background: transparent;
54
+      padding: 0;
55
+    }
53 56
     image {
54 57
       width: 100%;
55
-      height: 100%;
58
+      height: 112px;
56 59
     }
57 60
   }
58 61
 }