Commit 2646a9de by zhangxw

脏数据拦截优化

1 parent 48fc6a15
......@@ -85,6 +85,7 @@ Page({
let [markers, includePoints] = [[], []]
if (res.data.length > 0 ) {
for (var i = 0; i < res.data.length; i++) {
if (res.data[i]['gpsLocation'] && res.data[i]['gpsLocation'].elat && res.data[i]['gpsLocation'].elng) {
markers.push({
id: Number(res.data[i].sn), // 设备号唯一 可作为markerid
width: 28,
......@@ -93,15 +94,31 @@ Page({
longitude: Number(res.data[i]['gpsLocation'].elng),
iconPath: res.data[i].source === 1 ? '../../images/oncar.png' : '../../images/offcar.png'
})
res.data[i].type = 'gpsLocation'
includePoints.push({
latitude: res.data[i]['gpsLocation'].elat,
longitude: res.data[i]['gpsLocation'].elng,
padding: [80, 80, 80, 80]
})
res.data[i].type = 'gpsLocation' // 默认显示GPS的定位类型
} else if (res.data[i]['bsLocation'] && res.data[i]['bsLocation'].elat && res.data[i]['bsLocation'].elng) {
markers.push({
id: Number(res.data[i].sn), // 设备号唯一 可作为markerid
width: 28,
height: 36,
latitude: Number(res.data[i]['bsLocation'].elat), // 无gps定位数据
longitude: Number(res.data[i]['bsLocation'].elng),
iconPath: res.data[i].source === 1 ? '../../images/oncar.png' : '../../images/offcar.png'
})
includePoints.push({
latitude: res.data[i]['bsLocation'].elat,
longitude: res.data[i]['bsLocation'].elng,
padding: [80, 80, 80, 80]
})
res.data[i].type = 'bsLocation'
}
let typeArr = ['gpsLocation', 'bsLocation']
for (var j = 0; j < typeArr.length; j++) {
await this.getTransferAddress(res.data[i], typeArr[j])
if (res.data[i][typeArr[j]] && res.data[i][typeArr[j]].elat && res.data[i][typeArr[j]].elng) await this.getTransferAddress(res.data[i], typeArr[j])
}
}
this.setData({
......@@ -111,9 +128,7 @@ Page({
})
wx.getSystemInfo({
success: (res) => {
console.log(res)
if (res.platform == 'devtools') { // 开发工具上include-points 失效
console.log('123')
this.myMap.getMapCtx().includePoints({
points: includePoints,
padding: [80, 80, 80, 80]
......@@ -163,6 +178,12 @@ Page({
let markers = this.data.markers
switch(Number(e.currentTarget.dataset.num)) {
case 1: // GPS
if (!this.data.carInfoWindowObj['gpsLocation'] || !this.data.carInfoWindowObj['gpsLocation'].elat || !this.data.carInfoWindowObj['gpsLocation'].elng) {
return wx.showToast({
title: '暂无GPS定位数据',
icon: 'none'
})
}
if (data['type'] === 'gpsLocation') return
data['type'] = "gpsLocation"
includePoints.push({
......@@ -191,7 +212,7 @@ Page({
})
break
case 2: // bsLocation
if (!this.data.carInfoWindowObj['bsLocation']) {
if (!this.data.carInfoWindowObj['bsLocation'] || !this.data.carInfoWindowObj['bsLocation'].elat || !this.data.carInfoWindowObj['bsLocation'].elng) {
return wx.showToast({
title: '暂无基站定位数据',
icon: 'none'
......
......@@ -3,37 +3,35 @@
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"useMultiFrameRuntime": true,
"useApiHook": true,
"useApiHostProcess": true,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": false,
"userConfirmedBundleSwitch": false,
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"minifyWXSS": true,
"enhance": true,
"preloadBackgroundData": false,
"uglifyFileName": false,
"compileHotReLoad": false,
"lazyloadPlaceholderEnable": false,
"disableUseStrict": false,
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"ignoreUploadUnusedFiles": true,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!