瀏覽代碼

地图完成

weiximei 5 年之前
父節點
當前提交
241e44b414

+ 9
- 1
config/config.js 查看文件

@@ -138,5 +138,13 @@ export default {
138 138
   },
139 139
   chainWebpack: webpackPlugin,
140 140
 
141
-  proxy,
141
+  proxy: {
142
+    ...proxy,
143
+    '/gaode_amap': { // 高德地图
144
+      // target: 'http://192.168.0.11:8080/',
145
+      target: 'https://restapi.amap.com/v3/',
146
+      changeOrigin: true,
147
+      pathRewrite: { '^/gaode_amap': '' },
148
+    },
149
+  },
142 150
 };

+ 103
- 0
src/pages/building/list/add/components/amapAroundData.js 查看文件

@@ -0,0 +1,103 @@
1
+import request from '../../../../../utils/request';
2
+import apis from '../../../../../services/apis';
3
+
4
+const KEY = '14f05ce59c26364fd0674014dc0d8b1b'
5
+
6
+const POI_TYPES_KETY = {
7
+    Transport: 'Transport',
8
+    Mall: 'Mall',
9
+    Edu: 'Edu',
10
+    Hospital: 'Hospital',
11
+    Bank: 'Bank',
12
+    Restaurant: 'Restaurant',
13
+}
14
+
15
+// key 值会被拿到 building 表中 组合为字段名
16
+const POI_TYPES = [
17
+    {
18
+      key: POI_TYPES_KETY.Transport,
19
+      label: '交通',
20
+      types: ['150100', '150200', '150300', '150400', '150500', '150600'],
21
+      data: [],
22
+    },
23
+    {
24
+      key: POI_TYPES_KETY.Mall,
25
+      label: '商业',
26
+      types: ['060100', '060200', '060300', '060400', '060500', '060600',
27
+              '060700', '060800', '060900', '061000', '061100', '061200',
28
+              '061300', '061400', '080100', '080200', '080300', '080400',
29
+              '080500', '080600'],
30
+      data: [],
31
+    },
32
+    {
33
+      key: POI_TYPES_KETY.Edu,
34
+      label: '学校',
35
+      types: ['141200'],
36
+      data: [],
37
+    },
38
+    {
39
+      key: POI_TYPES_KETY.Hospital,
40
+      label: '医院',
41
+      types: ['090100', '090200', '090300', '090400', '090500', '090600', '090700'],
42
+      data: [],
43
+    },
44
+    {
45
+      key: POI_TYPES_KETY.Bank,
46
+      label: '银行',
47
+      types: ['160100'],
48
+      data: [],
49
+    },
50
+    {
51
+      key: POI_TYPES_KETY.Restaurant,
52
+      label: '餐饮',
53
+      types: ['050100', '050200', '050300', '050400', '050500', '050600',
54
+              '050700', '050800', '050900'],
55
+      data: [],
56
+    },
57
+  ]
58
+
59
+/**
60
+ * 获取 POI 类型
61
+ * @param {*} keyType 
62
+ */
63
+const getPOIType = keyType => {
64
+    return POI_TYPES.filter(item => item.key === keyType)
65
+}
66
+
67
+/**
68
+ * 获取这个 keyType 类型的所有 types
69
+ * @param {类型的key值} keyType 
70
+ */
71
+const getTypes = keyType => {
72
+  const typesArr = getPOIType(keyType)
73
+  return typesArr[0].types.join('|')
74
+}
75
+
76
+/**
77
+ * 获取周边数据
78
+ * @param {查询参数} params 
79
+ */
80
+function getAroundData (params) {
81
+    return new Promise((resolve, reject) => {
82
+        const { types, location } = params
83
+        if (!types) {
84
+            // console.err('未传输类型types值')
85
+            reject(new Error('未传输类型types值'))
86
+            return
87
+        }
88
+        if (!location) {
89
+            // console.err('未传输传输中心坐标location值')
90
+            reject(new Error('未传输传输中心坐标location值'))
91
+            return
92
+        }
93
+
94
+        request({ ...apis.amap.webService, params: { ...params, key: KEY, types: getTypes(types), location } }).then(data => {
95
+            // console.log(data)
96
+            resolve(data)
97
+        }).catch(err => {
98
+            reject(err)
99
+        })
100
+    })
101
+}
102
+
103
+export { POI_TYPES_KETY, getAroundData, getPOIType, POI_TYPES }

+ 79
- 5
src/pages/building/list/add/components/base.jsx 查看文件

@@ -1,10 +1,10 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, InputNumber, notification } from 'antd';
3 3
 import moment from 'moment';
4
+import { router } from 'umi';
4 5
 import request from '../../../../../utils/request';
5 6
 import apis from '../../../../../services/apis';
6 7
 import Styles from '../style.less';
7
-import { router } from 'umi';
8 8
 import ImageUpload from '../../../../../components/XForm/ImageUpload'
9 9
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
10 10
 import Wangedit from '../../../../../components/Wangedit/Wangedit'
@@ -13,6 +13,8 @@ import Amap from './amap'
13 13
 import BudildingProjectType from './buildingProjectType'
14 14
 import SelectCity from '../../../../../components/SelectButton/CitySelect'
15 15
 import FileUpload from '@/components/XForm/FileUpload';
16
+import { POI_TYPES_KETY, getAroundData, getPOIType, POI_TYPES } from './amapAroundData'
17
+import { ifError } from 'assert';
16 18
 
17 19
 const { Option } = Select
18 20
 const { TabPane } = Tabs;
@@ -41,6 +43,8 @@ function openNotificationWithIcon(type, message) {
41 43
 function AddBuilding(props) {
42 44
   const { getFieldDecorator } = props.form;
43 45
 
46
+  const [poi, setPoi] = useState([])
47
+
44 48
   console.log('props.building: ', props.building)
45 49
   if (props.building.buildingId !== undefined) {
46 50
     const { buildingId } = props.building
@@ -48,13 +52,13 @@ function AddBuilding(props) {
48 52
      useEffect(() => {
49 53
       if (buildingId !== '') {
50 54
         getById(buildingId)
55
+        setPoi(POI_TYPES)
51 56
       }
52 57
     }, [])
53 58
   }
54 59
 
55 60
    // 获取详情信息
56 61
    function getById(currentId) {
57
-
58 62
     request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
59 63
       if (res.openingDate !== null) {
60 64
         res.openingDate = moment(res.openingDate)
@@ -87,6 +91,8 @@ function AddBuilding(props) {
87 91
   }
88 92
 
89 93
   function addBuilding(data) {
94
+    console.log('poi: ', poi)
95
+    data.mapJson = poi
90 96
     data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
91 97
     data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
92 98
     // 项目主图
@@ -121,6 +127,74 @@ function AddBuilding(props) {
121 127
     })
122 128
   }
123 129
 
130
+  // 周边设施 回调
131
+  function getMapScope(e) {
132
+    const coordinate = props.form.getFieldValue('coordinate').split(',')
133
+    const poiData = [].concat(POI_TYPES)
134
+    poiData.map(item => {
135
+      getAroundData({ types: item.key, location: `${coordinate[1]},${coordinate[0]}`, radius: e }).then(res => {
136
+        const { pois } = res
137
+        setFormMapScopeValue(item.key, pois)
138
+      }).catch(err => {
139
+        console.log(err.message)
140
+        openNotificationWithIcon('error', '周边数据获取失败')
141
+      })
142
+    })
143
+  }
144
+
145
+  function setFormMapScopeValue(key, pois) {
146
+    const poiArray = pois.map(p => {
147
+      return {
148
+        address: p.address,
149
+        adname: p.adname,
150
+        cityname: p.cityname,
151
+        distance: p.distance,
152
+        id: p.id,
153
+        location: p.location,
154
+        name: p.name,
155
+        pname: p.pname,
156
+        shopinfo: p.shopinfo,
157
+        type: p.type,
158
+        typecode: p.typecode,
159
+      }
160
+    })
161
+    
162
+    // 设置表单值
163
+    getFormMapScopeName(key, { data: poiArray })
164
+
165
+    const newPoi = poi.map(m => {
166
+      if (m.key === key) {
167
+        m.data = poiArray
168
+      }
169
+      return m
170
+    })
171
+    setPoi(newPoi)
172
+  }
173
+
174
+  function getFormMapScopeName(keyType, item) {
175
+    switch (keyType) {
176
+      case POI_TYPES_KETY.Transport:
177
+        props.form.setFieldsValue({ buildingTransport: item.data.map(t => t.name).join(',') })
178
+        return 'buildingTransport';
179
+      case POI_TYPES_KETY.Bank:
180
+        props.form.setFieldsValue({ buildingBank: item.data.map(t => t.name).join(',') })
181
+        return 'buildingBank';
182
+      case POI_TYPES_KETY.Edu:
183
+        props.form.setFieldsValue({ buildingEdu: item.data.map(t => t.name).join(',') })
184
+        return 'buildingEdu';
185
+      case POI_TYPES_KETY.Hospital:
186
+        props.form.setFieldsValue({ buildingHospital: item.data.map(t => t.name).join(',') })
187
+        return 'buildingHospital';
188
+      case POI_TYPES_KETY.Restaurant:
189
+        props.form.setFieldsValue({ buildingRestaurant: item.data.map(t => t.name).join(',') })
190
+        return 'buildingRestaurant';
191
+      case POI_TYPES_KETY.Mall:
192
+        props.form.setFieldsValue({ buildingMall: item.data.map(t => t.name).join(',') })
193
+        return 'buildingMall';
194
+      default:
195
+    }
196
+  }
197
+
124 198
   return (
125 199
         <Form {...formItemLayout} onSubmit={handleSubmit}>
126 200
           <Form.Item label="项目Id" style={{ display: 'none' }}>
@@ -186,7 +260,7 @@ function AddBuilding(props) {
186 260
           <Form.Item label="项目标签" >
187 261
             {getFieldDecorator('tag')(
188 262
               <Select mode="tags" placeholder="输入后选中" style={{ width: '1016px' }}>
189
-                
263
+
190 264
               </Select>,
191 265
             )}
192 266
           </Form.Item>
@@ -226,7 +300,7 @@ function AddBuilding(props) {
226 300
             {getFieldDecorator('discount')(<Input />)}
227 301
           </Form.Item>
228 302
           <Form.Item label="首页推荐" >
229
-            {getFieldDecorator('isMain',{
303
+            {getFieldDecorator('isMain', {
230 304
               initialValue: 1,
231 305
             })(
232 306
             <Radio.Group>
@@ -264,7 +338,7 @@ function AddBuilding(props) {
264 338
             {getFieldDecorator('mapScope', {
265 339
               rules: [{ required: true, message: '请选择周边设施搜索范围' }],
266 340
             })(
267
-              <Select placeholder="请选择周边设施搜索范围" style={{ width: '970px' }}>
341
+              <Select placeholder="请选择周边设施搜索范围" style={{ width: '970px' }} onChange={e => getMapScope(e)}>
268 342
                 <Option value={1000}>1公里</Option>
269 343
                 <Option value={3000}>3公里</Option>
270 344
                 <Option value={5000}>5公里</Option>

+ 180
- 19
src/pages/building/list/add/components/buildingImage.jsx 查看文件

@@ -1,15 +1,37 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, Table, notification, Modal, Layout } from 'antd';
3 3
 import ImageListUpload from '../../../../../components/XForm/ImageListUpload';
4
+import moment from 'moment';
5
+import request from '../../../../../utils/request';
6
+import apis from '../../../../../services/apis';
4 7
 
5 8
 const { Header, Footer, Sider, Content } = Layout;
6 9
 
10
+const modalEdiFormItemLayout = {
11
+  labelCol: {
12
+    xs: { span: 24 },
13
+    sm: { span: 8 },
14
+  },
15
+  wrapperCol: {
16
+    xs: { span: 24 },
17
+    sm: { span: 16 },
18
+  },
19
+};
20
+
21
+const openNotificationWithIcon = (type, message) => {
22
+  notification[type]({
23
+    message,
24
+    description:
25
+      '',
26
+  });
27
+};
28
+
7 29
 /**
8 30
  * 弹框
9 31
  */
10 32
 function ModalEdi(props) {
11
-
12
-  const [visibleData, setVisibleData] = useState({ visible: false })
33
+  const { apartment, buildingId, apartmentId } = props.visibleData
34
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
13 35
 
14 36
   if (!props.visibleData) {
15 37
     console.error('缺少visibleData参数!')
@@ -17,6 +39,7 @@ function ModalEdi(props) {
17 39
 
18 40
   useEffect(() => {
19 41
     setVisibleData(props.visibleData)
42
+    props.form.setFieldsValue({ apartmentId, apartmentName: apartment !== '' ? apartment.apartmentName : '' })
20 43
   }, [props.visibleData.visible])
21 44
 
22 45
   function handleOk(e) {
@@ -29,54 +52,171 @@ function ModalEdi(props) {
29 52
     props.onCancel();
30 53
   }
31 54
 
55
+  function handleSubmit(e) {
56
+    e.preventDefault();
57
+    props.form.validateFieldsAndScroll((err, values) => {
58
+      if (!err) {
59
+        console.log('Received values of form: ', values);
60
+        submitData(values)
61
+      }
62
+    });
63
+  }
64
+
65
+  function submitData(data) {
66
+    if (buildingId === '' || buildingId === undefined) {
67
+      return
68
+    }
69
+    if (data.img) {
70
+        // 如果是 名称 和 图片一起编辑,就穿最新的图片
71
+      data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
72
+    } else {
73
+        // 如果是 名称 和 图片一起编辑,就穿最新的图片
74
+      data.img = visibleData.apartment.buildingImgList
75
+    }
76
+    data.buildingId = buildingId;
77
+    data.apartmentType = 'photo'
78
+    const api = (data.apartmentId !== undefined && data.apartmentId !== '') ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
79
+
80
+    // 网路请求
81
+    request({ ...api, data: { ...data } }).then(() => {
82
+      // eslint-disable-next-line no-unused-expressions
83
+      openNotificationWithIcon('success', '操作成功')
84
+      handleCancel()
85
+      props.onSuccess()
86
+      // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
87
+    }).catch(err => {
88
+      // eslint-disable-next-line no-unused-expressions
89
+      openNotificationWithIcon('error', err)
90
+    })
91
+  }
92
+
93
+  const { getFieldDecorator } = props.form;
32 94
   return (
33 95
     <>
34 96
       <Modal
35
-          title="Basic Modal"
97
+          title="编辑"
36 98
           visible={visibleData.visible}
37 99
           onOk={handleOk}
38 100
           onCancel={handleCancel}
101
+          width={700}
102
+          footer={null}
39 103
         >
40
-          <p>Some contents...</p>
41
-          <p>Some contents...</p>
42
-          <p>Some contents...</p>
104
+         <Form {...modalEdiFormItemLayout} onSubmit={handleSubmit}>
105
+          <Form.Item label="编号" style={{ display: 'none' }}>
106
+              {getFieldDecorator('apartmentId')(<Input />)}
107
+          </Form.Item>
108
+          <Form.Item label="相册名称">
109
+            {getFieldDecorator('apartmentName', {
110
+              rules: [
111
+                {
112
+                  required: true,
113
+                  message: '请输入相册名称',
114
+                },
115
+                {
116
+                  max: 10,
117
+                  message: '不超过10个字符',
118
+                },
119
+              ],
120
+            })(<Input />)}
121
+          </Form.Item>
122
+          {
123
+            !props.noImage && <Form.Item label="选择图片">
124
+            {getFieldDecorator('img', {
125
+              rules: [
126
+                {
127
+                  required: true,
128
+                  message: '请选择图片',
129
+                },
130
+              ],
131
+            })(<ImageListUpload />)}
132
+          </Form.Item>
133
+          }
134
+          <Form.Item style={{ display: 'flex', justifyContent: 'flex-end' }}>
135
+            <Button type="primary" htmlType="submit">
136
+              保存
137
+            </Button>
138
+            &nbsp;&nbsp;&nbsp;&nbsp;
139
+            <Button onClick={() => handleCancel()}>
140
+              取消
141
+            </Button>
142
+          </Form.Item>
143
+         </Form>
43 144
         </Modal>
44 145
     </>
45 146
   )
46 147
 }
47 148
 
149
+const WrappedModalEdiForm = Form.create({ name: 'ModalEdi' })(ModalEdi);
150
+
48 151
 /**
49 152
  * 模块
50 153
  */
51 154
 function BuildingImageModel(props) {
52 155
   const [imageList, setImageList] = useState([])
53
-  const [visibleData, setVisibleData] = useState({ visible: false })
156
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
157
+
158
+  useEffect(() => {
159
+    setImageList(getImgUrl())
160
+  }, [props.apartment.apartmentId])
161
+
162
+  function getImgUrl() {
163
+    return ((props.apartment.buildingImgList || [])).map(item => item.url)
164
+  }
165
+
166
+  function submitData(data) {
167
+    const { apartmentId } = props.apartment
168
+    if (apartmentId === '' || apartmentId === undefined) {
169
+      return
170
+    }
171
+
172
+    data.buildingId = props.apartment.buildingId;
173
+    data.apartmentType = 'photo'
174
+    const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
175
+
176
+    // 网路请求
177
+    request({ ...api, data: { ...data } }).then(() => {
178
+      // eslint-disable-next-line no-unused-expressions
179
+      openNotificationWithIcon('success', '操作成功')
180
+    }).catch(err => {
181
+      // eslint-disable-next-line no-unused-expressions
182
+      // openNotificationWithIcon('error', err)
183
+    })
184
+  }
54 185
 
55 186
   function onImageChange(e) {
56 187
     setImageList(e)
188
+       
189
+    // 新增加图片后,更新后端数据
190
+    const img = e.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
191
+    submitData({ ...props.apartment, img })
57 192
   }
58 193
 
59 194
   function edi() {
60
-    setVisibleData({ visible: true })
195
+    setVisibleData({ visible: true, buildingId: props.apartment.buildingId, apartmentId: props.apartment.apartmentId, apartment: props.apartment })
61 196
   }
62 197
 
63 198
   function onCancel(e) {
64
-    setVisibleData({ visible: false })
199
+    setVisibleData({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
65 200
   }
66 201
 
67 202
   function deletePhoto() {
203
+    request({ ...apis.building.buildingApartmentDelete, urlData: { id: props.apartment.apartmentId } }).then(() => {
204
+      openNotificationWithIcon('success', '操作成功')
205
+      props.onSuccess()
206
+    }).catch(err => {
68 207
 
208
+    })
69 209
   }
70 210
 
71 211
   return (
72 212
     <>
73
-<span style={{ marginTop: '10px', marginBottom: '10px' }}>效果图({imageList.length})</span>
213
+      <span style={{ marginTop: '10px', marginBottom: '10px' }}>{props.apartment.apartmentName}({imageList.length})</span>
74 214
       <Button type="link" style={{ color: 'blue' }} onClick={() => edi()}>重命名</Button>
75 215
       <Button type="link" style={{ color: 'blue' }} onClick={() => deletePhoto()}>删除相册</Button>
76 216
       <ImageListUpload value={imageList} onChange={onImageChange} unlimited/>
77 217
 
78 218
        {/* 编辑页 */}
79
-       <ModalEdi visibleData={visibleData} onCancel={e => onCancel(e)}/>
219
+       <WrappedModalEdiForm visibleData={visibleData} onCancel={e => onCancel(e)} onSuccess={() => props.onSuccess()} noImage/>
80 220
        <hr />
81 221
     </>
82 222
   )
@@ -85,28 +225,49 @@ function BuildingImageModel(props) {
85 225
 /**
86 226
  * 主体
87 227
  */
88
-function buildingImage() {
89
-  const [visibleData, setVisibleData] = useState({ visible: false })
228
+function buildingImage(props) {
229
+  // eslint-disable-next-line react-hooks/rules-of-hooks
230
+  const [visibleData, setVisibleData] = useState({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
231
+  const [imageList, setImageList] = useState([])
232
+
233
+  // eslint-disable-next-line react-hooks/rules-of-hooks
234
+  useEffect(() => {
235
+    getList()
236
+  }, [props.building.buildingId])
237
+ 
90 238
 
91 239
   function edi() {
92
-    setVisibleData({ visible: true })
240
+    setVisibleData({ visible: true, buildingId: props.building.buildingId, apartmentId: '', apartment: '' })
93 241
   }
94 242
 
95 243
   function onCancel(e) {
96
-    setVisibleData({ visible: false })
244
+    setVisibleData({ visible: false, buildingId: '', apartmentId: '', apartment: '' })
245
+  }
246
+
247
+  function onSuccess(e) {
248
+    getList()
249
+  }
250
+
251
+  function getList(params) {
252
+    // 网路请求
253
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'photo' } }).then(res => {
254
+      setImageList(res)
255
+    }).catch(err => {
256
+      openNotificationWithIcon('error', err.message)
257
+    })
97 258
   }
98 259
 
99 260
   return (
100 261
     <>
101 262
       <Button type="primary" onClick={() => edi()}>新增</Button>
102 263
       <Layout style={{ background: '#fff' }}>
103
-        <Content><BuildingImageModel /></Content>
104
-        <Content><BuildingImageModel /></Content>
105
-        <Content><BuildingImageModel /></Content>
264
+        {
265
+          imageList.map(item => <Content><BuildingImageModel apartment={item} key={item.apartmentId} onSuccess={e => onSuccess(e)}/></Content>)
266
+        }
106 267
       </Layout>
107 268
 
108 269
       {/* 编辑页 */}
109
-      <ModalEdi visibleData={visibleData} onCancel={e => onCancel(e)}/>
270
+      <WrappedModalEdiForm visibleData={visibleData} onCancel={e => onCancel(e)} onSuccess={e => onSuccess(e)}/>
110 271
     </>
111 272
   )
112 273
 }

+ 1
- 1
src/pages/building/list/add/components/imageSet.jsx 查看文件

@@ -53,7 +53,7 @@ function imageSet(props) {
53 53
 
54 54
   function getList(params) {
55 55
     // 网路请求
56
-    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params } }).then(res => {
56
+    request({ ...apis.building.buildingApartment, urlData: { id: props.building.buildingId }, params: { ...params, apartmentType: 'apart' } }).then(res => {
57 57
       setData(res)
58 58
     }).catch(err => {
59 59
       openNotificationWithIcon('error', err.message)

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

@@ -1,4 +1,6 @@
1 1
 const prefix = '/api/admin'
2
+// 高德地图
3
+const amapPrefix = '/gaode_amap'
2 4
 
3 5
 export default {
4 6
   image: {
@@ -906,5 +908,11 @@ export default {
906 908
     method: 'GET',
907 909
     action: 'admin.posterTemplate.get',
908 910
   },
911
+ },
912
+ amap: { // 高德地图
913
+   webService: { // Web服务Api ---- 周边搜索
914
+     url: `${amapPrefix}/place/around`,
915
+     method: 'GET',
916
+   },
909 917
  }
910 918
 }

+ 7
- 3
src/utils/request.js 查看文件

@@ -65,7 +65,6 @@ request.interceptors.request.use((url, options) => {
65 65
 });
66 66
 
67 67
 request.interceptors.response.use(async (response, options) => {
68
-
69 68
   if (response && response.status) {
70 69
     if (response.status != 200) {
71 70
       const errorText = codeMessage[response.status] || response.statusText;
@@ -76,12 +75,17 @@ request.interceptors.response.use(async (response, options) => {
76 75
       });
77 76
       throw new Error(response.statusText);
78 77
     } else {
79
-      console.log('response.headers: ', response.headers)
80
-      console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
78
+      // console.log('response.headers: ', response.headers)
79
+      // console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
81 80
       if (response.headers.get('Content-Type') === 'application/octet-stream;charset=utf-8') {
82 81
         return await response.clone().blob();
83 82
       }
84 83
 
84
+      // 高德地图的数据,直接返回
85
+      if (response.url.indexOf('gaode_amap') !== -1) {
86
+        return await response.clone().json();
87
+      }
88
+
85 89
       const { code, data, message } = await response.clone().json();
86 90
       if (code != 1000) {
87 91
         if (code === 1001) {