张涛 1年前
父节点
当前提交
f1b6103755

+ 3
- 0
.idea/.gitignore 查看文件

1
+# 默认忽略的文件
2
+/shelf/
3
+/workspace.xml

+ 6
- 0
.idea/google-java-format.xml 查看文件

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="GoogleJavaFormatSettings">
4
+    <option name="enabled" value="false" />
5
+  </component>
6
+</project>

+ 9
- 0
.idea/miniapp.iml 查看文件

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+    <exclude-output />
5
+    <content url="file://$MODULE_DIR$" />
6
+    <orderEntry type="inheritedJdk" />
7
+    <orderEntry type="sourceFolder" forTests="false" />
8
+  </component>
9
+</module>

+ 8
- 0
.idea/modules.xml 查看文件

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/.idea/miniapp.iml" filepath="$PROJECT_DIR$/.idea/miniapp.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 10
- 0
.idea/runConfigurations.xml 查看文件

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="RunConfigurationProducerService">
4
+    <option name="ignoredProducers">
5
+      <set>
6
+        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
7
+      </set>
8
+    </option>
9
+  </component>
10
+</project>

+ 6
- 0
.idea/vcs.xml 查看文件

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="" vcs="Git" />
5
+  </component>
6
+</project>

+ 8
- 0
src/app.js 查看文件

3
 import "./app.less";
3
 import "./app.less";
4
 import { useEffect } from "react";
4
 import { useEffect } from "react";
5
 import "@antmjs/vantui/lib/index.less";
5
 import "@antmjs/vantui/lib/index.less";
6
+import { getLocation } from "./utils/map";
6
 
7
 
7
 const App = (props) => {
8
 const App = (props) => {
8
   // useEffect(() => {
9
   // useEffect(() => {
10
   //   userState.current();
11
   //   userState.current();
11
   // }, []);
12
   // }, []);
12
 
13
 
14
+  useEffect(() => {
15
+    navigator.geolocation.getCurrentPosition((position) => {
16
+      console.log(position)
17
+      doSomething(position.coords.latitude, position.coords.longitude);
18
+    });
19
+  },[]);
20
+
13
   return <Provider>{props.children}</Provider>;
21
   return <Provider>{props.children}</Provider>;
14
 };
22
 };
15
 
23
 

+ 10
- 3
src/pages/issue/components/Issue/index.jsx 查看文件

141
     }
141
     }
142
   }, [issue]);
142
   }, [issue]);
143
 
143
 
