Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
miniprogram-gh-carlife
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8b2a91c9
authored
Apr 09, 2025
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
替换地图SDK
1 parent
8e3b484c
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
108 additions
and
83 deletions
components/IndexMerchant/IndexMerchant.js
components/MerchantList/MerchantList.js
package-lock.json
package.json
packageEquity/pages/commodity/detail/detail.js
packageIndex/pages/gps/pathDetail/pathDetail.js
packageIndex/pages/navigation/navigation.js
packageIndex/pages/newCars/appointment/appointment.js
packageIndex/pages/newCars/enquiry/enquiry.js
packageIndex/pages/reservation/index/index.js
pages/tab/mine/mine.js
pages/tab/mine/mine.wxml
project.private.config.json
utils/mapapi.js
components/IndexMerchant/IndexMerchant.js
View file @
8b2a91c
...
@@ -75,9 +75,11 @@ Component({
...
@@ -75,9 +75,11 @@ Component({
},
},
getLocationByIp
()
{
getLocationByIp
()
{
mapApi
.
getLocationByIp
().
then
(({
mapApi
.
getLocationByIp
().
then
(({
city
content
:
{
address_detail
}
})
=>
{
})
=>
{
let
defaultCity
=
city
.
replace
(
'市'
,
''
)
let
defaultCity
=
address_detail
.
city
.
replace
(
'市'
,
''
)
this
.
setData
({
this
.
setData
({
defaultCity
,
defaultCity
,
cityCode
:
defaultCity
cityCode
:
defaultCity
...
@@ -169,7 +171,7 @@ Component({
...
@@ -169,7 +171,7 @@ Component({
})
=>
{
})
=>
{
let
distanceList
=
[]
let
distanceList
=
[]
data
.
elements
.
map
(
e
=>
{
data
.
elements
.
map
(
e
=>
{
let
distance
=
Number
((
e
.
distance
/
1000
)).
toFixed
(
2
)
let
distance
=
e
.
distance
.
value
?
Number
((
e
.
distance
.
value
/
1000
)).
toFixed
(
2
)
:
0
distanceList
.
push
(
distance
)
distanceList
.
push
(
distance
)
})
})
indexGroup
[
index
].
map
((
s
,
ind
)
=>
{
indexGroup
[
index
].
map
((
s
,
ind
)
=>
{
...
@@ -212,26 +214,21 @@ Component({
...
@@ -212,26 +214,21 @@ Component({
},
},
openLocation
(
e
)
{
openLocation
(
e
)
{
let
{
let
{
item
location
,
}
=
e
.
currentTarget
.
dataset
storeName
,
if
(
!
item
.
distance
)
{
address
mapApi
.
geocoder
(
item
.
address
).
then
(({
geocodes
})
=>
{
}
=
e
.
currentTarget
.
dataset
.
item
let
location
=
geocodes
[
0
].
location
.
split
(
','
)
mapApi
.
translate
([
[
location
.
latitude
,
location
.
longitude
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
wx
.
openLocation
({
longitude
:
Number
(
location
[
0
])
,
latitude
:
y
,
latitude
:
Number
(
location
[
1
])
,
longitude
:
x
,
name
:
item
.
storeName
,
name
:
storeName
,
address
:
item
.
address
address
})
})
})
})
return
}
wx
.
openLocation
({
latitude
:
Number
(
item
.
location
.
latitude
),
longitude
:
Number
(
item
.
location
.
longitude
),
name
:
item
.
storeName
,
address
:
item
.
address
})
},
},
// 下拉触底
// 下拉触底
scrollTolower
(
e
)
{
scrollTolower
(
e
)
{
...
...
components/MerchantList/MerchantList.js
View file @
8b2a91c
...
@@ -53,10 +53,12 @@ Component({
...
@@ -53,10 +53,12 @@ Component({
defaultBrand
defaultBrand
}
=
this
.
data
}
=
this
.
data
mapApi
.
getLocationByIp
().
then
(({
mapApi
.
getLocationByIp
().
then
(({
city
content
:
{
address_detail
}
})
=>
{
})
=>
{
if
(
defaultBrand
)
return
if
(
defaultBrand
)
return
let
defaultCity
=
city
.
replace
(
'市'
,
''
)
let
defaultCity
=
address_detail
.
city
.
replace
(
'市'
,
''
)
this
.
setData
({
this
.
setData
({
defaultCity
,
defaultCity
,
cityCode
:
defaultCity
cityCode
:
defaultCity
...
@@ -169,10 +171,11 @@ Component({
...
@@ -169,10 +171,11 @@ Component({
let
{
let
{
location
location
}
=
defaultStore
}
=
defaultStore
if
(
location
.
latitude
==
'0.0'
)
return
mapApi
.
calculateDistance
(
fromPosition
,
[
location
.
latitude
,
location
.
longitude
]).
then
(
data
=>
{
mapApi
.
calculateDistance
(
fromPosition
,
[
location
.
latitude
,
location
.
longitude
]).
then
(
data
=>
{
let
{
let
{
distance
distance
}
=
data
.
elements
[
0
]
}
=
data
.
elements
this
.
setData
({
this
.
setData
({
'defaultStore.distance'
:
Number
((
distance
/
1000
)).
toFixed
(
2
)
'defaultStore.distance'
:
Number
((
distance
/
1000
)).
toFixed
(
2
)
})
})
...
@@ -223,7 +226,7 @@ Component({
...
@@ -223,7 +226,7 @@ Component({
})
=>
{
})
=>
{
let
distanceList
=
[]
let
distanceList
=
[]
data
.
elements
.
map
(
e
=>
{
data
.
elements
.
map
(
e
=>
{
let
distance
=
Number
((
e
.
distance
/
1000
)).
toFixed
(
2
)
let
distance
=
e
.
distance
.
value
?
Number
((
e
.
distance
.
value
/
1000
)).
toFixed
(
2
)
:
0
distanceList
.
push
(
distance
)
distanceList
.
push
(
distance
)
})
})
indexGroup
[
index
].
map
((
s
,
ind
)
=>
{
indexGroup
[
index
].
map
((
s
,
ind
)
=>
{
...
@@ -242,25 +245,39 @@ Component({
...
@@ -242,25 +245,39 @@ Component({
openLocation
(
e
)
{
openLocation
(
e
)
{
let
{
let
{
item
location
,
}
=
e
.
currentTarget
.
dataset
storeName
,
if
(
!
item
.
distance
)
{
address
,
mapApi
.
geocoder
(
item
.
address
).
then
(({
geocodes
})
=>
{
distance
let
location
=
geocodes
[
0
].
location
.
split
(
','
)
}
=
e
.
currentTarget
.
dataset
.
item
if
(
!
distance
)
{
mapApi
.
geocoder
(
address
).
then
(({
location
:
locat
})
=>
{
mapApi
.
translate
([
[
locat
.
lat
,
locat
.
lng
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
wx
.
openLocation
({
longitude
:
Number
(
location
[
0
]),
latitude
:
y
,
latitude
:
Number
(
location
[
1
]),
longitude
:
x
,
name
:
item
.
storeName
,
name
:
storeName
,
address
:
item
.
address
address
})
})
})
})
})
return
return
}
}
mapApi
.
translate
([
[
location
.
latitude
,
location
.
longitude
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
wx
.
openLocation
({
latitude
:
Number
(
item
.
location
.
latitude
),
latitude
:
y
,
longitude
:
Number
(
item
.
location
.
longitude
),
longitude
:
x
,
name
:
item
.
storeName
,
name
:
storeName
,
address
:
item
.
address
address
})
})
})
},
},
clearData
()
{
clearData
()
{
...
...
package-lock.json
View file @
8b2a91c
...
@@ -4,16 +4,16 @@
...
@@ -4,16 +4,16 @@
"lockfileVersion"
:
1
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"requires"
:
true
,
"dependencies"
:
{
"dependencies"
:
{
"glsk-map-jssdk"
:
{
"version"
:
"0.1.1"
,
"resolved"
:
"https://registry.npmjs.org/glsk-map-jssdk/-/glsk-map-jssdk-0.1.1.tgz"
,
"integrity"
:
"sha512-kwCyU8A1t7Q7V2hlzC03nc9VNNW9HPXQ5YhHsGGnrEtPxykGDG7AEyT5O7LY1zZk/8adkkk6FHgCM53r6p/4yw=="
},
"glsx-applet-component"
:
{
"glsx-applet-component"
:
{
"version"
:
"1.1.24"
,
"version"
:
"1.1.24"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz"
,
"integrity"
:
"sha512-3XTG9J99rgKVJpcC7aKS/+N7CaS+MNYdy5qmWH8siFaRFiSo1PeBRDaprfjCazaud/c31RvpoDFUof/fxNkxjw=="
"integrity"
:
"sha512-3XTG9J99rgKVJpcC7aKS/+N7CaS+MNYdy5qmWH8siFaRFiSo1PeBRDaprfjCazaud/c31RvpoDFUof/fxNkxjw=="
},
},
"glsx-map-sdk"
:
{
"version"
:
"0.2.0"
,
"resolved"
:
"https://registry.npmjs.org/glsx-map-sdk/-/glsx-map-sdk-0.2.0.tgz"
,
"integrity"
:
"sha512-uEFlXvJEDofYjasR4mwkmF5yNTRs5QA2ZAynGPHiKpKdpjQkVFPJH0zGupmQEkxmh4f5B0wPbDobHvLgld7mVw=="
},
"number-precision"
:
{
"number-precision"
:
{
"version"
:
"1.6.0"
,
"version"
:
"1.6.0"
,
"resolved"
:
"https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz"
,
"resolved"
:
"https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz"
,
...
...
package.json
View file @
8b2a91c
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
"description"
:
""
,
"description"
:
""
,
"main"
:
"app.js"
,
"main"
:
"app.js"
,
"dependencies"
:
{
"dependencies"
:
{
"glsk-map-jssdk"
:
"^0.1.1"
,
"glsx-applet-component"
:
"^1.1.24"
,
"glsx-applet-component"
:
"^1.1.24"
,
"glsx-map-sdk"
:
"^0.2.0"
,
"number-precision"
:
"^1.6.0"
"number-precision"
:
"^1.6.0"
},
},
"devDependencies"
:
{},
"devDependencies"
:
{},
...
...
packageEquity/pages/commodity/detail/detail.js
View file @
8b2a91c
import
{
import
{
equityApi
equityApi
}
from
"../../../../api/api"
}
from
"../../../../api/api"
import
mapApi
from
'../../../../utils/mapapi'
const
baseUrl
=
'https://img02.glsx.com.cn/weapp/resource/equity-h5-new/mini/'
const
baseUrl
=
'https://img02.glsx.com.cn/weapp/resource/equity-h5-new/mini/'
Page
({
Page
({
...
...
packageIndex/pages/gps/pathDetail/pathDetail.js
View file @
8b2a91c
...
@@ -93,14 +93,17 @@ Page({
...
@@ -93,14 +93,17 @@ Page({
img_version
img_version
}
=
this
.
data
}
=
this
.
data
const
map
=
wx
.
createMapContext
(
'map'
)
const
map
=
wx
.
createMapContext
(
'map'
)
mapApi
.
translate
([
`
${
detail
.
beginGpsLat
}
,
${
detail
.
beginGpsLon
}
`
,
`
${
detail
.
endGpsLat
}
,
${
detail
.
endGpsLon
}
`
],
1
).
then
(({
mapApi
.
translate
([
[
detail
.
beginGpsLat
,
detail
.
beginGpsLon
],
[
detail
.
endGpsLat
,
detail
.
endGpsLon
]
],
1
).
then
(({
locations
locations
})
=>
{
})
=>
{
let
markers
=
[]
let
markers
=
[]
let
points
=
[]
let
points
=
[]
locations
.
map
((
e
,
index
)
=>
{
locations
.
map
((
e
,
index
)
=>
{
let
latitude
=
e
.
lat
let
latitude
=
e
.
y
let
longitude
=
e
.
lng
let
longitude
=
e
.
x
markers
.
push
({
markers
.
push
({
iconPath
:
`
${
IMGURL
}
packageIndex/gps/
${
index
==
0
?
'begin'
:
'end'
}
.png?v=
${
img_version
}
`
,
iconPath
:
`
${
IMGURL
}
packageIndex/gps/
${
index
==
0
?
'begin'
:
'end'
}
.png?v=
${
img_version
}
`
,
latitude
,
latitude
,
...
...
packageIndex/pages/navigation/navigation.js
View file @
8b2a91c
...
@@ -41,7 +41,7 @@ Page({
...
@@ -41,7 +41,7 @@ Page({
rows
:
[
data
]
rows
:
[
data
]
})
=>
{
})
=>
{
data
.
elements
.
map
((
e
,
index
)
=>
{
data
.
elements
.
map
((
e
,
index
)
=>
{
let
distance
=
Number
((
e
.
distance
/
1000
)).
toFixed
(
2
)
let
distance
=
e
.
distance
.
value
?
Number
((
e
.
distance
.
value
/
1000
)).
toFixed
(
2
)
:
0
this
.
setData
({
this
.
setData
({
[
`merchantList[
${
index
}
].Distance`
]:
distance
[
`merchantList[
${
index
}
].Distance`
]:
distance
})
})
...
...
packageIndex/pages/newCars/appointment/appointment.js
View file @
8b2a91c
import
{
indexApi
,
mineApi
}
from
"../../../../api/api"
;
import
{
indexApi
,
mineApi
}
from
"../../../../api/api"
;
import
mapApi
from
"../../../../utils/mapapi"
;
Page
({
Page
({
data
:
{
data
:
{
obj
:
{
obj
:
{
...
...
packageIndex/pages/newCars/enquiry/enquiry.js
View file @
8b2a91c
import
{
indexApi
,
mineApi
}
from
"../../../../api/api"
;
import
{
indexApi
,
mineApi
}
from
"../../../../api/api"
;
import
mapApi
from
"../../../../utils/mapapi"
;
Page
({
Page
({
data
:
{
data
:
{
desc
:
""
,
desc
:
""
,
...
@@ -105,7 +104,6 @@ Page({
...
@@ -105,7 +104,6 @@ Page({
store
store
});
});
}
}
// this.getLocationByIp();
this
.
getGHUserInfo
();
this
.
getGHUserInfo
();
},
},
getGHUserInfo
()
{
getGHUserInfo
()
{
...
@@ -118,21 +116,6 @@ Page({
...
@@ -118,21 +116,6 @@ Page({
}
}
});
});
},
},
getLocationByIp
()
{
let
storeCode
=
wx
.
$util
.
getStorageSync
(
"srcm_shopmall_store_code"
);
if
(
storeCode
)
{
this
.
getStore
({
storeCode
});
}
else
{
mapApi
.
getLocationByIp
()
.
then
(({
city
})
=>
{
this
.
getStore
({
storeName
:
city
});
})
.
catch
(()
=>
{
this
.
getStore
();
});
}
},
getStore
(
obj
=
{})
{
getStore
(
obj
=
{})
{
indexApi
.
getGHStoreList
({
pageNum
:
1
,
...
obj
}).
then
((
data
)
=>
{
indexApi
.
getGHStoreList
({
pageNum
:
1
,
...
obj
}).
then
((
data
)
=>
{
if
(
data
.
length
)
{
if
(
data
.
length
)
{
...
...
packageIndex/pages/reservation/index/index.js
View file @
8b2a91c
...
@@ -76,10 +76,12 @@ Page({
...
@@ -76,10 +76,12 @@ Page({
})
})
}
else
{
}
else
{
mapApi
.
getLocationByIp
().
then
(({
mapApi
.
getLocationByIp
().
then
(({
city
content
:
{
address_detail
}
})
=>
{
})
=>
{
this
.
getStore
({
this
.
getStore
({
storeName
:
city
storeName
:
address_detail
.
city
})
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
getStore
()
this
.
getStore
()
...
...
pages/tab/mine/mine.js
View file @
8b2a91c
...
@@ -335,26 +335,44 @@ Page({
...
@@ -335,26 +335,44 @@ Page({
},
},
openLocation
(
e
)
{
openLocation
(
e
)
{
let
{
let
{
item
location
,
}
=
e
.
currentTarget
.
dataset
storeName
,
if
(
item
.
location
.
latitude
==
'0.0'
)
{
address
,
mapApi
.
geocoder
(
item
.
address
).
then
(({
}
=
e
.
currentTarget
.
dataset
.
item
location
if
(
location
.
latitude
==
'0.0'
)
{
mapApi
.
geocoder
(
address
).
then
(({
location
:
locat
})
=>
{
})
=>
{
mapApi
.
translate
([
[
locat
.
lat
,
locat
.
lng
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
wx
.
openLocation
({
latitude
:
Number
(
location
.
lat
),
latitude
:
y
,
longitude
:
Number
(
location
.
lng
),
longitude
:
x
,
name
:
item
.
storeName
,
name
:
storeName
,
address
:
item
.
address
address
})
})
})
})
})
return
return
}
}
mapApi
.
translate
([
[
location
.
latitude
,
location
.
longitude
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
wx
.
openLocation
({
latitude
:
Number
(
item
.
location
.
latitude
),
latitude
:
y
,
longitude
:
Number
(
item
.
location
.
longitude
),
longitude
:
x
,
name
:
item
.
storeName
,
name
:
storeName
,
address
:
item
.
address
address
})
})
})
},
},
...
...
pages/tab/mine/mine.wxml
View file @
8b2a91c
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
通话
通话
</view>
</view>
</block>
</block>
<block wx:if="{{merchantDetail.
merchantA
ddress}}">
<block wx:if="{{merchantDetail.
a
ddress}}">
<view class="item flex" bindtap="openLocation" data-item="{{merchantDetail}}">
<view class="item flex" bindtap="openLocation" data-item="{{merchantDetail}}">
<view class="sprite-icon icon-mine-gh-gps"></view>
<view class="sprite-icon icon-mine-gh-gps"></view>
导航
导航
...
...
project.private.config.json
View file @
8b2a91c
...
@@ -9,6 +9,13 @@
...
@@ -9,6 +9,13 @@
"miniprogram"
:
{
"miniprogram"
:
{
"list"
:
[
"list"
:
[
{
{
"name"
:
"packageEquity/pages/commodity/list/list"
,
"pathName"
:
"packageMine/pages/address/detail/detail"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"pages/tab/index/index"
,
"name"
:
"pages/tab/index/index"
,
"pathName"
:
"pages/tab/index/index"
,
"pathName"
:
"pages/tab/index/index"
,
"query"
:
"merchantId=44210895"
,
"query"
:
"merchantId=44210895"
,
...
...
utils/mapapi.js
View file @
8b2a91c
import
GlMap
from
'gls
x-map-
sdk'
import
GlMap
from
'gls
k-map-js
sdk'
export
default
new
GlMap
()
export
default
new
GlMap
()
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment