张涛 1 jaar geleden
bovenliggende
commit
f1b6103755

+ 3
- 0
.idea/.gitignore Bestand weergeven

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

+ 6
- 0
.idea/google-java-format.xml Bestand weergeven

@@ -0,0 +1,6 @@
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 Bestand weergeven

@@ -0,0 +1,9 @@
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 Bestand weergeven

@@ -0,0 +1,8 @@
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 Bestand weergeven

@@ -0,0 +1,10 @@
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 Bestand weergeven

@@ -0,0 +1,6 @@
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 Bestand weergeven

@@ -3,6 +3,7 @@ import store, { Provider } from "@/store";
3 3
 import "./app.less";
4 4
 import { useEffect } from "react";
5 5
 import "@antmjs/vantui/lib/index.less";
6
+import { getLocation } from "./utils/map";
6 7
 
7 8
 const App = (props) => {
8 9
   // useEffect(() => {
@@ -10,6 +11,13 @@ const App = (props) => {
10 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 21
   return <Provider>{props.children}</Provider>;
14 22
 };
15 23
 

+ 10
- 3
src/pages/issue/components/Issue/index.jsx Bestand weergeven

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

+ 0
- 1
src/pages/issue/edit/components/Assigned.jsx Bestand weergeven

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

+ 27
- 25
src/utils/map.js Bestand weergeven

@@ -1,32 +1,34 @@
1 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 7
 // https://lbs.qq.com/service/webService/webServiceGuide/webServiceGcoder
8 8
 // location 为 gcj02 编码
9 9
 export function geocoder(location, getPoi = 0) {
10 10
   if (!location || location.length < 3) {
11
-    return Promise.reject(new Error('待解析地址为空'));
11
+    return Promise.reject(new Error("待解析地址为空"));
12 12
   }
13 13
 
14 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 34
 // 使用 HTML H5 API 获取当前定位信息
@@ -34,9 +36,9 @@ export function geocoder(location, getPoi = 0) {
34 36
 // resolve 结果是 { lng, lat }
35 37
 export function getLocation() {
36 38
   return new Promise((resolve, reject) => {
37
-    navigator.geolocation.getCurrentPosition(
39
+    return navigator.geolocation.getCurrentPosition(
38 40
       (position) => {
39
-        console.log('----定位结果-->', JSON.stringify(position))
41
+        console.log("----定位结果-->", JSON.stringify(position));
40 42
         const { longitude, latitude } = position.coords;
41 43
 
42 44
         const data = gcoord.transform(
@@ -46,18 +48,18 @@ export function getLocation() {
46 48
         );
47 49
 
48 50
         const result = {
49
-          location: { lng: data[0], lat: data[1] }
50
-        }
51
+          location: { lng: data[0], lat: data[1] },
52
+        };
51 53
 
52 54
         resolve(result);
53 55
       },
54 56
       (err) => {
55
-        console.error('----定位失败-->', JSON.stringify(err))
57
+        console.error("----定位失败-->", JSON.stringify(err));
56 58
         reject(err);
57 59
       },
58 60
       {
59 61
         enableHighAccuracy: true,
60 62
       }
61
-    )
62
-  })
63
+    );
64
+  });
63 65
 }

+ 40
- 23
src/utils/request.js Bestand weergeven

@@ -100,31 +100,48 @@ export const uploadFiles = async (files, url) => {
100 100
   const token = getToken();
101 101
   for (var i = 0; i < files.length; i++) {
102 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 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