144
+
145
+const onChangeText=(e) => {
146
+
147
+const value=e.detail.value
148
+setFieldChange("content", value)
149
+}
150
+
144
   return (
151
   return (
145
     <View>
152
     <View>
146
       <LocType
153
       <LocType
212
           onClick={() => !readOnly && setShowIssueType(true)}
219
           onClick={() => !readOnly && setShowIssueType(true)}
213
         />
220
         />
214
         <Cell title="问题描述" border={false} />
221
         <Cell title="问题描述" border={false} />
215
-
216
         <Textarea
222
         <Textarea
217
           // type="textarea"
223
           // type="textarea"
224
+          name="content"
218
           placeholder="请输入问题描述"
225
           placeholder="请输入问题描述"
219
           readonly={readOnly}
226
           readonly={readOnly}
220
           autosize={{ minHeight: "120px" }}
227
           autosize={{ minHeight: "120px" }}
221
           style={{ marginLeft: "20px" }}
228
           style={{ marginLeft: "20px" }}
222
-          // value={formData.content}
223
-          // onChange={(e) => setFieldChange("content", e.detail)}
229
+          value={formData.content}
230
+          onChange={onChangeText}
224
         ></Textarea>
231
         ></Textarea>
225
       </CellGroup>
232
       </CellGroup>
226
 
233
 

+ 0
- 1
src/pages/issue/edit/components/Assigned.jsx 查看文件

30
     setLoading1(true)
30
     setLoading1(true)
31
 
31
 
32
     const data = { ...issue, ...formData };
32
     const data = { ...issue, ...formData };
33
-
34
     // 先提交修改
33
     // 先提交修改
35
     putTaIssue(issue.issueId, data).then(() => {
34
     putTaIssue(issue.issueId, data).then(() => {
36
       // 再提交交办
35
       // 再提交交办

+ 27
- 25
src/utils/map.js 查看文件

1
 import Taro from "@tarojs/taro";
1
 import Taro from "@tarojs/taro";
2
-import gcoord from 'gcoord';
2
+import gcoord from "gcoord";
3
 
3
 
4
 // 腾讯地图接口 - 个人开发者
4
 // 腾讯地图接口 - 个人开发者
5
-const QMAP_WEBSERVICE_KEY = 'HTPBZ-HHJA7-XD2XD-PRS37-H3HVJ-U5BAA';
5
+const QMAP_WEBSERVICE_KEY = "HTPBZ-HHJA7-XD2XD-PRS37-H3HVJ-U5BAA";
6
 
6
 
7
 // https://lbs.qq.com/service/webService/webServiceGuide/webServiceGcoder
7
 // https://lbs.qq.com/service/webService/webServiceGuide/webServiceGcoder
8
 // location 为 gcj02 编码
8
 // location 为 gcj02 编码
9
 export function geocoder(location, getPoi = 0) {
9
 export function geocoder(location, getPoi = 0) {
10
   if (!location || location.length < 3) {
10
   if (!location || location.length < 3) {
11
-    return Promise.reject(new Error('待解析地址为空'));
11
+    return Promise.reject(new Error("待解析地址为空"));
12
   }
12
   }
13
 
13
 
14
   return new Promise((resolve, reject) => {
14
   return new Promise((resolve, reject) => {
15
-    const url = `${MAPHOST}/ws/geocoder/v1/?location=${location}&key=${QMAP_WEBSERVICE_KEY}&get_poi=${getPoi}`
16
-
17
-    Taro.request({ url }).then(({ data }) => {
18
-      const { status, message, result } = data || {};
19
-      if (status != 0) {
20
-        console.error(data);
21
-        reject(new Error(message));
22
-      } else {
23
-        resolve(result);
24
-      }
25
-    }).catch((err) => {
26
-      console.error(err);
27
-      reject(new Error(err.errMsg));
28
-    });
29
-  })
15
+    const url = `${MAPHOST}/ws/geocoder/v1/?location=${location}&key=${QMAP_WEBSERVICE_KEY}&get_poi=${getPoi}`;
16
+
17
+    Taro.request({ url })
18
+      .then(({ data }) => {
19
+        const { status, message, result } = data || {};
20
+        if (status != 0) {
21
+          console.error(data);
22
+          reject(new Error(message));
23
+        } else {
24
+          resolve(result);
25
+        }
26
+      })
27
+      .catch((err) => {
28
+        console.error(err);
29
+        reject(new Error(err.errMsg));
30
+      });
31
+  });
30
 }
32
 }
31
 
33
 
32
 // 使用 HTML H5 API 获取当前定位信息
34
 // 使用 HTML H5 API 获取当前定位信息
34
 // resolve 结果是 { lng, lat }
36
 // resolve 结果是 { lng, lat }
35
 export function getLocation() {
37
 export function getLocation() {
36
   return new Promise((resolve, reject) => {
38
   return new Promise((resolve, reject) => {
37
-    navigator.geolocation.getCurrentPosition(
39
+    return navigator.geolocation.getCurrentPosition(
38
       (position) => {
40
       (position) => {
39
-        console.log('----定位结果-->', JSON.stringify(position))
41
+        console.log("----定位结果-->", JSON.stringify(position));
40
         const { longitude, latitude } = position.coords;
42
         const { longitude, latitude } = position.coords;
41
 
43
 
42
         const data = gcoord.transform(
44
         const data = gcoord.transform(
46
         );
48
         );
47
 
49
 
48
         const result = {
50
         const result = {
49
-          location: { lng: data[0], lat: data[1] }
50
-        }
51
+          location: { lng: data[0], lat: data[1] },
52
+        };
51
 
53
 
52
         resolve(result);
54
         resolve(result);
53
       },
55
       },
54
       (err) => {
56
       (err) => {
55
-        console.error('----定位失败-->', JSON.stringify(err))
57
+        console.error("----定位失败-->", JSON.stringify(err));
56
         reject(err);
58
         reject(err);
57
       },
59
       },
58
       {
60
       {
59
         enableHighAccuracy: true,
61
         enableHighAccuracy: true,
60
       }
62
       }
61
-    )
62
-  })
63
+    );
64
+  });
63
 }
65
 }

+ 40
- 23
src/utils/request.js 查看文件

100
   const token = getToken();
100
   const token = getToken();
101
   for (var i = 0; i < files.length; i++) {
101
   for (var i = 0; i < files.length; i++) {
102
     uploads[i] = new Promise((resolve, reject) => {
102
     uploads[i] = new Promise((resolve, reject) => {
103
-      Taro.uploadFile({
104
-        // eslint-disable-next-line no-undef
105
-        url: url || `${HOST}/api/ma/file`,
106
-        filePath: files[i].tempFilePath,//
107
-        header: {
108
-          authorization: token,
109
-        },
110
-        name: "file",
111
-        formData: {
112
-          file: files[i].originalFileObj,
113
-          fileType: files[i].fileType,
114
-        },
115
-        success: function (res) {
116
-          // debugger
117
-          const _data = JSON.parse(res.data);
118
-          // if (_data.code !== CODE_SUCCESS) {
119
-          //   reject(new Error(_data.message))
120
-          // }
103
+      const formData = new FormData();
104
+      formData.append("file", files[i].originalFileObj);
105
+      formData.append("fileType", files[i].fileType);
106
+
107
+      fetch(url || `${HOST}/api/ma/file`, {
108
+        method: "POST",
109
+        headers: { authorization: token },
110
+        body: formData,
111
+      })
112
+        .then((res) => res.json()) // Add this line to parse the response as JSON
113
+        .then((_data) => {
114
+          if (_data.code !== 1000) {
115
+            reject(new Error(_data.message));
116
+          }
121
 
117
 
122
           resolve(_data.data);
118
           resolve(_data.data);
123
-        },
124
-        fail(err) {
125
-          reject(err);
126
-        },
127
-      });
119
+        });
120
+      // Taro.uploadFile({
121
+      //   // eslint-disable-next-line no-undef
122
+      //   url: url || `${HOST}/api/ma/file`,
123
+      //   filePath: files[i].tempFilePath, //
124
+      //   header: {
125
+      //     authorization: token,
126
+      //   },
127
+      //   name: "file",
128
+      //   formData: {
129
+      //     file: files[i].originalFileObj,
130
+      //     fileType: files[i].fileType,
131
+      //   },
132
+      //   success: function (res) {
133
+      //     // debugger
134
+      //     const _data = JSON.parse(res.data);
135
+      //     // if (_data.code !== CODE_SUCCESS) {
136
+      //     //   reject(new Error(_data.message))
137
+      //     // }
138
+
139
+      //     resolve(_data.data);
140
+      //   },
141
+      //   fail(err) {
142
+      //     reject(err);
143
+      //   },
144
+      // });
128
     });
145
     });
129
   }
146
   }
130
 
147