From ebefa651ad2d6edbfdb30fea3fc1ff97232a0aee Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 15 Jun 2021 11:07:52 +0800
Subject: [PATCH] 工具样式

---
 widgets/instructions/Widget.js |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/widgets/instructions/Widget.js b/widgets/instructions/Widget.js
index 7e580d1..577abba 100644
--- a/widgets/instructions/Widget.js
+++ b/widgets/instructions/Widget.js
@@ -29,9 +29,101 @@
 			layers: {},
 			startup: function () {
 				// 暴露在外的接口
+				var that = this
+					, url = 'http://171.34.76.171:8880/pyh-station/metaWetlandProtect/queryNameAndIdAssembleMap'
+					, token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjMzOTIwNTcsImV4cCI6MTYyNTk4NDA1N30.wyhtQWDfyBM4Wvu9x_GpzWErqDkZ3J-PWEjyzoaHT9w6mMBenso5q0ZdnFueCZaCOjsHM5AMwLawATT0Zqc4aQ"
+					;
+				axios.get(url, {
+					headers: {
+						"token": token
+					}
+				}).then((res) => {
+					if (res.data.code == 200) {
+						var data = res.data.data;
+						// console.log(data, 99999);
+						that.beginLayuiDropdown(data)
+
+					
+					}
+				})
 
 			},
+			beginLayuiDropdown: function (data) {
+				var that = this;
+				var d = [];
+				for (var k in data) {
+					var obj = {
+						title: data[k].NAME,
+						id: data[k].id,
+					}
+					if (data[k].seviceUrl) {
+						obj.src = data[k].seviceUrl
+					} 
+					d.push(obj)
 
+					
+				}
+				layui.use(['dropdown', 'util', 'layer', 'table'], function () {
+					var dropdown = layui.dropdown
+						, util = layui.util
+						, layer = layui.layer
+						, table = layui.table
+						, $ = layui.jquery;
+
+
+					dropdown.render({
+						elem: '.demo1'
+						, data: d
+						,trigger: 'hover'
+						, className: 'site-dropdown-demo'
+						, click: function (obj) {
+							//点击事件
+							// layer.tips('点击了:' + obj.title, this.elem, { tips: [1, '#5FB878'] })
+							var str = obj.title;
+						
+							$('.jimu-widget-instructions').find('.instructions-title').empty().append(str);
+
+							if (that[obj.id]) {
+								that.map.imageryLayers.remove(that[obj.id]);
+							}
+
+							if (obj.src) {
+								$.ajax({
+									url: res.data[i].seviceUrl + '/maps.json',
+									type: 'get',
+									dataType: 'JSON',
+									success: function (result) {
+										console.log(res.data[i])
+
+
+										that[res.data[i].id] = that.map.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
+											url:  result[0].path,
+										}));
+										that[res.data[i].id].alpha = 1
+
+									}
+								})
+							} else {
+
+								layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
+									//得到各种内置组件
+									var layer = layui.layer //弹层
+									// layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
+									layer.tips('暂无该服务', '.jimu-widget-instructions', {
+										tips: [2, '#FF5722']
+									});
+								})
+							}
+
+								
+
+							
+
+						
+						}
+					});
+				});
+			},
 			closeToolBox: function (item) {
 			},
 

--
Gitblit v1.9.3