Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
JT-WXXCX-SF
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
郑帆
JT-WXXCX-SF
Commits
d531cae8
提交
d531cae8
authored
12月 22, 2021
作者:
正反
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
地图修改
上级
4aeecab8
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
112 行增加
和
73 行删除
+112
-73
map.vue
pages/map/map.vue
+112
-73
marks.png
static/images/marks.png
+0
-0
没有找到文件。
pages/map/map.vue
浏览文件 @
d531cae8
...
...
@@ -22,7 +22,7 @@
style=
"display: inline-block;"
></u-switch>
<view
v-if=
"showChoiceTime==false"
>
<u-radio-group
v-model=
"value"
@
change=
"radioGroupChange"
active-color=
"#7D5AFC"
>
<u-radio
@
change=
"radioChange"
v-for=
"(item, index) in list"
:key=
"index"
<u-radio
v-for=
"(item, index) in list"
:key=
"index"
:name=
"item.name"
:disabled=
"item.disabled"
>
{{
item
.
name
}}
</u-radio>
...
...
@@ -55,9 +55,15 @@
onLoad
()
{
this
.
getUserLocation
()
uni
.
$u
.
mpShare
.
title
=
'页面分享'
;
let
day2
=
new
Date
();
day2
.
setTime
(
day2
.
getTime
());
this
.
choicetime
=
day2
.
getFullYear
()
+
"-"
+
(
day2
.
getMonth
()
+
1
)
+
"-"
+
day2
.
getDate
();
},
data
()
{
return
{
typeList
:[
"已超时"
,
"待预约"
,
"待服务"
],
choicetime
:
''
,
buttonDisabled
:
false
,
dispalyText
:
false
,
//经度
...
...
@@ -68,15 +74,17 @@
markers
:
[
{
id
:
1
,
latitude
:
''
,
longitude
:
''
,
zIndex
:
5
latitude
:
23.57
,
longitude
:
116.88308
,
zIndex
:
5
,
iconPath
:
'../../static/images/marks.png'
},
{
id
:
2
,
latitude
:
2
5.55329
,
latitude
:
2
2.56
,
longitude
:
116.88308
,
zIndex
:
5
zIndex
:
5
,
iconPath
:
'../../static/images/marks.png'
}
],
showPopup
:
false
,
...
...
@@ -84,7 +92,7 @@
showTimeList
:
false
,
mode
:
"range"
,
Slist
:
[{
name
:
'超时'
,
name
:
'
已
超时'
,
checked
:
true
,
disabled
:
false
},
...
...
@@ -129,71 +137,71 @@
success
(
res
)
{
console
.
log
(
"用户位置信息:"
,
res
)
that
.
longitude
=
res
.
longitude
that
.
markers
[
0
].
longitude
=
res
.
longitude
//
that.markers[0].longitude = res.longitude
that
.
latitude
=
res
.
latitude
that
.
markers
[
0
].
latitude
=
res
.
latitude
//
that.markers[0].latitude = res.latitude
},
fail
(
res
)
{
console
.
log
(
"出现错误:"
,
res
)
}
})
setInterval
(
wx
.
startLocationUpdateBackground
({
success
:
(
res
)
=>
{
//成功的逻辑
wx
.
onLocationChange
((
res
)
=>
{
//获取实时的定位信息
console
.
log
(
res
)
console
.
log
(
"用户位置信息:"
,
res
)
//
setInterval(wx.startLocationUpdateBackground({
//
success: (res) => {
//
//成功的逻辑
//
wx.onLocationChange((res) => { //获取实时的定位信息
//
console.log(res)
//
console.log("用户位置信息:", res)
that
.
markers
[
0
].
longitude
=
res
.
longitude
//
that.markers[0].longitude = res.longitude
that
.
markers
[
0
].
latitude
=
res
.
latitude
wx
.
stopLocationUpdate
()
})
},
fail
:
(
err
)
=>
{
//失败的逻辑
//1.wx.showModal引导用户授权
//2.通过wx.openSetting让用户开启权限
//
that.markers[0].latitude = res.latitude
//
wx.stopLocationUpdate()
//
})
//
},
//
fail: (err) => {
//
//失败的逻辑
//
//1.wx.showModal引导用户授权
//
//2.通过wx.openSetting让用户开启权限
wx
.
showModal
({
//引导用户授权
content
:
'小程序需要实时获取位置,请设置为后台前台都可运行'
,
confirmText
:
"确认"
,
cancelText
:
"取消"
,
success
:
function
(
res
)
{
//点击“确认”时打开设置页面
if
(
res
.
confirm
)
{
wx
.
openSetting
({
//打开设置页面让用户选择权限
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
"scope.userLocationBackground"
]
==
true
)
{
wx
.
onLocationChange
((
res
)
=>
{
//实时获取用户最新的经纬度信息
console
.
log
(
res
)
console
.
log
(
"用户位置信息:"
,
res
)
that
.
markers
[
0
]
.
longitude
=
res
.
longitude
that
.
markers
[
0
]
.
latitude
=
res
.
latitude
wx
.
stopLocationUpdate
()
})
}
}
})
}
else
{
//取消打开设置授权页面
wx
.
showToast
({
title
:
"取消授权~"
,
icon
:
'none'
,
})
}
}
})
}
}),
1000
)
//
wx.showModal({ //引导用户授权
//
content: '小程序需要实时获取位置,请设置为后台前台都可运行',
//
confirmText: "确认",
//
cancelText: "取消",
//
success: function(res) {
//
//点击“确认”时打开设置页面
//
if (res.confirm) {
//
wx.openSetting({ //打开设置页面让用户选择权限
//
success: (res) => {
//
if (res.authSetting[
//
"scope.userLocationBackground"
//
] == true) {
//
wx.onLocationChange((
//
res
//
) => { //实时获取用户最新的经纬度信息
//
console.log(res)
//
console.log("用户位置信息:",
//
res)
//
that.markers[0]
//
.longitude = res
//
.longitude
//
that.markers[0]
//
.latitude = res
//
.latitude
//
wx.stopLocationUpdate()
//
})
//
}
//
}
//
})
//
} else { //取消打开设置授权页面
//
wx.showToast({
//
title: "取消授权~",
//
icon: 'none',
//
})
//
}
//
}
//
})
//
}
//
}), 1000)
},
show
()
{
this
.
showPopup
=
true
...
...
@@ -209,10 +217,31 @@
}
},
checkboxGroupChange
(
e
)
{
console
.
log
(
e
)
this
.
typeList
=
e
console
.
log
(
this
.
typeList
)
},
radioGroupChange
(
e
)
{
console
.
log
(
e
)
let
time
=
''
if
(
e
==
'今天'
||
'今天之后'
){
let
day2
=
new
Date
();
day2
.
setTime
(
day2
.
getTime
());
time
=
day2
.
getFullYear
()
+
"-"
+
(
day2
.
getMonth
()
+
1
)
+
"-"
+
day2
.
getDate
();
}
if
(
e
===
'明天'
){
let
day2
=
new
Date
();
day2
.
setTime
(
day2
.
getTime
()
+
24
*
60
*
60
*
1000
);
time
=
day2
.
getFullYear
()
+
"-"
+
(
day2
.
getMonth
()
+
1
)
+
"-"
+
day2
.
getDate
();
}
if
(
e
===
'后天'
){
let
day2
=
new
Date
();
day2
.
setTime
(
day2
.
getTime
()
+
48
*
60
*
60
*
1000
);
time
=
day2
.
getFullYear
()
+
"-"
+
(
day2
.
getMonth
()
+
1
)
+
"-"
+
day2
.
getDate
();
}
this
.
choicetime
=
time
console
.
log
(
this
.
choicetime
)
},
timeChange
(
e
)
{
console
.
log
(
e
)
...
...
@@ -229,14 +258,24 @@
},
confirm
()
{
this
.
showPopup
=
false
// GetSFOrderTypeQty().then((res) => {
// if (res.data.code == 0) {
// console.log(res)
// }
// })
let
date1
=
new
Date
(
2021
/
12
/
18
)
let
date2
=
new
Date
(
2021
-
12
-
22
)
console
.
log
(
date1
<
date2
)
GetSFOrderTypeQty
().
then
((
res
)
=>
{
if
(
res
.
data
.
code
==
0
)
{
console
.
log
(
res
)
}
})
let
mark
=
{
id
:
0
,
latitude
:
0
,
longitude
:
0
,
zIndex
:
5
}
mark
.
id
=
this
.
markers
.
length
+
1
mark
.
latitude
=
this
.
markers
[
mark
.
id
-
2
].
latitude
-
1
mark
.
longitude
=
this
.
markers
[
mark
.
id
-
2
].
longitude
-
1
this
.
markers
.
push
(
mark
)
let
date1
=
new
Date
(
'2021-12-22'
.
replace
(
/-/g
,
"/"
))
let
date2
=
new
Date
(
'2021/12/22'
)
console
.
log
(
date1
.
getTime
()
===
date2
.
getTime
())
}
}
}
...
...
static/images/marks.png
0 → 100644
浏览文件 @
d531cae8
6.2 KB
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论