From 96a7cb605dcd16def9a62003686cdfbbe1d102ec Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 11 Jun 2021 18:08:26 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/pyhmap

---
 widgets/instructions/Widget.js |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/widgets/instructions/Widget.js b/widgets/instructions/Widget.js
index c43c616..e45f1a5 100644
--- a/widgets/instructions/Widget.js
+++ b/widgets/instructions/Widget.js
@@ -42,17 +42,26 @@
 						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) {
-					d.push({
+					var obj = {
 						title: data[k].name,
-						id: data[k].id
-					})
+						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
@@ -71,9 +80,46 @@
 							//点击事件
 							// 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']
+									});
+								})
+							}
+
+								
+
+							
+
+						
 						}
 					});
 				});

--
Gitblit v1.9.3