From 24d2724aaf2f8331fc179c87595eb9a4720cf8a9 Mon Sep 17 00:00:00 2001
From: wangqi <magical1908@outlook.com>
Date: 星期三, 31 三月 2021 14:32:40 +0800
Subject: [PATCH] 修改文件接口路徑
---
src/components/LayerController/logic/SolidWaste.js | 63 ++++++++++++++++++++-----------
1 files changed, 40 insertions(+), 23 deletions(-)
diff --git a/src/components/LayerController/logic/SolidWaste.js b/src/components/LayerController/logic/SolidWaste.js
index c92dca2..b883a04 100644
--- a/src/components/LayerController/logic/SolidWaste.js
+++ b/src/components/LayerController/logic/SolidWaste.js
@@ -1,37 +1,44 @@
/**
* 鍥哄簾
*/
+// 鍖哄垎涓嶅悓绫诲瀷 浣跨敤涓嶅悓img
+const defaultImg = '/assets/images/map/solidwaste/voc.png'
+const setting = '/assets/images/map/solidwaste/gf_green.png'
+
+const mapApi = require('../../../api/mapApi').default
const AnimalService = require('../service/AnimalService').default
-const AjaxUtils = require('../../../utils/AjaxUtils').default
module.exports = function () {
/**
* 杩斿洖marker瀵硅薄鏁扮粍
* @param L leaflet瀵硅薄
*/
- this.init = (layer, L) => {
+ this.init = async (layer, L) => {
this.animalService = new AnimalService({
L: L,
- layer: layer,
- LayerPopup: null
+ layer: layer
})
- // AjaxUtils.get4JsonDataByUrl('http://10.246.162.140:8080/EPInterface/DataService/EPMapService.asmx/QueryStoragePlaceListByCompanyAndName', {
- // AjaxUtils.get4JsonDataByUrl('http://xearth.cn:3000/wasteSolid/getSolidWaste', {
- AjaxUtils.get4JsonDataByUrl('http://localhost:8888/static/SolidWaste.json', {
- companyId: 3900100145,
- userCode: 'wenchun.deng',
- name: '',
- marginWarr: '',
- longDayWarr: ''
- }, function (res) {
- const data = res.data.Result.DataInfo
- for (let i = 0; i < data.length; i++) {
- // 缁忕含搴� 浣嶇疆
- const positionX = data[i].Latitude
- const positionY = data[i].Longitude
- layer.addLayer(L.marker([positionX, positionY], {}))
- }
- })
+ const res = await mapApi.getSolidWaste()
+ // console.log(res)
+ const data = res.Result.DataInfo || {}
+ for (let i = 0; i < data.length; i++) {
+ // 缁忕含搴� 浣嶇疆
+ const positionX = data[i].Latitude
+ const positionY = data[i].Longitude
+
+ // 瀹氫箟绫诲瀷 鐢ㄦ潵鍖哄垎鏁版嵁鐨勪笉鍚�
+ const judgeValue = data[i].StorageQty
+ var iconUrl = this.differentTypes(judgeValue)
+
+ const marker = L.marker.magic([positionX, positionY], {
+ icon: L.icon({
+ iconUrl: iconUrl,
+ iconSize: [50, 50],
+ iconAnchor: [25, 25]
+ })
+ })
+ layer.addLayer(marker)
+ }
}
this.bindTooltip = (layer) => {
@@ -41,8 +48,18 @@
this.clickListener = (e) => {
this.animalService.pulseEffect(e.latlng)
console.log(e)
- console.log(this.PublicBounced)
- // return this.PublicBounced.$el
+ return this.PublicBounced.$el
+ }
+
+ // 涓嶅悓绫诲瀷鍥剧墖灏佽
+ this.differentTypes = (judgeValue) => {
+ var effectOfChange
+ if (judgeValue === 1) {
+ effectOfChange = defaultImg
+ } else {
+ effectOfChange = setting
+ }
+ return effectOfChange
}
// 鍥哄簾鐐瑰嚮杩涜鐨� 鍐呭鐨勮缃�
// SetSolidWasteContent (config, containerPopup) {
--
Gitblit v1.8.0