vue2-client 1.6.24 → 1.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -1
- package/package.json +1 -1
- package/src/layouts/SinglePageView.vue +2 -0
- package/src/utils/map-utils.js +37 -37
- package/src/utils/request.js +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/utils/map-utils.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import AMapLoader from '@amap/amap-jsapi-loader'
|
|
2
|
-
let Amap
|
|
3
|
-
async function GetGDMap () {
|
|
4
|
-
if (!Amap) {
|
|
5
|
-
window._AMapSecurityConfig = {
|
|
6
|
-
securityJsCode: '275e59edb26ab1f917cfe7f05bea7979'
|
|
7
|
-
}
|
|
8
|
-
Amap = await AMapLoader.load({
|
|
9
|
-
key: '55a4807a6fc3adca5510f69578b1ae4a', // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
10
|
-
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
11
|
-
plugins: ['AMap.IndexCluster','AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
|
|
12
|
-
'AMap.ToolBar', 'AMap.Geolocation',
|
|
13
|
-
'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
14
|
-
AMapUI: {
|
|
15
|
-
version: '1.1', // AMapUI 缺省 1.1
|
|
16
|
-
plugins: [] // 需要加载的 AMapUI ui插件
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
return Amap
|
|
21
|
-
}
|
|
22
|
-
async function GetLocation (address) {
|
|
23
|
-
return new Promise(async (resolve, reject) => {
|
|
24
|
-
new (await GetGDMap()).Geocoder({
|
|
25
|
-
radius: 500 // 范围,默认:500
|
|
26
|
-
}).getLocation(address, function (status, result) {
|
|
27
|
-
console.log(result)
|
|
28
|
-
if (status === 'complete' && result.geocodes.length) {
|
|
29
|
-
resolve({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
|
|
30
|
-
} else {
|
|
31
|
-
// eslint-disable-next-line prefer-promise-reject-errors
|
|
32
|
-
reject('根据经纬度查询地址失败')
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
export { GetGDMap, GetLocation }
|
|
1
|
+
import AMapLoader from '@amap/amap-jsapi-loader'
|
|
2
|
+
let Amap
|
|
3
|
+
async function GetGDMap () {
|
|
4
|
+
if (!Amap) {
|
|
5
|
+
window._AMapSecurityConfig = {
|
|
6
|
+
securityJsCode: '275e59edb26ab1f917cfe7f05bea7979'
|
|
7
|
+
}
|
|
8
|
+
Amap = await AMapLoader.load({
|
|
9
|
+
key: '55a4807a6fc3adca5510f69578b1ae4a', // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
10
|
+
version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
|
|
11
|
+
plugins: ['AMap.IndexCluster', 'AMP.MarkerCluster', 'AMap.InfoWindow', 'AMap.HeatMap', 'AMap.HawkEye', 'AMap.DistrictSearch',
|
|
12
|
+
'AMap.ToolBar', 'AMap.Geolocation',
|
|
13
|
+
'AMap.Geocoder', 'AMap.MarkerClusterer', 'AMap.AutoComplete'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
|
14
|
+
AMapUI: {
|
|
15
|
+
version: '1.1', // AMapUI 缺省 1.1
|
|
16
|
+
plugins: [] // 需要加载的 AMapUI ui插件
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
return Amap
|
|
21
|
+
}
|
|
22
|
+
async function GetLocation (address) {
|
|
23
|
+
return new Promise(async (resolve, reject) => {
|
|
24
|
+
new (await GetGDMap()).Geocoder({
|
|
25
|
+
radius: 500 // 范围,默认:500
|
|
26
|
+
}).getLocation(address, function (status, result) {
|
|
27
|
+
console.log(result)
|
|
28
|
+
if (status === 'complete' && result.geocodes.length) {
|
|
29
|
+
resolve({ lng: result.geocodes[0].location.lng, lat: result.geocodes[0].location.lat })
|
|
30
|
+
} else {
|
|
31
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
32
|
+
reject('根据经纬度查询地址失败')
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
export { GetGDMap, GetLocation }
|
package/src/utils/request.js
CHANGED
|
@@ -161,7 +161,7 @@ function loadInterceptors () {
|
|
|
161
161
|
// 判断是否为V4环境,不为compatible赋初始值
|
|
162
162
|
// 其有可能是undefined未定义,或第一次使用本系统LocalStorage在初始化,获得的值为null
|
|
163
163
|
const compatible = getSystemVersion()
|
|
164
|
-
if (compatible === 'V4' || (res.data.code && res.data.
|
|
164
|
+
if (compatible === 'V4' || (res.data.code && res.data.hasOwnProperty('msg'))) {
|
|
165
165
|
// 请求rul
|
|
166
166
|
const requestUrl = res.config.url
|
|
167
167
|
if (res.data.data) {
|