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 74ebcf2a
authored
Apr 09, 2025
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'map_1.1' into 'master'
上线合并 See merge request
!6
2 parents
8e3b484c
8b2a91c9
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
113 additions
and
88 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 @
74ebcf2
...
...
@@ -75,9 +75,11 @@ Component({
},
getLocationByIp
()
{
mapApi
.
getLocationByIp
().
then
(({
city
content
:
{
address_detail
}
})
=>
{
let
defaultCity
=
city
.
replace
(
'市'
,
''
)
let
defaultCity
=
address_detail
.
city
.
replace
(
'市'
,
''
)
this
.
setData
({
defaultCity
,
cityCode
:
defaultCity
...
...
@@ -169,7 +171,7 @@ Component({
})
=>
{
let
distanceList
=
[]
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
)
})
indexGroup
[
index
].
map
((
s
,
ind
)
=>
{
...
...
@@ -212,25 +214,20 @@ Component({
},
openLocation
(
e
)
{
let
{
item
}
=
e
.
currentTarget
.
dataset
if
(
!
item
.
distance
)
{
mapApi
.
geocoder
(
item
.
address
).
then
(({
geocodes
})
=>
{
let
location
=
geocodes
[
0
].
location
.
split
(
','
)
wx
.
openLocation
({
longitude
:
Number
(
location
[
0
]),
latitude
:
Number
(
location
[
1
]),
name
:
item
.
storeName
,
address
:
item
.
address
})
location
,
storeName
,
address
}
=
e
.
currentTarget
.
dataset
.
item
mapApi
.
translate
([
[
location
.
latitude
,
location
.
longitude
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
latitude
:
y
,
longitude
:
x
,
name
:
storeName
,
address
})
return
}
wx
.
openLocation
({
latitude
:
Number
(
item
.
location
.
latitude
),
longitude
:
Number
(
item
.
location
.
longitude
),
name
:
item
.
storeName
,
address
:
item
.
address
})
},
// 下拉触底
...
...
components/MerchantList/MerchantList.js
View file @
74ebcf2
...
...
@@ -53,10 +53,12 @@ Component({
defaultBrand
}
=
this
.
data
mapApi
.
getLocationByIp
().
then
(({
city
content
:
{
address_detail
}
})
=>
{
if
(
defaultBrand
)
return
let
defaultCity
=
city
.
replace
(
'市'
,
''
)
let
defaultCity
=
address_detail
.
city
.
replace
(
'市'
,
''
)
this
.
setData
({
defaultCity
,
cityCode
:
defaultCity
...
...
@@ -169,10 +171,11 @@ Component({
let
{
location
}
=
defaultStore
if
(
location
.
latitude
==
'0.0'
)
return
mapApi
.
calculateDistance
(
fromPosition
,
[
location
.
latitude
,
location
.
longitude
]).
then
(
data
=>
{
let
{
distance
}
=
data
.
elements
[
0
]
}
=
data
.
elements
this
.
setData
({
'defaultStore.distance'
:
Number
((
distance
/
1000
)).
toFixed
(
2
)
})
...
...
@@ -223,7 +226,7 @@ Component({
})
=>
{
let
distanceList
=
[]
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
)
})
indexGroup
[
index
].
map
((
s
,
ind
)
=>
{
...
...
@@ -242,25 +245,39 @@ Component({
openLocation
(
e
)
{
let
{
item
}
=
e
.
currentTarget
.
dataset
if
(
!
item
.
distance
)
{
mapApi
.
geocoder
(
item
.
address
).
then
(({
geocodes
})
=>
{
let
location
=
geocodes
[
0
].
location
.
split
(
','
)
wx
.
openLocation
({
longitude
:
Number
(
location
[
0
]),
latitude
:
Number
(
location
[
1
]),
name
:
item
.
storeName
,
address
:
item
.
address
location
,
storeName
,
address
,
distance
}
=
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
({
latitude
:
y
,
longitude
:
x
,
name
:
storeName
,
address
})
})
})
return
}
wx
.
openLocation
({
latitude
:
Number
(
item
.
location
.
latitude
),
longitude
:
Number
(
item
.
location
.
longitude
),
name
:
item
.
storeName
,
address
:
item
.
address
mapApi
.
translate
([
[
location
.
latitude
,
location
.
longitude
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
latitude
:
y
,
longitude
:
x
,
name
:
storeName
,
address
})
})
},
clearData
()
{
...
...
package-lock.json
View file @
74ebcf2
...
...
@@ -4,16 +4,16 @@
"lockfileVersion"
:
1
,
"requires"
:
true
,
"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"
:
{
"version"
:
"1.1.24"
,
"resolved"
:
"https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz"
,
"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"
:
{
"version"
:
"1.6.0"
,
"resolved"
:
"https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz"
,
...
...
package.json
View file @
74ebcf2
...
...
@@ -4,8 +4,8 @@
"description"
:
""
,
"main"
:
"app.js"
,
"dependencies"
:
{
"glsk-map-jssdk"
:
"^0.1.1"
,
"glsx-applet-component"
:
"^1.1.24"
,
"glsx-map-sdk"
:
"^0.2.0"
,
"number-precision"
:
"^1.6.0"
},
"devDependencies"
:
{},
...
...
packageEquity/pages/commodity/detail/detail.js
View file @
74ebcf2
import
{
equityApi
}
from
"../../../../api/api"
import
mapApi
from
'../../../../utils/mapapi'
const
baseUrl
=
'https://img02.glsx.com.cn/weapp/resource/equity-h5-new/mini/'
Page
({
...
...
packageIndex/pages/gps/pathDetail/pathDetail.js
View file @
74ebcf2
...
...
@@ -93,14 +93,17 @@ Page({
img_version
}
=
this
.
data
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
})
=>
{
let
markers
=
[]
let
points
=
[]
locations
.
map
((
e
,
index
)
=>
{
let
latitude
=
e
.
lat
let
longitude
=
e
.
lng
let
latitude
=
e
.
y
let
longitude
=
e
.
x
markers
.
push
({
iconPath
:
`
${
IMGURL
}
packageIndex/gps/
${
index
==
0
?
'begin'
:
'end'
}
.png?v=
${
img_version
}
`
,
latitude
,
...
...
packageIndex/pages/navigation/navigation.js
View file @
74ebcf2
...
...
@@ -41,7 +41,7 @@ Page({
rows
:
[
data
]
})
=>
{
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
({
[
`merchantList[
${
index
}
].Distance`
]:
distance
})
...
...
packageIndex/pages/newCars/appointment/appointment.js
View file @
74ebcf2
import
{
indexApi
,
mineApi
}
from
"../../../../api/api"
;
import
mapApi
from
"../../../../utils/mapapi"
;
Page
({
data
:
{
obj
:
{
...
...
packageIndex/pages/newCars/enquiry/enquiry.js
View file @
74ebcf2
import
{
indexApi
,
mineApi
}
from
"../../../../api/api"
;
import
mapApi
from
"../../../../utils/mapapi"
;
Page
({
data
:
{
desc
:
""
,
...
...
@@ -105,7 +104,6 @@ Page({
store
});
}
// this.getLocationByIp();
this
.
getGHUserInfo
();
},
getGHUserInfo
()
{
...
...
@@ -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
=
{})
{
indexApi
.
getGHStoreList
({
pageNum
:
1
,
...
obj
}).
then
((
data
)
=>
{
if
(
data
.
length
)
{
...
...
packageIndex/pages/reservation/index/index.js
View file @
74ebcf2
...
...
@@ -76,10 +76,12 @@ Page({
})
}
else
{
mapApi
.
getLocationByIp
().
then
(({
city
content
:
{
address_detail
}
})
=>
{
this
.
getStore
({
storeName
:
city
storeName
:
address_detail
.
city
})
}).
catch
(()
=>
{
this
.
getStore
()
...
...
pages/tab/mine/mine.js
View file @
74ebcf2
...
...
@@ -335,26 +335,44 @@ Page({
},
openLocation
(
e
)
{
let
{
item
}
=
e
.
currentTarget
.
dataset
if
(
item
.
location
.
latitude
==
'0.0'
)
{
mapApi
.
geocoder
(
item
.
address
).
then
(({
location
location
,
storeName
,
address
,
}
=
e
.
currentTarget
.
dataset
.
item
if
(
location
.
latitude
==
'0.0'
)
{
mapApi
.
geocoder
(
address
).
then
(({
location
:
locat
})
=>
{
wx
.
openLocation
({
latitude
:
Number
(
location
.
lat
),
longitude
:
Number
(
location
.
lng
),
name
:
item
.
storeName
,
address
:
item
.
address
mapApi
.
translate
([
[
locat
.
lat
,
locat
.
lng
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
latitude
:
y
,
longitude
:
x
,
name
:
storeName
,
address
})
})
})
return
}
wx
.
openLocation
({
latitude
:
Number
(
item
.
location
.
latitude
),
longitude
:
Number
(
item
.
location
.
longitude
),
name
:
item
.
storeName
,
address
:
item
.
address
mapApi
.
translate
([
[
location
.
latitude
,
location
.
longitude
]
],
5
).
then
(
res
=>
{
let
{
x
,
y
}
=
res
[
0
]
wx
.
openLocation
({
latitude
:
y
,
longitude
:
x
,
name
:
storeName
,
address
})
})
},
...
...
pages/tab/mine/mine.wxml
View file @
74ebcf2
...
...
@@ -82,7 +82,7 @@
通话
</view>
</block>
<block wx:if="{{merchantDetail.
merchantA
ddress}}">
<block wx:if="{{merchantDetail.
a
ddress}}">
<view class="item flex" bindtap="openLocation" data-item="{{merchantDetail}}">
<view class="sprite-icon icon-mine-gh-gps"></view>
导航
...
...
project.private.config.json
View file @
74ebcf2
...
...
@@ -9,6 +9,13 @@
"miniprogram"
:
{
"list"
:
[
{
"name"
:
"packageEquity/pages/commodity/list/list"
,
"pathName"
:
"packageMine/pages/address/detail/detail"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"pages/tab/index/index"
,
"pathName"
:
"pages/tab/index/index"
,
"query"
:
"merchantId=44210895"
,
...
...
utils/mapapi.js
View file @
74ebcf2
import
GlMap
from
'gls
x-map-
sdk'
import
GlMap
from
'gls
k-map-js
sdk'
export
default
new
GlMap
()
\ 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