fangmingyue 2 年之前
父節點
當前提交
80de8294c9

+ 2
- 1
src/app.config.js 查看文件

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

+ 1
- 1
src/layouts/TabBar.jsx 查看文件

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

+ 3
- 0
src/pages/feedback/index.config.js 查看文件

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

+ 184
- 0
src/pages/feedback/index.jsx 查看文件

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 查看文件

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

+ 6
- 3
src/pages/home/components/head.module.less 查看文件

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