Commit 2646a9de by zhangxw

脏数据拦截优化

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