From 34ef7c42a6d6fcc721240320ca9b3d1c4d204ff3 Mon Sep 17 00:00:00 2001
From: SmileXin <13622060635@163.com>
Date: Fri, 7 Feb 2025 23:18:05 +0800
Subject: [PATCH] token
---
package.json | 6 +-
src/app.ts | 2 +-
src/index.less | 16 +-
src/pages/BaseMap/LayerData/index.js | 2 +-
src/pages/BaseMap/index.js | 355 ++++++++++++++-------------
5 files changed, 205 insertions(+), 176 deletions(-)
diff --git a/package.json b/package.json
index ea3fd373..d307b892 100644
--- a/package.json
+++ b/package.json
@@ -51,5 +51,9 @@
"post-merge": "post-npm-install",
"post-rebase": "post-npm-install"
}
- }
+ },
+ "name": "bmw",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT"
}
diff --git a/src/app.ts b/src/app.ts
index 271f531f..0cbb7b39 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -25,7 +25,7 @@ import { RequestConfig } from '@umijs/max';
export const request: RequestConfig = {
requestInterceptors: [
(url, options) => {
- const token = localStorage.getItem('authToken'); // 从某处获取你的认证token,例如localStorage
+ const token = localStorage.getItem('pc-key'); // 从某处获取你的认证token,例如localStorage
if (token) {
const headers = {
Authorization: `${token}`,
diff --git a/src/index.less b/src/index.less
index eca0a94f..92abc6f2 100644
--- a/src/index.less
+++ b/src/index.less
@@ -168,11 +168,10 @@ body {
}
.hiddenBtn{
overflow: hidden;
- position: fixed;
+ position: absolute;
height: 40px;
width: 40px;
- top: 220px;
- margin: 0 0 0 22%;
+ margin: 20% 21.4%;
background: rgb(255, 255, 255);
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
border-radius: 10px;
@@ -199,7 +198,7 @@ body {
// margin-left: 0;
}
to {
- margin: 0 0 0 4%;
+ margin: 20% 5%;
}
}
@@ -207,12 +206,13 @@ body {
// overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
- position: fixed;
- top: 190px;
- width: 270px;
+ position: absolute;
+ // top: 190px;
+ width: 16.4%;
+ // width: 270px;
max-height: 450px;
// min-height: 100px;
- margin: 2% 4.2%;
+ margin: 20% 5%;
background: rgba(239,240,248,1);
// background: rgba(239,240,248,0);
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
diff --git a/src/pages/BaseMap/LayerData/index.js b/src/pages/BaseMap/LayerData/index.js
index e5b2fee5..7e270870 100644
--- a/src/pages/BaseMap/LayerData/index.js
+++ b/src/pages/BaseMap/LayerData/index.js
@@ -68,7 +68,7 @@ class LayerData extends React.Component {
}
return getBasicLayerMenuApi({ adcode: adcode }).then((e) => {
let basicLayeData = e.data;
- console.log('basicLayeData', basicLayeData);
+ console.log('basicLayeData', e);
// MenuData
let menuDataList = [];
for (var m in basicLayeData) {
diff --git a/src/pages/BaseMap/index.js b/src/pages/BaseMap/index.js
index 9877d837..8b55a6f0 100644
--- a/src/pages/BaseMap/index.js
+++ b/src/pages/BaseMap/index.js
@@ -1,6 +1,6 @@
import React from 'react';
import { Select, Input, Card, Col, Row, Button, message, Modal, Spin, Form, Alert, Space } from 'antd';
-import {DoubleLeftOutlined, ExclamationCircleFilled } from '@ant-design/icons';
+import { DoubleLeftOutlined, ExclamationCircleFilled } from '@ant-design/icons';
import LayerData from './LayerData';
// import LayerList from './LayerList';
import { AimOutlined, DoubleRightOutlined } from '@ant-design/icons';
@@ -8,7 +8,7 @@ import Header from '../../components/Header/index.js';
import { createPoint, updatePoint, getDetailByIdApi, queryUserLayers, getLayerPointsApi, getAllProvinceApi, getCityByProvinceApi, getDistrictByCityApi, getLayerShapesApi, getPointByAddressApi, deletePoint } from '../../api';
import Pop from './pop'
-import { GaodeMap ,Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup, MouseLocation, CanvasLayer } from '@antv/l7';
+import { GaodeMap, Scene, Heatmap, PolygonLayer, Marker, MarkerLayer, Popup, MouseLocation, CanvasLayer } from '@antv/l7';
const { confirm } = Modal;
// import { DrawPoint, DrawEvent } from '@antv/l7-draw';
import icon04 from '../../assets/icon/icon04.svg'
@@ -34,9 +34,9 @@ const successSearchAddress = () => {
message.success('已成功进行地图定位');
};
-class BaseMap extends React.Component{
+class BaseMap extends React.Component {
- constructor(){
+ constructor() {
super();
this.state = {
map: null,
@@ -48,10 +48,10 @@ class BaseMap extends React.Component{
provinceAdcode: '',//选中的省
provinceLabel: '',//选中的省
cityList: [],//市
- cityAdcode:'',//选中的市
+ cityAdcode: '',//选中的市
cityLabel: '',
districtList: [],//区
- districtAdcode:'',//选中的区
+ districtAdcode: '',//选中的区
zoom: 4,
inputExplainKey: 0,
inputExplainValue: "请输入地址详情信息",
@@ -64,10 +64,10 @@ class BaseMap extends React.Component{
editPointId: '',
selectLayerList: [],
pointAdd: {},
- pointEdit:{},
+ pointEdit: {},
pointDrawer: null,
newPointLocation: '',
- mouseLocation:{},
+ mouseLocation: {},
disabled: false,
popParameter: {},
isAlertOpen: false,
@@ -90,7 +90,7 @@ class BaseMap extends React.Component{
componentDidMount = () => {
this.getAllProvince();
this.createMap();
- }
+ }
// 创建地图
createMap = () => {
const scene = new Scene({
@@ -98,17 +98,40 @@ class BaseMap extends React.Component{
map: new GaodeMap({
pitch: 20,
style: 'light',
- center: [ 118.405285, 39.904989 ],
+ center: [118.405285, 39.904989],
zoom: 3,
})
});
this.setState({
map: scene,
});
+ // 地图搜索提示功能
+ // scene.on('loaded', () => {
+ // // AutoComplete 插件
+ // window.AMap.plugin(['AMap.Autocomplete'], () => {
+ // // Autocomplete 实例配置
+ // const autoOptions = {
+ // city: '全国', //城市,默认全国
+ // input: 'tipinput' //使用联想输入的input的id
+ // };
+ // // 创建Autocomplete对象
+ // const autoComplete = new AMap.AutoComplete(autoOptions);
+ // });
+
+ // // scene.map.plugin(['AMap.Autocomplete'], () => {
+ // // // Autocomplete 实例配置
+ // // const autoOptions = {
+ // // city: '全国', //城市,默认全国
+ // // input: 'tipinput' //使用联想输入的input的id
+ // // };
+ // // // 创建Autocomplete对象
+ // // const autoComplete = new AMap.autoComplete(autoOptions);
+ // // });
+ // })
}
- //设置地图省份级别位置
- gotoProvince = (data) => {
+ //设置地图省份级别位置
+ gotoProvince = (data) => {
let zoom = data.zoom || 6;
let lng = data.len || 116.405285;
let lat = data.lat || 39.904989;
@@ -141,7 +164,7 @@ class BaseMap extends React.Component{
});
if (nodeType === 1) {
// 在地图上添加点位
- console.log("layerPointsData",layerPointsData)
+ console.log("layerPointsData", layerPointsData)
this.setMarkers(layerPointsData, layerId);
} else if (nodeType === 4) {
// this.setHeatMap(layerPointsData, layerId);
@@ -160,7 +183,7 @@ class BaseMap extends React.Component{
self.hideHeatMap(layerId);
}
}
- // 隐藏热力图
+ // 隐藏热力图
hideHeatMap = (layerId) => {
let heatMapList = this.state.heatMapList
for (let i = 0; i < heatMapList.length; i++) {
@@ -174,7 +197,7 @@ class BaseMap extends React.Component{
let self = this;
let map = this.state.map;
let LabelsData = data || [];
- let markerLayer = new MarkerLayer({name: layerId});
+ let markerLayer = new MarkerLayer({ name: layerId });
let el, popup, marker, icon, popHtml;
// 设置地图上的点位(图标)
for (let i = 0; i < LabelsData.length; i++) {
@@ -183,7 +206,7 @@ class BaseMap extends React.Component{
el.style.height = '26px';
el.id = 'marker' + i;
icon = LabelsData[0].logoImage;
- if (icon && (icon.substr(0, 7) == "http://" || icon.substr(0, 6) == "https:" || icon.substr(0, 7) == "http:\\\\")) {
+ if (icon && (icon.substr(0, 7) == "http://" || icon.substr(0, 6) == "https:" || icon.substr(0, 7) == "http:\\\\")) {
el.style.background = 'url("' + icon + '") no-repeat';
el.style.backgroundSize = 'cover';
} else {
@@ -191,20 +214,20 @@ class BaseMap extends React.Component{
}
marker = new Marker({
element: el,
- }).setLnglat({lng: LabelsData[i].lng, lat: LabelsData[i].lat})
+ }).setLnglat({ lng: LabelsData[i].lng, lat: LabelsData[i].lat })
// 设置弹框(点击事件)
marker.on('click', (e) => {
// 获取弹框内的html
- this.setState({popParameter: LabelsData[i]},() => {
+ this.setState({ popParameter: LabelsData[i] }, () => {
popHtml = document.getElementById('custom-pop');
popup = new Popup({
offsets: [0, 30],
closeOnClick: true,
autoClose: true,
})
- .setLnglat(e.lngLat)
- .setHTML(popHtml.innerHTML)
+ .setLnglat(e.lngLat)
+ .setHTML(popHtml.innerHTML)
document.getElementById('marker' + i).style.width = '32px';
document.getElementById('marker' + i).style.height = '32px';
// 给弹框添加事件
@@ -212,7 +235,7 @@ class BaseMap extends React.Component{
document.getElementById('marker' + i).style.width = '26px';
document.getElementById('marker' + i).style.height = '26px';
});
- this.setState({pop: popup})
+ this.setState({ pop: popup })
popup.on('open', () => {
// 编辑按钮
document.getElementsByClassName('edit-button')[0].onclick = () => {
@@ -239,8 +262,8 @@ class BaseMap extends React.Component{
return false;
};
this.setState({
- selectLayerList:selectLayerList,
- pointEdit:
+ selectLayerList: selectLayerList,
+ pointEdit:
{
pointId: LabelsData[i].pointId,
layerId: LabelsData[i].belongLayerId,
@@ -248,7 +271,7 @@ class BaseMap extends React.Component{
// note: LabelsData[i].note,
address: LabelsData[i].address,
},
- isEditModalOpen: true
+ isEditModalOpen: true
})
};
// 删除按钮
@@ -257,10 +280,10 @@ class BaseMap extends React.Component{
icon: