liuyg
2021-06-11 96a7cb605dcd16def9a62003686cdfbbe1d102ec
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']
                           });
                        })
                     }
                  }
               });
            });