diff --git a/public/config/widget.json b/public/config/widget.json index cc79a55..ea31d29 100644 --- a/public/config/widget.json +++ b/public/config/widget.json @@ -16,15 +16,6 @@ "disableOther": true }, "openAtStart": [ - { - "name": "POI查询", - "uri": "widgets/queryBaiduPOI/widget.js", - "css": { - "top": "150px", - "left": "auto", - "right": "500px" - } - }, { "name": "右上角工具栏", "uri": "widgets/toolBarRight/widget.js", diff --git a/public/img/none.png b/public/img/none.png new file mode 100644 index 0000000..1514dd1 Binary files /dev/null and b/public/img/none.png differ diff --git a/public/widgets/queryBaiduPOI.rar b/public/widgets/queryBaiduPOI.rar deleted file mode 100644 index 9f2bae4..0000000 Binary files a/public/widgets/queryBaiduPOI.rar and /dev/null differ diff --git a/public/widgets/queryBaiduPOI/images/jj.png b/public/widgets/queryBaiduPOI/images/jj.png deleted file mode 100644 index 283011f..0000000 Binary files a/public/widgets/queryBaiduPOI/images/jj.png and /dev/null differ diff --git a/public/widgets/queryBaiduPOI/images/tools/menu1.png b/public/widgets/queryBaiduPOI/images/tools/menu1.png deleted file mode 100644 index f9554dd..0000000 Binary files a/public/widgets/queryBaiduPOI/images/tools/menu1.png and /dev/null differ diff --git a/public/widgets/queryBaiduPOI/images/tools/menu2.png b/public/widgets/queryBaiduPOI/images/tools/menu2.png deleted file mode 100644 index b808bb8..0000000 Binary files a/public/widgets/queryBaiduPOI/images/tools/menu2.png and /dev/null differ diff --git a/public/widgets/queryBaiduPOI/images/tools/menu3.png b/public/widgets/queryBaiduPOI/images/tools/menu3.png deleted file mode 100644 index 6d59c98..0000000 Binary files a/public/widgets/queryBaiduPOI/images/tools/menu3.png and /dev/null differ diff --git a/public/widgets/queryBaiduPOI/images/tools/menu4.png b/public/widgets/queryBaiduPOI/images/tools/menu4.png deleted file mode 100644 index 2235d0a..0000000 Binary files a/public/widgets/queryBaiduPOI/images/tools/menu4.png and /dev/null differ diff --git a/public/widgets/queryBaiduPOI/view.css b/public/widgets/queryBaiduPOI/view.css deleted file mode 100644 index 9bea642..0000000 --- a/public/widgets/queryBaiduPOI/view.css +++ /dev/null @@ -1,436 +0,0 @@ -.querybar-ssk { - position: absolute; - left: 50%; - z-index: 999; - display: flex; - align-items: end; - height: 40px; - transform: translate(-50% , 0); - -webkit-transform: translate(-50% , 0); - -moz-transform: translate(-50% , 0); - -ms-transform: translate(-50% , 0); - -o-transform: translate(-50% , 0); -} -.querybar-ssk1 { - width: 230px; - height: 35px; - line-height: 35px; - font-size: 16px; - text-indent: 8px; - outline: none; - float: left; - background-color: transparent; - border: 1px solid #56FEFE; - border-top-left-radius: 5px; - border-bottom-left-radius: 20px; - position: relative; - top:-3px; - text-indent:18px; - font-size:14px; -} - -input::-webkit-input-placeholder { - /* WebKit browsers,webkit内核浏览器 */ - color: #36A5A8; - font-size: 16px; -} -.querybar-ssk1:focus { - border: 1px solid #56fefe; - background-color: rgba(86, 254, 254,.2); -} - -.querybar-ssk2 { - width: 75px; - height: 40px; - float: left; - border: none; - cursor: pointer; - outline: none; - background-color: transparent; - color:#FF9811; -} - -.querybar-sbox { - width: 260px; - padding: 10px; - box-shadow: 1px 2px 1px rgba(220, 220, 220, 0.3); - background: rgba(63, 72, 84, 0.9); - overflow: hidden; -} - -@media screen and (max-width: 640px) { - .querybar-ssk1 { - width: 200px; - } - - .querybar-ssk2 { - width: 45px; - } - - .querybar-sbox { - width: 200px; - } -} - -::-webkit-input-placeholder { - /* WebKit browsers */ - color: #A9A9A9; -} - -:-moz-placeholder { - /* Mozilla Firefox 4 to 18 */ - color: #A9A9A9; - opacity: 1; -} - -::-moz-placeholder { - /* Mozilla Firefox 19+ */ - color: #A9A9A9; - opacity: 1; -} - -:-ms-input-placeholder { - /* Internet Explorer 10+ */ - color: #A9A9A9; -} - -/*搜索栏*/ -.querybar-fl { - float: left; -} - -.querybar-fr { - float: right; -} - -.querybar-clear { - clear: both; -} - -.querybar-clear5 { - clear: both; - height: 5px; -} - -.querybar-clear10 { - clear: both; - height: 10px; -} - -.querybar-sstab { - height: 18px; - padding: 5px; - background: #f7f7f7; - border: solid 1px #e0e0e0; - border-radius: 4px; -} - -.querybar-sstab ul { - margin: 0; - padding: 0; -} - -.querybar-sstab ul li { - width: 70px; - height: 18px; - padding: 0 20px; - line-height: 18px; - text-align: center; - list-style-type: none; - float: left; - font-size: 12px; - border-right: solid 1px #e0e0e0; - cursor: pointer; -} - -.querybar-sstab ul li a { - font-size: 12px; - text-decoration: none; - color: #000000; -} - -.querybar-sstab ul li a:hover { - color: #dcdcdc; -} - -.querybar-kbtab { - padding-bottom: 10px; - overflow: hidden; - border-bottom: solid 1px #CCCCCC; -} - -.querybar-kbtab ul { - margin: 0; - padding: 0; -} - -.querybar-kbtab ul li { - list-style-type: none; - width: 60px; - float: left; - text-align: center; -} - -.querybar-kbtab ul li a { - font-size: 12px; - text-decoration: none; - color: #999; -} - -.querybar-kbtab ul li a img { - border: none; -} - -.querybar-kbtab ul li a:hover { - color: #dcdcdc; -} - -.querybar-ssls {} - -.querybar-ssls ul { - margin: 0; - padding: 10px 0; -} - -.querybar-ssls li { - font-size: 12px; - line-height: 20px; - list-style-type: none; - padding-left: 10px; -} - -.querybar-ssls i { - margin-right: 10px; -} - -.querybar-ssls li a { - text-decoration: none; - color: #dcdcdc; -} - -.querybar-ssls li a:hover { - color: #fff; -} - -.querybar-znbox { - width: 260px; - box-shadow: 1px 2px 1px rgba(0, 0, 0, .15); - background: rgba(63, 72, 84, 0.9); - overflow: hidden; -} - -.querybar-znts {} - -.querybar-znts ul { - margin: 0; - padding: 0; -} - -.querybar-znts li { - font-size: 12px; - height: 36px; - line-height: 36px; - list-style-type: none; - padding-left: 20px; -} - -.querybar-znts i { - margin-right: 10px; -} - -.querybar-znts li a { - text-decoration: none; - color: #dcdcdc; -} - -.querybar-znts li a:hover { - color: #fff; -} - - - -.querybar-site { - padding: 10px 8px; - border-top: solid 1px #eaeaea; - overflow: hidden; -} - -.querybar-site :hover { - background-color: rgba(63, 72, 84, 1); -} - -.querybar-sitejj { - width: 220px; - float: left; -} - -.querybar-sitejj h3 { - margin: 0; - padding: 0; - font-size: 14px; - padding-bottom: 6px; - color: #dcdcdc; - font-weight: bold; -} - -.querybar-sitejj p { - margin: 0; - padding: 0; - font-size: 12px; - line-height: 20px; - color: #999; -} - -.querybar-star { - color: #ff675a; - font-size: 12px; - line-height: 20px; -} - -.querybar-page { - font-size: 12px; -} - -.querybar-ye a { - text-decoration: none; - padding: 4px 6px; - color: #fff; - border: solid 1px #ccc; - margin-right: 4px; -} - -.querybar-ye a:hover { - color: #fff; - border-color: #dcdcdc; -} - -.querybar-dtit { - height: 44px; - line-height: 44px; - font-size: 14px; - text-indent: 10px; - background: #3385ff; - color: #fff; -} - -.querybar-itr { - padding: 8px 0; -} - -.querybar-itrtit { - font-size: 12px; - height: 22px; - line-height: 22px; - padding: 4px 0; -} - -.querybar-more { - float: right; - text-decoration: none; - font-size: 12px; - color: #999; -} - -.querybar-itrcon { - padding: 8px 0; - border-top: dashed 1px #eee; -} - -.querybar-itrcon p { - margin: 0; - padding: 0; - font-size: 12px; - line-height: 20px; - color: #dcdcdc; -} - -.querybar-itrcon a { - text-decoration: none; -} - -.querybar-star_orange { - font-size: 12px; - line-height: 20px; - color: #ffac2d; -} - - -/*全部分类*/ -.querybar-allsort { - position: absolute; - width: 230px; - padding: 4px; - background: rgba(63, 72, 84, 0.9); - border: solid 1px #e0e0e0; -} - -.querybar-sort { - padding: 6px 0; - overflow: hidden; -} - -.querybar-sorta { - width: 60px; - padding-top: 4px; - float: left; - font-size: 12px; - font-weight: bold; - color: #666; -} - -.querybar-sortb { - width: 170px; - float: right; -} - -.querybar-sortb ul { - margin: 0; - padding: 0; -} - -.querybar-sortb ul li { - list-style-type: none; - float: left; - padding: 0 10px 2px 0; -} - -.querybar-sortb ul li a { - font-size: 12px; - text-decoration: none; - color: #777; -} - -.querybar-sortb ul li a:hover { - color: #fff; -} - -/*推荐排序*/ -.querybar-recsort { - position: absolute; - left: 126px; - width: 120px; - background: rgba(63, 72, 84, 0.9); - border: solid 1px #e0e0e0; -} - -.querybar-recsort ul { - margin: 0; - padding: 0; -} - -.querybar-recsort ul li { - padding: 4px 0 6px 0; - list-style-type: none; - text-align: center; - border-top: solid 1px #e0e0e0; -} - -.querybar-recsort ul li a { - font-size: 12px; - text-decoration: none; - color: #777; -} - -.querybar-recsort ul li a:hover { - color: #fff; -} \ No newline at end of file diff --git a/public/widgets/queryBaiduPOI/view.html b/public/widgets/queryBaiduPOI/view.html deleted file mode 100644 index e1d64e6..0000000 --- a/public/widgets/queryBaiduPOI/view.html +++ /dev/null @@ -1,91 +0,0 @@ - -
- - -
- - - - - - - - - - - - -
diff --git a/public/widgets/queryBaiduPOI/widget.js b/public/widgets/queryBaiduPOI/widget.js deleted file mode 100644 index d494287..0000000 --- a/public/widgets/queryBaiduPOI/widget.js +++ /dev/null @@ -1,586 +0,0 @@ -'use script' //开发环境建议开启严格模式 -;(function (window, mars3d) { - //创建widget类,需要继承BaseWidget - class MyWidget extends mars3d.widget.BaseWidget { - //外部资源配置 - get resources() { - return ['view.css'] - } - - //弹窗配置 - get view() { - return { - type: 'append', - url: 'view.html', - parent: 'body', - } - } - - //初始化[仅执行1次] - create() { - this.storageName = 'mars3d_queryBaiduPOI' - this.pageSize = 6 - this.arrdata = [] - this.counts = 0 - this.allpage = 0 - this.thispage = 0 - - //创建矢量数据图层 - this.graphicLayer = new mars3d.layer.GraphicLayer({ - name: this.config.name, - pid: 99, //图层管理 中使用,父节点id - }) - //鼠标单击后的信息面板弹窗 - this.graphicLayer.bindPopup( - function (event) { - let item = event.graphic?.attr - if (!item) { - return - } - - var name - if (item.detail_info && item.detail_info.detail_url) { - name = '' + item.name + '' - } else { - name = item.name - } - - var inHtml = '
' + name + '
' - - var phone = $.trim(item.tel) - if (phone != '') { - inHtml += '
' + phone + '
' - } - - var dz = $.trim(item.address) - if (dz != '') { - inHtml += '
' + dz + '
' - } - - if (item.detail_info) { - var fl = $.trim(item.detail_info.tag) - if (fl != '') { - inHtml += '
' + fl + '
' - } - } - inHtml += '
' - - return inHtml - }, - { - anchor: [0, -10], - } - ) - - //查询控制器 - this.baiduPOI = new mars3d.query.BaiduPOI() - } - //每个窗口创建完成后调用 - winCreateOK(opt, result) { - if (opt.type != 'append') { - return - } - var that = this - var img = $('#map-querybar img') - img.each((index, item) => { - $(item).attr('src', this.path + $(item).attr('src')) - }) - - if (this.config.position) { - $('#map-querybar').css(this.config.position) - } - if (this.config.style) { - $('#map-querybar').css(this.config.style) - } - - // 搜索框 - $('#txt_querypoi').click(function () { - // 文本框内容为空 - if ($.trim($(this).val()).length == 0) { - that.hideAllQueryBarView() - // that.showHistoryList() // 显示历史记录 - } - }) - - var timetik = 0 - - // 搜索框绑定文本框值发生变化,隐藏默认搜索信息栏,显示匹配结果列表 - $('#txt_querypoi').bind('input propertychange', () => { - clearTimeout(timetik) - timetik = setTimeout(() => { - this.hideAllQueryBarView() - this.clearLayers() - - var queryVal = $.trim($('#txt_querypoi').val()) - if (queryVal.length == 0) { - // 文本框内容为空,显示历史记录 - // this.showHistoryList() - } else { - this.autoTipList(queryVal, true) - } - }, 500) - }) - - // 点击搜索查询按钮 - $('#btn_querypoi').click(() => { - clearTimeout(timetik) - this.hideAllQueryBarView() - - var queryVal = $.trim($('#txt_querypoi').val()) - this.strartQueryPOI(queryVal, true) - }) - //绑定回车键 - $('#txt_querypoi').bind('keydown', (event) => { - if (event.keyCode == '13') { - $('#btn_querypoi').click() - } - }) - - // 返回查询结果面板界面 - $('#querybar_detail_back').click(() => { - this.hideAllQueryBarView() - $('#querybar_resultlist_view').show() - }) - } - //打开激活 - activate() { - this.map.addLayer(this.graphicLayer) - - //单击地图事件 - this.map.on(mars3d.EventType.clickMap, this.onMapClick, this) - } - //关闭释放 - disable() { - this.map.removeLayer(this.graphicLayer) - - //释放单击地图事件 - this.map.off(mars3d.EventType.clickMap, this.onMapClick, this) - - this.hideAllQueryBarView() - this.clearLayers() - } - onMapClick(event) { - // 点击地图区域,隐藏所有弹出框 - if ($.trim($('#txt_querypoi').val()).length == 0) { - this.hideAllQueryBarView() - $('#txt_querypoi').blur() - } - } - hideAllQueryBarView() { - $('#querybar_histroy_view').hide() - $('#querybar_autotip_view').hide() - $('#querybar_detail_view').hide() - $('#querybar_resultlist_view').hide() - } - - // 点击面板条目,自动填充搜索框,并展示搜索结果面板 - autoSearch(name) { - $('#txt_querypoi').val(name) - $('#btn_querypoi').trigger('click') - } - - //===================与后台交互======================== - - //显示智能提示搜索结果 - autoTipList(text, queryEx) { - //输入经纬度数字时 - if (this.isLonLat(text)) { - return - } - - //查询外部widget - if (this.hasExWidget() && queryEx) { - this.autoExTipList(text) - return - } - //查询外部widget - - this.baiduPOI.autoTip({ - text: text, - location: this.map.getCenter(), - success: (result) => { - var inhtml = '' - var pois = result.list - for (var index = 0; index < pois.length; index++) { - var name = pois[index].name - // var num = pois[index].num; - // if (num > 0) continue; - - inhtml += "
  • ' + name + '
  • ' - } - - if (inhtml.length > 0) { - $('#querybar_ul_autotip').html(inhtml) - $('#querybar_autotip_view').show() - } - }, - }) - } - - // 根据输入框内容,查询显示列表 - strartQueryPOI(text, queryEx) { - if (text.length == 0) { - toastr.warning('请输入搜索关键字!') - return - } - - // TODO:根据文本框输入内容,从数据库模糊查询到所有匹配结果(分页显示) - // this.addHistory(text) - - this.hideAllQueryBarView() - - //输入经纬度数字时 - if (this.isLonLat(text)) { - this.centerAtLonLat(text) - return - } - - //查询外部widget - if (this.hasExWidget() && queryEx) { - var qylist = this.queryExPOI(text) - return - } - //查询外部widget - - this.thispage = 1 - this.queryText = text - this.query_location = this.map.getCenter() - this.query_radius = this.map.camera.positionCartographic.height //单位:米 - - this.queryPOI() - } - queryPOI() { - let searchinfo = { - keyWord:this.queryText, - level:20, - mapBound:"117.627645,34.392462,119.02584,36.217225", - specify:"371300", - queryType:7, - count:10, - start:0, - } - let query = JSON.stringify(searchinfo); - query=query+"&type=query&tk=b6585bc41ee16251dbe6b1af64f375d9"; - let _this = this; - $.ajax({ - type:"GET", - url:'http://api.tianditu.gov.cn/search?postStr='+query, - dataType:"json", - success(result){ - console.log('result',result); - - _this.showPOIPage(result.pois, result.count) - } - }) - //查询获取数据 - // this.baiduPOI.queryText({ - // text: this.queryText, - // count: this.pageSize, - // page: this.thispage - 1, - // location: this.query_location, - // radius: this.query_radius, - // success: (result) => { - // if (!this.isActivate) { - // return - // } - // this.showPOIPage(result.list, result.allcount) - // }, - // }) - // - - } - - //===================显示查询结果处理======================== - showPOIPage(data, counts) { - this.arrdata = data - this.counts = counts - if (this.counts < data.length) { - this.counts = data.length - } - this.allpage = Math.ceil(this.counts / this.pageSize) - - var inhtml = '' - if (this.counts == 0) { - inhtml += '
    没有找到"' + this.queryText + '"相关结果
    ' - } else { - this.objResultData = this.objResultData || {} - for (var index = 0; index < this.arrdata.length; index++) { - var item = this.arrdata[index] - var startIdx = (this.thispage - 1) * this.pageSize - item.index = startIdx + (index + 1) - - var _id = index - var _mc - if (item.detail_info && item.detail_info.detail_url) { - _mc = '' + item.name + '' - } else { - _mc = item.name - } - - inhtml += - '

    ' + - item.index + - '、' + - _mc + - '

    ' + - (item.address || '') + - '

    ' - - this.objResultData[_id] = item - } - - //分页信息 - var _fyhtml - if (this.allpage > 1) { - _fyhtml = - '
    ' + - this.thispage + - '/' + - this.allpage + - '页 首页 < >
    ' - } else { - _fyhtml = '' - } - - //底部信息 - inhtml += '
    找到' + this.counts + '条结果
    ' + _fyhtml + '
    ' - } - $('#querybar_resultlist_view').html(inhtml) - $('#querybar_resultlist_view').show() - - this.showPOIArr(this.arrdata) - if (this.counts == 1) { - this.showDetail('0') - } - } - showFirstPage() { - this.thispage = 1 - this.queryPOI() - } - showNextPage() { - this.thispage = this.thispage + 1 - if (this.thispage > this.allpage) { - this.thispage = this.allpage - toastr.warning('当前已是最后一页了') - return - } - this.queryPOI() - } - - showPretPage() { - this.thispage = this.thispage - 1 - if (this.thispage < 1) { - this.thispage = 1 - toastr.warning('当前已是第一页了') - return - } - this.queryPOI() - } - //点击单个结果,显示详细 - showDetail(id) { - var item = this.objResultData[id] - this.flyTo(item) - } - clearLayers() { - this.graphicLayer.closePopup() - this.graphicLayer.clear() - } - showPOIArr(arr) { - this.clearLayers() - - - arr.forEach((item) => { - let lngLat = item.lonlat.split(" "); - var jd = Number(lngLat[0]) - var wd = Number(lngLat[1]) - // var jd = Number(item.x) - // var wd = Number(item.y) - if (isNaN(jd) || isNaN(wd)) { - return - } - - item.x = jd - item.y = wd - - //添加实体 - var graphic = new mars3d.graphic.PointEntity({ - position: Cesium.Cartesian3.fromDegrees(jd, wd), - style: { - pixelSize: 10, - color: '#3388ff', - outline: true, - outlineColor: '#ffffff', - outlineWidth: 2, - scaleByDistance: new Cesium.NearFarScalar(1000, 1, 1000000, 0.1), - clampToGround: true, //贴地 - visibleDepth: false, //是否被遮挡 - label: { - text: item.name, - font_size: 20, - color: 'rgb(240,255,255)', - outline: true, - outlineWidth: 2, - outlineColor: Cesium.Color.BLACK, - horizontalOrigin: Cesium.HorizontalOrigin.CENTER, - verticalOrigin: Cesium.VerticalOrigin.BOTTOM, - pixelOffsetY: -10, //偏移量 - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 200000), - clampToGround: true, //贴地 - visibleDepth: false, //是否被遮挡 - }, - }, - attr: item, - }) - this.graphicLayer.addGraphic(graphic) - - item._graphic = graphic - }) - - if (arr.length > 1) { - this.graphicLayer.flyTo() - } - } - flyTo(item) { - - var graphic = item._graphic - if (graphic == null) { - window.toastr.warning(item.name + ' 无经纬度坐标信息!') - return - } - - this.map.flyToGraphic(graphic, { radius: 2000 }) - - setTimeout(() => { - this.graphicLayer.openPopup(graphic) - }, 3000) - } - - //===================坐标定位处理======================== - isLonLat(text) { - var reg = /^-?((0|1?[0-7]?[0-9]?)(([.][0-9]*)?)|180(([.][0]*)?)),-?((0|[1-8]?[0-9]?)(([.][0-9]*)?)|90(([.][0]*)?))$/ /*定义验证表达式*/ - return reg.test(text) /*进行验证*/ - } - centerAtLonLat(text) { - var arr = text.split(',') - if (arr.length != 2) { - return - } - - var jd = Number(arr[0]) - var wd = Number(arr[1]) - if (isNaN(jd) || isNaN(wd)) { - return - } - - this.map.setCameraView({ x: jd, y: wd, minz: 2500 }) - - //添加实体 - var graphic = new mars3d.graphic.PointEntity({ - position: Cesium.Cartesian3.fromDegrees(jd, wd), - style: { - color: '#3388ff', - pixelSize: 10, - outline: true, - outlineColor: '#ffffff', - outlineWidth: 2, - scaleByDistance: new Cesium.NearFarScalar(1000, 1, 1000000, 0.1), - clampToGround: true, //贴地 - visibleDepth: false, //是否被遮挡 - }, - }) - this.graphicLayer.addGraphic(graphic) - - graphic.bindPopup(`
    坐标定位
    -
    -
    ${jd}
    -
    ${wd}
    -
    `) - - setTimeout(() => { - graphic.openPopup() - }, 3000) - } - - //===================历史记录相关======================== - showHistoryList() { - $('#querybar_histroy_view').hide() - - var laststorage = haoutil.storage.get(this.storageName) //读取storage值 - if (laststorage == null) { - return - } - - this.arrHistory = eval(laststorage) - if (this.arrHistory == null || this.arrHistory.length == 0) { - return - } - - var inhtml = '' - for (var index = this.arrHistory.length - 1; index >= 0; index--) { - var item = this.arrHistory[index] - inhtml += "
  • ' + item + '
  • ' - } - $('#querybar_ul_history').html(inhtml) - $('#querybar_histroy_view').show() - } - - clearHistory() { - this.arrHistory = [] - haoutil.storage.del(this.storageName) - - $('#querybar_ul_history').html('') - $('#querybar_histroy_view').hide() - } - - //记录历史值 - addHistory(data) { - this.arrHistory = [] - var laststorage = haoutil.storage.get(this.storageName) //读取storage值 - if (laststorage != null) { - this.arrHistory = eval(laststorage) - } - //先删除之前相同记录 - // this.arrHistory.remove(data) - - this.arrHistory.push(data) - - if (this.arrHistory.length > 10) { - this.arrHistory.splice(0, 1) - } - - laststorage = JSON.stringify(this.arrHistory) - haoutil.storage.add(this.storageName, laststorage) - } - - //======================查询非百度poi,联合查询处理================= - //外部widget是否存在或启用 - hasExWidget() { - if (window['queryBarWidget'] == null) { - return false - } else { - this.exWidget = window.queryBarWidget - return true - } - } - autoExTipList(text) { - this.exWidget.autoTipList(text, () => { - this.autoTipList(text, false) - }) - } - //调用外部widget进行查询 - queryExPOI(text) { - var layer = this.graphicLayer - - this.exWidget.strartQueryPOI(text, layer, () => { - this.strartQueryPOI(text, false) - }) - } - } - - //注册到widget管理器中。 - window.queryBaiduPOIWidget = mars3d.widget.bindClass(MyWidget) - - //每个widet之间都是直接引入到index.html中,会存在彼此命名冲突,所以闭包处理下。 -})(window, mars3d) diff --git a/public/widgets/queryGaodePOI/images/jj.png b/public/widgets/queryGaodePOI/images/jj.png deleted file mode 100644 index 283011f..0000000 Binary files a/public/widgets/queryGaodePOI/images/jj.png and /dev/null differ diff --git a/public/widgets/queryGaodePOI/images/tools/menu1.png b/public/widgets/queryGaodePOI/images/tools/menu1.png deleted file mode 100644 index f9554dd..0000000 Binary files a/public/widgets/queryGaodePOI/images/tools/menu1.png and /dev/null differ diff --git a/public/widgets/queryGaodePOI/images/tools/menu2.png b/public/widgets/queryGaodePOI/images/tools/menu2.png deleted file mode 100644 index b808bb8..0000000 Binary files a/public/widgets/queryGaodePOI/images/tools/menu2.png and /dev/null differ diff --git a/public/widgets/queryGaodePOI/images/tools/menu3.png b/public/widgets/queryGaodePOI/images/tools/menu3.png deleted file mode 100644 index 6d59c98..0000000 Binary files a/public/widgets/queryGaodePOI/images/tools/menu3.png and /dev/null differ diff --git a/public/widgets/queryGaodePOI/images/tools/menu4.png b/public/widgets/queryGaodePOI/images/tools/menu4.png deleted file mode 100644 index 2235d0a..0000000 Binary files a/public/widgets/queryGaodePOI/images/tools/menu4.png and /dev/null differ diff --git a/public/widgets/queryGaodePOI/view.css b/public/widgets/queryGaodePOI/view.css deleted file mode 100644 index e4c4aa0..0000000 --- a/public/widgets/queryGaodePOI/view.css +++ /dev/null @@ -1,418 +0,0 @@ -.querybar-ssk { - position: absolute; - left: 15px; - top: 15px; - z-index: 999; -} - -.querybar-ssk1 { - width: 260px; - height: 40px; - line-height: 40px; - font-size: 16px; - text-indent: 8px; - outline: none; - float: left; - border: none; - box-shadow: 0px 2px 6px #3a3c42; - border-top-left-radius: 2px; - border-bottom-left-radius: 2px; -} - -.querybar-ssk1:focus { - border: 1px solid rgba(155, 223, 255, 0.9); - background-color: rgba(63, 72, 84, 0.9); -} - -.querybar-ssk2 { - width: 50px; - height: 40px; - float: left; - border: none; - cursor: pointer; - outline: none; - background-color: rgba(35, 68, 117, 0.85); -} - -.querybar-sbox { - width: 260px; - padding: 10px; - box-shadow: 1px 2px 1px rgba(220, 220, 220, 0.3); - background: rgba(63, 72, 84, 0.9); - overflow: hidden; -} - -@media screen and (max-width: 640px) { - .querybar-ssk1 { - width: 200px; - } - .querybar-ssk2 { - width: 45px; - } - .querybar-sbox { - width: 200px; - } -} - -::-webkit-input-placeholder { - /* WebKit browsers */ - color: #a9a9a9; -} - -:-moz-placeholder { - /* Mozilla Firefox 4 to 18 */ - color: #a9a9a9; - opacity: 1; -} - -::-moz-placeholder { - /* Mozilla Firefox 19+ */ - color: #a9a9a9; - opacity: 1; -} - -:-ms-input-placeholder { - /* Internet Explorer 10+ */ - color: #a9a9a9; -} - -/*搜索栏*/ - -.querybar-fl { - float: left; -} - -.querybar-fr { - float: right; -} - -.querybar-clear { - clear: both; -} - -.querybar-clear5 { - clear: both; - height: 5px; -} - -.querybar-clear10 { - clear: both; - height: 10px; -} - -.querybar-sstab { - height: 18px; - padding: 5px; - background: #f7f7f7; - border: solid 1px #e0e0e0; - border-radius: 4px; -} - -.querybar-sstab ul { - margin: 0; - padding: 0; -} - -.querybar-sstab ul li { - width: 70px; - height: 18px; - padding: 0 20px; - line-height: 18px; - text-align: center; - list-style-type: none; - float: left; - font-size: 12px; - border-right: solid 1px #e0e0e0; - cursor: pointer; -} - -.querybar-sstab ul li a { - font-size: 12px; - text-decoration: none; - color: #000000; -} - -.querybar-sstab ul li a:hover { - color: #dcdcdc; -} - -.querybar-kbtab { - padding-bottom: 10px; - overflow: hidden; - border-bottom: solid 1px #cccccc; -} - -.querybar-kbtab ul { - margin: 0; - padding: 0; -} - -.querybar-kbtab ul li { - list-style-type: none; - width: 60px; - float: left; - text-align: center; -} - -.querybar-kbtab ul li a { - font-size: 12px; - text-decoration: none; - color: #999; -} - -.querybar-kbtab ul li a img { - border: none; -} - -.querybar-kbtab ul li a:hover { - color: #dcdcdc; -} - -.querybar-ssls {} - -.querybar-ssls ul { - margin: 0; - padding: 10px 0; -} - -.querybar-ssls li { - font-size: 12px; - line-height: 20px; - list-style-type: none; - padding-left: 10px; -} - -.querybar-ssls i { - margin-right: 10px; -} - -.querybar-ssls li a { - text-decoration: none; - color: #dcdcdc; -} - -.querybar-ssls li a:hover { - color: #fff; -} - -.querybar-znbox { - width: 260px; - box-shadow: 1px 2px 1px rgba(0, 0, 0, 0.15); - background: rgba(63, 72, 84, 0.9); - overflow: hidden; -} - -.querybar-znts {} - -.querybar-znts ul { - margin: 0; - padding: 0; -} - -.querybar-znts li { - font-size: 12px; - height: 36px; - line-height: 36px; - list-style-type: none; - padding-left: 20px; -} - -.querybar-znts i { - margin-right: 10px; -} - -.querybar-znts li a { - text-decoration: none; - color: #dcdcdc; -} - -.querybar-znts li a:hover { - color: #fff; -} - -.querybar-site { - padding: 10px 8px; - border-top: solid 1px #eaeaea; - overflow: hidden; -} - -.querybar-site :hover { - background-color: rgba(63, 72, 84, 1); -} - -.querybar-sitejj { - width: 220px; - float: left; -} - -.querybar-sitejj h3 { - margin: 0; - padding: 0; - font-size: 14px; - padding-bottom: 6px; - color: #dcdcdc; - font-weight: bold; -} - -.querybar-sitejj p { - margin: 0; - padding: 0; - font-size: 12px; - line-height: 20px; - color: #999; -} - -.querybar-star { - color: #ff675a; - font-size: 12px; - line-height: 20px; -} - -.querybar-page { - font-size: 12px; -} - -.querybar-ye a { - text-decoration: none; - padding: 4px 6px; - color: #fff; - border: solid 1px #ccc; - margin-right: 4px; -} - -.querybar-ye a:hover { - color: #fff; - border-color: #dcdcdc; -} - -.querybar-dtit { - height: 44px; - line-height: 44px; - font-size: 14px; - text-indent: 10px; - background: #3385ff; - color: #fff; -} - -.querybar-itr { - padding: 8px 0; -} - -.querybar-itrtit { - font-size: 12px; - height: 22px; - line-height: 22px; - padding: 4px 0; -} - -.querybar-more { - float: right; - text-decoration: none; - font-size: 12px; - color: #999; -} - -.querybar-itrcon { - padding: 8px 0; - border-top: dashed 1px #eee; -} - -.querybar-itrcon p { - margin: 0; - padding: 0; - font-size: 12px; - line-height: 20px; - color: #dcdcdc; -} - -.querybar-itrcon a { - text-decoration: none; -} - -.querybar-star_orange { - font-size: 12px; - line-height: 20px; - color: #ffac2d; -} - -/*全部分类*/ - -.querybar-allsort { - position: absolute; - width: 230px; - padding: 4px; - background: rgba(63, 72, 84, 0.9); - border: solid 1px #e0e0e0; -} - -.querybar-sort { - padding: 6px 0; - overflow: hidden; -} - -.querybar-sorta { - width: 60px; - padding-top: 4px; - float: left; - font-size: 12px; - font-weight: bold; - color: #666; -} - -.querybar-sortb { - width: 170px; - float: right; -} - -.querybar-sortb ul { - margin: 0; - padding: 0; -} - -.querybar-sortb ul li { - list-style-type: none; - float: left; - padding: 0 10px 2px 0; -} - -.querybar-sortb ul li a { - font-size: 12px; - text-decoration: none; - color: #777; -} - -.querybar-sortb ul li a:hover { - color: #fff; -} - -/*推荐排序*/ - -.querybar-recsort { - position: absolute; - left: 126px; - width: 120px; - background: rgba(63, 72, 84, 0.9); - border: solid 1px #e0e0e0; -} - -.querybar-recsort ul { - margin: 0; - padding: 0; -} - -.querybar-recsort ul li { - padding: 4px 0 6px 0; - list-style-type: none; - text-align: center; - border-top: solid 1px #e0e0e0; -} - -.querybar-recsort ul li a { - font-size: 12px; - text-decoration: none; - color: #777; -} - -.querybar-recsort ul li a:hover { - color: #fff; -} diff --git a/public/widgets/queryGaodePOI/view.html b/public/widgets/queryGaodePOI/view.html deleted file mode 100644 index 659e827..0000000 --- a/public/widgets/queryGaodePOI/view.html +++ /dev/null @@ -1,89 +0,0 @@ - -
    - - -
    - - - - - - - - - - - - -
    diff --git a/public/widgets/queryGaodePOI/widget.js b/public/widgets/queryGaodePOI/widget.js deleted file mode 100644 index 148375b..0000000 --- a/public/widgets/queryGaodePOI/widget.js +++ /dev/null @@ -1,584 +0,0 @@ -"use script"; //开发环境建议开启严格模式 -(function (window, mars3d) { - //创建widget类,需要继承BaseWidget - class MyWidget extends mars3d.widget.BaseWidget { - //外部资源配置 - get resources() { - return ["view.css"]; - } - - //弹窗配置 - get view() { - return { - type: "append", - url: "view.html", - parent: "body", - }; - } - - //初始化[仅执行1次] - create() { - this.storageName = "mars3d_queryGaodePOI"; - this.pageSize = 6; - this.allpage = 0; - this.thispage = 0; - - //创建矢量数据图层 - this.graphicLayer = new mars3d.layer.GraphicLayer({ - name: this.config.name, - pid: 99, //图层管理 中使用,父节点id - }); - //鼠标单击后的信息面板弹窗 - this.graphicLayer.bindPopup( - function (event) { - let item = event.graphic?.attr; - if (!item) { - return; - } - - var name; - if (item.detail_info && item.detail_info.detail_url) { - name = '' + item.name + ""; - } else { - name = item.name; - } - - var inHtml = '
    ' + name + '
    '; - - var phone = $.trim(item.tel); - if (phone != "") { - inHtml += "
    " + phone + "
    "; - } - - var dz = $.trim(item.address); - if (dz != "") { - inHtml += "
    " + dz + "
    "; - } - - if (item.type) { - var fl = $.trim(item.type); - if (fl != "") { - inHtml += "
    " + fl + "
    "; - } - } - inHtml += "
    "; - - return inHtml; - }, - { - anchor: [0, -10], - } - ); - - //查询控制器 - this._queryPoi = new mars3d.query.GaodePOI({ - // city: '合肥市', - }); - } - //每个窗口创建完成后调用 - winCreateOK(opt, result) { - if (opt.type != "append") { - return; - } - var that = this; - var img = $("#map-querybar img"); - img.each((index, item) => { - $(item).attr("src", this.path + $(item).attr("src")); - }); - - if (this.config.position) { - $("#map-querybar").css(this.config.position); - } - if (this.config.style) { - $("#map-querybar").css(this.config.style); - } - - // 搜索框 - $("#txt_querypoi").click(function () { - // 文本框内容为空 - if ($.trim($(this).val()).length == 0) { - that.hideAllQueryBarView(); - that.showHistoryList(); // 显示历史记录 - } - }); - - var timetik = 0; - - // 搜索框绑定文本框值发生变化,隐藏默认搜索信息栏,显示匹配结果列表 - $("#txt_querypoi").bind("input propertychange", () => { - clearTimeout(timetik); - timetik = setTimeout(() => { - this.hideAllQueryBarView(); - this.clearLayers(); - - var queryVal = $.trim($("#txt_querypoi").val()); - if (queryVal.length == 0) { - // 文本框内容为空,显示历史记录 - this.showHistoryList(); - } else { - this.autoTipList(queryVal, true); - } - }, 500); - }); - - // 点击搜索查询按钮 - $("#btn_querypoi").click(() => { - clearTimeout(timetik); - this.hideAllQueryBarView(); - - var queryVal = $.trim($("#txt_querypoi").val()); - this.strartQueryPOI(queryVal, true); - }); - //绑定回车键 - $("#txt_querypoi").bind("keydown", (event) => { - if (event.keyCode == "13") { - $("#btn_querypoi").click(); - } - }); - - // 返回查询结果面板界面 - $("#querybar_detail_back").click(() => { - this.hideAllQueryBarView(); - $("#querybar_resultlist_view").show(); - }); - } - //打开激活 - activate() { - this.map.addLayer(this.graphicLayer); - - $(".mars3d-locationbar").append('
    '); - - //单击地图事件 - this.map.on(mars3d.EventType.clickMap, this.onMapClick, this); - this.map.on(mars3d.EventType.cameraChanged, this.onMapCameraChanged, this); - } - //关闭释放 - disable() { - this.map.removeLayer(this.graphicLayer); - - //释放单击地图事件 - this.map.off(mars3d.EventType.clickMap, this.onMapClick, this); - this.map.off(mars3d.EventType.cameraChanged, this.onMapCameraChanged, this); - - $("#queryAddress").remove(); - - this.hideAllQueryBarView(); - this.clearLayers(); - } - onMapClick(event) { - // 点击地图区域,隐藏所有弹出框 - if ($.trim($("#txt_querypoi").val()).length == 0) { - this.hideAllQueryBarView(); - $("#txt_querypoi").blur(); - } - } - onMapCameraChanged(event) { - let radius = this.map.camera.positionCartographic.height; //单位:米 - if (radius > 100000) { - this.address = null; - $("#queryAddress").html(""); - return; - } - - this._queryPoi.getAddress({ - location: this.map.getCenter(), - success: (result) => { - console.log("地址", result); - this.address = result; - - $("#queryAddress").html("地址:" + result.address); - }, - }); - } - hideAllQueryBarView() { - $("#querybar_histroy_view").hide(); - $("#querybar_autotip_view").hide(); - $("#querybar_detail_view").hide(); - $("#querybar_resultlist_view").hide(); - } - - // 点击面板条目,自动填充搜索框,并展示搜索结果面板 - autoSearch(name) { - $("#txt_querypoi").val(name); - $("#btn_querypoi").trigger("click"); - } - - //===================与后台交互======================== - - //显示智能提示搜索结果 - autoTipList(text, queryEx) { - //输入经纬度数字时 - if (this.isLonLat(text)) { - return; - } - - //查询外部widget - if (this.hasExWidget() && queryEx) { - this.autoExTipList(text); - return; - } - //查询外部widget - - //搜索提示 - this._queryPoi.autoTip({ - text: text, - city: this.address?.city, - location: this.map.getCenter(), - success: (result) => { - var inhtml = ""; - var pois = result.list; - for (var index = 0; index < pois.length; index++) { - var name = pois[index].name; - // var num = pois[index].num; - // if (num > 0) continue; - - inhtml += "
  • " + name + "
  • "; - } - if (inhtml.length > 0) { - $("#querybar_ul_autotip").html(inhtml); - $("#querybar_autotip_view").show(); - } - }, - }); - } - - // 根据输入框内容,查询显示列表 - strartQueryPOI(text, queryEx) { - if (text.length == 0) { - toastr.warning("请输入搜索关键字!"); - return; - } - - // TODO:根据文本框输入内容,从数据库模糊查询到所有匹配结果(分页显示) - this.addHistory(text); - - this.hideAllQueryBarView(); - - //输入经纬度数字时 - if (this.isLonLat(text)) { - this.centerAtLonLat(text); - return; - } - - //查询外部widget - if (this.hasExWidget() && queryEx) { - var qylist = this.queryExPOI(text); - return; - } - //查询外部widget - - this.thispage = 1; - this.queryText = text; - - this.query_city = this.address?.city; - // this.query_location = this.map.getCenter() - // this.query_radius = this.map.camera.positionCartographic.height //单位:米 - - this.queryTextByServer(); - } - queryTextByServer() { - //查询获取数据 - this._queryPoi.queryText({ - text: this.queryText, - count: this.pageSize, - page: this.thispage - 1, - city: this.query_city, - // location: this.query_location, - // radius: this.query_radius, - success: (result) => { - if (!this.isActivate) { - return; - } - this.showPOIPage(result.list, result.allcount); - }, - }); - } - - //===================显示查询结果处理======================== - showPOIPage(data, counts) { - // count -- 显示搜索结果的数量;data -- 结果的属性,如地址电话等 - - if (counts < data.length) { - counts = data.length; - } - this.allpage = Math.ceil(counts / this.pageSize); - - var inhtml = ""; - if (counts == 0) { - inhtml += '
    没有找到"' + this.queryText + '"相关结果
    '; - } else { - this.objResultData = this.objResultData || {}; - for (var index = 0; index < data.length; index++) { - var item = data[index]; - var startIdx = (this.thispage - 1) * this.pageSize; - item.index = startIdx + (index + 1); - - var _id = index; - var _mc; - if (item.detail_info && item.detail_info.detail_url) { - _mc = '' + item.name + ""; - } else { - _mc = item.name; - } - - inhtml += - '

    ' + - item.index + - "、" + - _mc + - "

    " + - (item.address || "") + - "

    "; - - this.objResultData[_id] = item; - } - - //分页信息 - var _fyhtml; - if (this.allpage > 1) { - _fyhtml = - '
    ' + - this.thispage + - "/" + - this.allpage + - '页 首页 < >
    '; - } else { - _fyhtml = ""; - } - - //底部信息 - inhtml += '
    找到' + counts + "条结果
    " + _fyhtml + "
    "; - } - $("#querybar_resultlist_view").html(inhtml); - $("#querybar_resultlist_view").show(); - - this.showPOIArr(data); - if (counts == 1) { - this.showDetail("0"); - } - } - showFirstPage() { - this.thispage = 1; - this.queryTextByServer(); - } - showNextPage() { - this.thispage = this.thispage + 1; - if (this.thispage > this.allpage) { - this.thispage = this.allpage; - toastr.warning("当前已是最后一页了"); - return; - } - this.queryTextByServer(); - } - - showPretPage() { - this.thispage = this.thispage - 1; - if (this.thispage < 1) { - this.thispage = 1; - toastr.warning("当前已是第一页了"); - return; - } - this.queryTextByServer(); - } - //点击单个结果,显示详细 - showDetail(id) { - var item = this.objResultData[id]; - this.flyTo(item); - } - clearLayers() { - this.graphicLayer.closePopup(); - this.graphicLayer.clear(); - } - showPOIArr(arr) { - this.clearLayers(); - - arr.forEach((item) => { - var jd = Number(item.x); - var wd = Number(item.y); - if (isNaN(jd) || isNaN(wd)) { - return; - } - - item.x = jd; - item.y = wd; - - //添加实体 - var graphic = new mars3d.graphic.PointEntity({ - position: Cesium.Cartesian3.fromDegrees(jd, wd), - style: { - pixelSize: 10, - color: "#3388ff", - outline: true, - outlineColor: "#ffffff", - outlineWidth: 2, - scaleByDistance: new Cesium.NearFarScalar(1000, 1, 1000000, 0.1), - clampToGround: true, //贴地 - visibleDepth: false, //是否被遮挡 - label: { - text: item.name, - font_size: 20, - color: "rgb(240,255,255)", - outline: true, - outlineWidth: 2, - outlineColor: Cesium.Color.BLACK, - horizontalOrigin: Cesium.HorizontalOrigin.CENTER, - verticalOrigin: Cesium.VerticalOrigin.BOTTOM, - pixelOffsetY: -10, //偏移量 - distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 200000), - clampToGround: true, //贴地 - visibleDepth: false, //是否被遮挡 - }, - }, - attr: item, - }); - this.graphicLayer.addGraphic(graphic); - - item._graphic = graphic; - }); - - if (arr.length > 1) { - this.graphicLayer.flyTo(); - } - } - flyTo(item) { - var graphic = item._graphic; - if (graphic == null) { - window.toastr.warning(item.name + " 无经纬度坐标信息!"); - return; - } - - this.map.flyToGraphic(graphic, { radius: 2000 }); - - setTimeout(() => { - this.graphicLayer.openPopup(graphic); - }, 3000); - } - - //===================坐标定位处理======================== - isLonLat(text) { - var reg = /^-?((0|1?[0-7]?[0-9]?)(([.][0-9]*)?)|180(([.][0]*)?)),-?((0|[1-8]?[0-9]?)(([.][0-9]*)?)|90(([.][0]*)?))$/; /*定义验证表达式*/ - return reg.test(text); /*进行验证*/ - } - centerAtLonLat(text) { - var arr = text.split(","); - if (arr.length != 2) { - return; - } - - var jd = Number(arr[0]); - var wd = Number(arr[1]); - if (isNaN(jd) || isNaN(wd)) { - return; - } - - this.map.setCameraView({ x: jd, y: wd, minz: 2500 }); - - //添加实体 - var graphic = new mars3d.graphic.PointEntity({ - position: Cesium.Cartesian3.fromDegrees(jd, wd), - style: { - color: "#3388ff", - pixelSize: 10, - outline: true, - outlineColor: "#ffffff", - outlineWidth: 2, - scaleByDistance: new Cesium.NearFarScalar(1000, 1, 1000000, 0.1), - clampToGround: true, //贴地 - visibleDepth: false, //是否被遮挡 - }, - }); - this.graphicLayer.addGraphic(graphic); - - graphic.bindPopup(`
    坐标定位
    -
    -
    ${jd}
    -
    ${wd}
    -
    `); - setTimeout(() => { - graphic.openPopup(); - }, 3000); - } - - //===================历史记录相关======================== - showHistoryList() { - $("#querybar_histroy_view").hide(); - - var laststorage = haoutil.storage.get(this.storageName); //读取storage值 - if (laststorage == null) { - return; - } - - this.arrHistory = eval(laststorage); - if (this.arrHistory == null || this.arrHistory.length == 0) { - return; - } - - var inhtml = ""; - for (var index = this.arrHistory.length - 1; index >= 0; index--) { - var item = this.arrHistory[index]; - inhtml += "
  • " + item + "
  • "; - } - $("#querybar_ul_history").html(inhtml); - $("#querybar_histroy_view").show(); - } - - clearHistory() { - this.arrHistory = []; - haoutil.storage.del(this.storageName); - - $("#querybar_ul_history").html(""); - $("#querybar_histroy_view").hide(); - } - - //记录历史值 - addHistory(data) { - this.arrHistory = []; - var laststorage = haoutil.storage.get(this.storageName); //读取storage值 - if (laststorage != null) { - this.arrHistory = eval(laststorage); - } - //先删除之前相同记录 - haoutil.array.remove(this.arrHistory, data); - - this.arrHistory.push(data); - - if (this.arrHistory.length > 10) { - this.arrHistory.splice(0, 1); - } - - laststorage = JSON.stringify(this.arrHistory); - haoutil.storage.add(this.storageName, laststorage); - } - - //======================查询非百度poi,联合查询处理================= - //外部widget是否存在或启用 - hasExWidget() { - if (window["queryBarWidget"] == null) { - return false; - } else { - this.exWidget = window.queryBarWidget; - return true; - } - } - autoExTipList(text) { - this.exWidget.autoTipList(text, () => { - this.autoTipList(text, false); - }); - } - //调用外部widget进行查询 - queryExPOI(text) { - var layer = this.graphicLayer; - - this.exWidget.strartQueryPOI(text, layer, () => { - this.strartQueryPOI(text, false); - }); - } - } - - //注册到widget管理器中。 - window.queryGaodePOIWidget = mars3d.widget.bindClass(MyWidget); - - //每个widet之间都是直接引入到index.html中,会存在彼此命名冲突,所以闭包处理下。 -})(window, mars3d); diff --git a/src/utils/throttle.js b/src/utils/throttle.js new file mode 100644 index 0000000..2e38904 --- /dev/null +++ b/src/utils/throttle.js @@ -0,0 +1,29 @@ +/** + * @desc 函数节流 + * @param func 函数 + * @param wait 延迟执行毫秒数 + * @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发 + */ +export const throttle = (func, wait = 1000, type = 1) => { + let previous = 0; + let timeout; + return function () { + let context = this; + let args = arguments; + if (type === 1) { + let now = Date.now(); + + if (now - previous > wait) { + func.apply(context, args); + previous = now; + } + } else if (type === 2) { + if (!timeout) { + timeout = setTimeout(() => { + timeout = null; + func.apply(context, args) + }, wait) + } + } + } +} diff --git a/src/views/gridman/emphasis/index.vue b/src/views/gridman/emphasis/index.vue index 4b875ca..e1b5684 100644 --- a/src/views/gridman/emphasis/index.vue +++ b/src/views/gridman/emphasis/index.vue @@ -21,7 +21,7 @@
    diff --git a/src/views/gridman/firefighter/index.vue b/src/views/gridman/firefighter/index.vue index 4b875ca..4c95b45 100644 --- a/src/views/gridman/firefighter/index.vue +++ b/src/views/gridman/firefighter/index.vue @@ -21,26 +21,16 @@
    - + - - + - - - - - - - @@ -50,11 +40,8 @@ - - - - - +
    @@ -68,6 +55,7 @@ import extend from "@/extensions/delRows.js" import * as modules from '@/api/modules' import * as login from '@/api/login' + import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' import waves from '@/directive/waves' // 水波纹指令 import permissionBtn from '@/components/PermissionBtn' @@ -103,7 +91,7 @@ pageSize: 20, name: null, }, - detailInfo:[] + detailInfo: [] } }, @@ -122,7 +110,7 @@ methods: { add() { this.addServiceVisible = true; - this.detailInfo=[] + this.detailInfo = [] this.titleStr = '添加' }, addSuccess() { @@ -131,7 +119,7 @@ }, del() { var _this = this - if(this.multipleSelection.length != 1){ + if (this.multipleSelection.length != 1) { this.$message({ type: 'info', message: '请选择一条数据进行删除' @@ -143,7 +131,7 @@ cancelButtonText: '取消', type: 'warning' }).then(() => { - postMethodCommon("/Grid/DeleteKeyUser?Id=" + _this.multipleSelection[0].id, {}).then(res => { + postMethodCommon("/FireGrid/DeleteFireFighter?Id=" + _this.multipleSelection[0].id, {}).then(res => { if (res.code == 200) { this.$message({ type: "success", @@ -161,7 +149,7 @@ }, react() { - if(this.multipleSelection.length != 1){ + if (this.multipleSelection.length != 1) { this.$message({ type: 'info', message: '请选择一条数据进行编辑' @@ -234,21 +222,11 @@ }, getList() { this.listLoading = true - getMethodCommon("/Grid/LoadKeyUser", this.listQuery).then(res => { + getMethodCommon("/FireGrid/GetFireFighter", this.listQuery).then(res => { if (res.code == 200) { + console.log(res) this.tableData = res.data - this.tableData.forEach((item, index) => { - switch (item.state) { - case 0: this.tableData[index].state = "未审核"; - break; - case 1: this.tableData[index].state = "审核通过"; - break; - case 2: this.tableData[index].state = "未通过"; - break; - case 3: this.tableData[index].state = "全部"; - break; - } - }) + this.total = res.count this.listLoading = false } @@ -280,9 +258,40 @@ \ No newline at end of file + diff --git a/src/views/home/widget/search.vue b/src/views/home/widget/search.vue new file mode 100644 index 0000000..937edf4 --- /dev/null +++ b/src/views/home/widget/search.vue @@ -0,0 +1,297 @@ + + +