提交 d531cae8 authored 作者: 正反's avatar 正反

地图修改

上级 4aeecab8
......@@ -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: 25.55329,
latitude: 22.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())
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论