From 1772c14f47e679fdbd350621e6821e2bbd2078c8 Mon Sep 17 00:00:00 2001 From: SmileXin <13622060635@163.com> Date: Sun, 7 Jul 2024 13:53:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=88=86=E5=89=B2=E7=BA=BF=E3=80=81?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E3=80=81=E5=8A=A0=E5=8F=B7=E3=80=81=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 18 +- src/index.less | 136 ++++++++++- src/pages/BaseMap/LayerData/index.js | 330 ++++++++++++++++++--------- src/pages/BaseMap/index.js | 18 +- 4 files changed, 374 insertions(+), 128 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3d6a630..3c2dc6dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6350,22 +6350,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001441", - "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz", - "integrity": "sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - } - ], - "license": "CC-BY-4.0" - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", @@ -16237,4 +16221,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/index.less b/src/index.less index f465ae2c..eca0a94f 100644 --- a/src/index.less +++ b/src/index.less @@ -147,39 +147,152 @@ body { } .layer-data-title{ width: 100%; - padding: 10px 0; + padding: 25px 0; text-align: center; background-color: #FFFFFF; + font-size: 21px; // 内容不被选中 -webkit-user-select:none;/*谷歌 /Chrome*/ -moz-user-select:none; /*火狐/Firefox*/ -ms-user-select:none; /*IE 10+*/ user-select:none; +} + // 重新加载按钮样式 +.layer-data-wrap .reload{ + margin-left: 15px; + font-size: 15px; + cursor: pointer; } .layer-data-title span { margin: 10px 0; } +.hiddenBtn{ + overflow: hidden; + position: fixed; + height: 40px; + width: 40px; + top: 220px; + margin: 0 0 0 22%; + background: rgb(255, 255, 255); + box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2); + border-radius: 10px; + opacity: 1; + z-index: 99; + text-align: center; + padding-left: 0; + padding-right: 0; + + // 动画 + animation-name: moveBtn; + animation-duration: 1s; + animation-fill-mode: forwards; + animation-play-state: paused; + animation-timing-function: linear; + animation-direction: alternate; + animation-iteration-count: infinite; +} +@keyframes moveBtn{ + from { + // margin-left: 0; + } + 99%{ + // margin-left: 0; + } + to { + margin: 0 0 0 4%; + } + +} .layer-data-wrap { - overflow: hidden; + // overflow: hidden; + overflow-y: auto; + overflow-x: hidden; position: fixed; top: 190px; width: 270px; max-height: 450px; + // min-height: 100px; margin: 2% 4.2%; background: rgba(239,240,248,1); + // background: rgba(239,240,248,0); box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2); border-radius: 10px; opacity: 1; - z-index: 999; + // 禁止换行 + white-space:nowrap; + + z-index: 99; + // 动画 + animation-name: hiddenLayer; + animation-duration: 1s; + animation-fill-mode: forwards; + animation-play-state: paused; + animation-timing-function: linear; + animation-direction: alternate; + animation-iteration-count: infinite; } + @keyframes hiddenLayer{ + from { + } + 99%{ + width: 0px; + } + to { + box-shadow: none; + width: 0px; + } + } + .anticon-double-left { + // 动画 + animation-name: turn; + animation-duration: 1s; + animation-fill-mode: forwards; + animation-play-state: paused; + animation-timing-function: linear; + animation-direction: alternate; + animation-iteration-count: infinite; + } + @keyframes turn{ + from { + // transform: rotate(0deg); + } + 99%{ + // transform: rotate(0deg); + } + to { + transform: rotate(180deg); + } + } + .layer-data-wrap .menu-list{ + // width: 100%; + width: 270px; + + } + + // 隐藏滚轮条 .layer-data-wrap:hover{ - overflow-y: auto !important; - scrollbar-width: none; /* Firefox */ - -ms-overflow-style: none; /* IE 10+ */ + // overflow-y: auto !important; + // scrollbar-width: none; /* Firefox */ + // -ms-overflow-style: none; /* IE 10+ */ } .layer-data-wrap:hover::-webkit-scrollbar { - display: none; /* Safari and Chrome */ + // display: none; /* Safari and Chrome */ } + .layer-name{ + // margin-right: 50%; + } + .add-layer-btn{ + float: right; + width: 20px; + height: 20px; + } + .add-layer-btn-disable{ + cursor: not-allowed; + float: right; + width: 20px; + height: 20px; + } + #add-layer{ width: 100%; text-align: center; @@ -845,4 +958,13 @@ body { } .l7-marker-container2 .l7-popup{ pointer-events: all !important; +} +// 图层列表中横线样式 +.layer-data-wrap .ant-menu-item-divider{ + // display:none; + height: 0.1px !important; + border: none; + margin: auto; + width: 90%; + background-color: #b2bec3 ; } \ No newline at end of file diff --git a/src/pages/BaseMap/LayerData/index.js b/src/pages/BaseMap/LayerData/index.js index 2c11dd1e..b1d1e6b5 100644 --- a/src/pages/BaseMap/LayerData/index.js +++ b/src/pages/BaseMap/LayerData/index.js @@ -1,23 +1,24 @@ import React from 'react'; -import { Tree, Button, Modal, Form, Input, Radio, message, Menu, Divider } from 'antd'; +import { Tree, Button, Modal, Form, Input, Radio, message, Menu, Divider, Tooltip } from 'antd'; import { - DownOutlined, - EyeOutlined, - EyeInvisibleOutlined, - UnderlineOutlined, - UnorderedListOutlined, + DownOutlined, + EyeOutlined, + EyeInvisibleOutlined, + UnorderedListOutlined, + SyncOutlined, + DoubleLeftOutlined, + PlusOutlined, } from '@ant-design/icons'; import SetLogoImagePath from './SetLogoImagePath' import { createLayer, getBasicLayerMenuApi } from '../../../api'; import '../../../index.less'; -import { label } from 'three/examples/jsm/nodes/Nodes.js'; class LayerData extends React.Component { - constructor () { - super (); + constructor() { + super(); this.state = { treeData: [], - menuData:[], //菜单数据 + menuData: [], //菜单数据 layerId: '', isModalOpen: false, addLayer: { @@ -29,31 +30,94 @@ class LayerData extends React.Component { }, selectLayerList: [], selectLayerIdList: [], + layer: null, + btn: null, + icon: null, } } + // 钩子函数 + componentDidMount = () => { + let layer = document.querySelector('.layer-data-wrap'); + let btn = document.querySelector('.hiddenBtn'); + let icon = document.querySelector('.anticon-double-left'); + + // 添加监听事件让其在动画结束后停止(paused状态) + // layer.onanimationiteration = this.paused(layer); + layer.addEventListener('animationiteration', () => { layer.style.animationPlayState = 'paused' }); + btn.addEventListener('animationiteration', () => { btn.style.animationPlayState = 'paused' }); + icon.addEventListener('animationiteration', () => { icon.style.animationPlayState = 'paused' }); + // layer.addEventListener('animationstart',paused(layer)); + // btn.addEventListener('animationstart',paused(btn)); + // icon.addEventListener('animationstart',paused(icon)); + + this.setState({ + layer: layer, + btn: btn, + icon: icon, + }) + } + // 获取基础图层菜单栏,获取列表数据 getBasicLayerMenu = (adcode) => { - return getBasicLayerMenuApi({adcode: adcode}).then((e) => { + return getBasicLayerMenuApi({ adcode: adcode }).then((e) => { let basicLayeData = e.data; + console.log('basicLayeData', basicLayeData); // MenuData let menuDataList = []; for (var m in basicLayeData) { + let lab = null; + // if (basicLayeData[m].esIndex == "personal_point_layer") + if (m == 0){ + lab = <> +