diff --git a/package-lock.json b/package-lock.json index e30a322..5155afe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3007,6 +3007,14 @@ "resolved": "https://registry.npmmirror.com/leaflet/-/leaflet-1.9.3.tgz", "integrity": "sha512-iB2cR9vAkDOu5l3HAay2obcUHZ7xwUBBjph8+PGtmW/2lYhbLizWtG7nTeYht36WfOslixQF9D/uSIzhZgGMfQ==" }, + "leaflet-control-geocoder": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/leaflet-control-geocoder/-/leaflet-control-geocoder-2.4.0.tgz", + "integrity": "sha512-b2QlxuFd40uIDbnoUI3U9fzfnB4yKUYlmsXjquJ2d2YjoJqnyVYcIJeErAVv3kPvX3nI0gzvBq1XHMgSVFrGkQ==", + "requires": { + "open-location-code": "^1.0.0" + } + }, "leaflet-draw": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/leaflet-draw/-/leaflet-draw-1.0.4.tgz", @@ -3020,6 +3028,14 @@ "leaflet": "^1.0.0" } }, + "leaflet-search": { + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/leaflet-search/-/leaflet-search-2.9.6.tgz", + "integrity": "sha512-ZzZEnjcYmVEXfYq5r2adt47voAtycJlZ3YDjWJXjJuUCWW99sj6IqB5qjNrBC5JALBmSnkOlfSHCaj3jbO1CGg==", + "requires": { + "leaflet": "*" + } + }, "levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -3199,6 +3215,12 @@ "wrappy": "1" } }, + "open-location-code": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/open-location-code/-/open-location-code-1.0.3.tgz", + "integrity": "sha512-DBm14BSn40Ee241n80zIFXIT6+y8Tb0I+jTdosLJ8Sidvr2qONvymwqymVbHV2nS+1gkDZ5eTNpnOIVV0Kn2fw==", + "optional": true + }, "optimist": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", diff --git a/src/api/crawl/index.js b/src/api/crawl/index.js index 7814172..b57ce11 100644 --- a/src/api/crawl/index.js +++ b/src/api/crawl/index.js @@ -24,12 +24,12 @@ export const news = (disaster_id, keywords, page, isBaidu, id) => { }, }); }; -export const twitter = (disaster_id, keys,stime,etime) => { +export const twitter = (disaster_id, keywords,stime,etime,id) => { return request({ - url: '/api/' + twitterModule + 'socialmedia/twitter', + url: '/api/' + twitterModule + '/socialmedia/twitter', method: 'post', data: { - disaster_id, keys,stime,etime + disaster_id, keywords,stime,etime,id }, }); }; diff --git a/src/api/disasterInfo/index.js b/src/api/disasterInfo/index.js index 30b2450..4a6afc1 100644 --- a/src/api/disasterInfo/index.js +++ b/src/api/disasterInfo/index.js @@ -88,3 +88,10 @@ export function responseEndedDisasterInfo(id) { } }); } +export function deleteByIds(ids) { + return request({ + url: '/api/' + moduleName + '/ui/disasterInfo/deleteByIds', + method: 'delete', + data: ids + }); +} diff --git a/src/api/news/index.js b/src/api/news/index.js index ee02d89..d88b152 100644 --- a/src/api/news/index.js +++ b/src/api/news/index.js @@ -32,3 +32,10 @@ export const importTemplate = (data) => { data: data }) } +export const remove = (ids,type) => { + return request({ + url: '/api/'+moduleName+'/ui/'+(type?'news':'socialMedia')+'/deleteByIds', + method: 'delete', + data: ids + }) +} diff --git a/src/api/remoteSensingSourceData/remoteSensingSourceData.js b/src/api/remoteSensingSourceData/remoteSensingSourceData.js index da88526..8ca21bc 100644 --- a/src/api/remoteSensingSourceData/remoteSensingSourceData.js +++ b/src/api/remoteSensingSourceData/remoteSensingSourceData.js @@ -45,4 +45,20 @@ export const importTemplate = (data) => { method: 'post', data: data }); -}; \ No newline at end of file +}; +export const removeList = (ids) => { + return request({ + url: '/api/' + moduleName + '/ui/remoteSensing/remove', + method: 'delte', + data: ids, + }); +} + +export const importTemplateImgList = (data) => { + return request({ + url: '/api/' + moduleName + '/ui/remoteSensing/importTemplateImgList', + headers:{'Content-Type': 'multipart/form-data'}, + method: 'post', + data: data + }); +}; diff --git a/src/api/response/dataUpload.js b/src/api/response/dataUpload.js index 19d1b8c..a50fdd9 100644 --- a/src/api/response/dataUpload.js +++ b/src/api/response/dataUpload.js @@ -50,4 +50,11 @@ export const auditData = (data) => { method: 'post', data: data }); -}; \ No newline at end of file +}; +export const remove = (data) => { + return request({ + url: '/api/' + moduleName + '/ui/dataUpload/remove', + method: 'delete', + data: data + }); +} \ No newline at end of file diff --git a/src/components/Map.vue b/src/components/Map.vue index 550c20f..a922f2a 100644 --- a/src/components/Map.vue +++ b/src/components/Map.vue @@ -105,17 +105,14 @@ const mapOperations = { variableStore.layerGroupPoly = res; let polygons = []; for (let i = 0; i < attr[0].feature.geometry.coordinates.length; i++) { - console.log(attr[0].feature.geometry.coordinates[i]) polygons.push(turf.polygon([attr[0].feature.geometry.coordinates[i]])); } let centers = polygons.map(polygon => turf.centroid(polygon)); - // console.log(centers) let features = [] for (let i = 0; i < centers.length; i++) { features.push(turf.point(centers[i].geometry.coordinates)) } let final_center = turf.center(turf.featureCollection(features)) - // console.log(final_center) homeMap.flyTo([final_center.geometry.coordinates[1], final_center.geometry.coordinates[0]], 3) return { 'layer': layer, 'location': null } } @@ -152,7 +149,6 @@ const mapOperations = { featureLayerG_point ) let features = featureLayerG_point.toGeoJSON().features - // console.log(features) variableStore.layerGroupPoint = features.map(function (feature) { return WKT.convert(feature.geometry) }) @@ -276,7 +272,6 @@ const mapOperations = { */ goPosition: (param) => { homeMap.setView(L.latLng(Number(param.y), Number(param.x)), param.zoom) - // console.log(homeMap); }, /** 监听事件 * Object param 参数集合 @@ -286,7 +281,6 @@ const mapOperations = { * } */ on: (event, func) => { - // console.log("1-1") homeMap.on(event, func) }, /** 事件注销 @@ -297,7 +291,6 @@ const mapOperations = { * } */ off: (event, func) => { - // console.log('2-1') homeMap.off(event, func) }, /** 清除所有图层 @@ -335,7 +328,6 @@ const mapOperations = { * } */ drawPolygon: () => { - // console.log('2-2') variableStore.layerGroupPoint = null featureLayerG_point.clearLayers() homeMap.pm.enableDraw('Polygon', { snappable: false }); @@ -359,7 +351,6 @@ const mapOperations = { return polygon }, clearPolygon: () => { - // console.log('1-2') featureLayerG_area.clearLayers() variableStore.layerGroupPoly = null @@ -378,7 +369,6 @@ const mapOperations = { // }) // featureLayerG_area.addLayer(elll.layer) // let features = featureLayerG_area.toGeoJSON().features - // // console.log(features) // variableStore.layerGroupPoly = features.map(function (feature) { // return WKT.convert(feature.geometry) // }) @@ -414,7 +404,6 @@ const mapOperations = { }); } else { - console.log('error') } }, drawRectangle: () => { diff --git a/src/components/table/DisasterTable.vue b/src/components/table/DisasterTable.vue index 2af37ad..114d64d 100644 --- a/src/components/table/DisasterTable.vue +++ b/src/components/table/DisasterTable.vue @@ -21,10 +21,10 @@ - - - - + + + + { const getDisasterTable = () => { convert(); let userData = Session.get('userInfo'); - console.log(userData,"userDatauserData"); state.search.chiefIdEquals = userData.id; state.search.roleName = userData.roles[0]; getPage(state.disasterData.param.pageNum, state.disasterData.param.pageSize, state.search).then(res => { diff --git a/src/directive/authDirective.js b/src/directive/authDirective.js index b1b2cb1..e288c06 100644 --- a/src/directive/authDirective.js +++ b/src/directive/authDirective.js @@ -15,6 +15,12 @@ export function authDirective(app) { if (!stores.userInfos.authBtnList.some((v) => v === binding.value)) el.parentNode.removeChild(el); }, }); + app.directive('auth-role', { + mounted(el, binding) { + const stores = useUserInfo(); + if (!stores.userInfos.roles.some((v) => v === binding.value)) el.parentNode.removeChild(el); + }, + }); // 多个权限验证,满足一个则显示(v-auths="[xxx,xxx]") app.directive('auths', { mounted(el, binding) { diff --git a/src/layout/navBars/breadcrumb/user.vue b/src/layout/navBars/breadcrumb/user.vue index 2982b2e..47f65c0 100644 --- a/src/layout/navBars/breadcrumb/user.vue +++ b/src/layout/navBars/breadcrumb/user.vue @@ -235,7 +235,7 @@ onMounted(() => { if ((now - dateTime) / 1000 > website.value.tokenTime) { // 刷新token refreshToken(rt, website.value.tenantId).then(res => { - Session.set('token', res.access_token); + Session.setEx('token', res.access_token); Session.set('token-time', new Date().getTime()); Session.set('refresh-token', res.refresh_token); }) diff --git a/src/router/backEnd.js b/src/router/backEnd.js index a4b2ab7..5f0b1e8 100644 --- a/src/router/backEnd.js +++ b/src/router/backEnd.js @@ -36,7 +36,7 @@ export async function initBackEndControlRoutes() { // 界面 loading 动画开始执行 if (window.nextLoading === undefined) NextLoading.start(); // 无 token 停止执行下一步 - if (!Session.get('token')) return false; + if (!Session.getEx('token')) return false; // 触发初始化用户信息 pinia // https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP await useUserInfo().setUserInfos(); diff --git a/src/router/frontEnd.js b/src/router/frontEnd.js index 098898f..e861649 100644 --- a/src/router/frontEnd.js +++ b/src/router/frontEnd.js @@ -21,7 +21,7 @@ export async function initFrontEndControlRoutes() { // 界面 loading 动画开始执行 if (window.nextLoading === undefined) NextLoading.start(); // 无 token 停止执行下一步 - if (!Session.get('token')) return false; + if (!Session.getEx('token')) return false; // 触发初始化用户信息 pinia // https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP await useUserInfo(pinia).setUserInfos(); diff --git a/src/router/index.js b/src/router/index.js index f8c0696..64813a5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -94,7 +94,7 @@ export function formatTwoStageRoutes(arr) { router.beforeEach(async (to, from, next) => { NProgress.configure({ showSpinner: false }); if (to.meta.title) NProgress.start(); - const token = Session.get('token'); + const token = Session.getEx('token'); if (to.path === '/login' && !token) { next(); NProgress.done(); diff --git a/src/stores/userInfo.js b/src/stores/userInfo.js index 9b983ab..417608d 100644 --- a/src/stores/userInfo.js +++ b/src/stores/userInfo.js @@ -28,7 +28,6 @@ export const useUserInfo = defineStore('userInfo', { async Buttons() { return new Promise((resolve) => { getButtons().then(data => { - console.log(data) resolve(this.formatBtns(data)); }) }) diff --git a/src/utils/request.js b/src/utils/request.js index ec0f205..46a61b6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -22,8 +22,8 @@ service.interceptors.request.use( (config) => { config.headers['Authorization'] = 'Basic Vm9SRE1BZG1pbjp2b3JkbV9hZG1pbl9zZWNyZXQ='; // 在发送请求之前做些什么 token - if (Session.get('token')) { - config.headers['Blade-Auth'] = `Bearer ${Session.get('token')}`; + if (Session.getEx('token')) { + config.headers['Blade-Auth'] = `Bearer ${Session.getEx('token')}`; } return config; }, diff --git a/src/utils/storage.js b/src/utils/storage.js index bcba5dc..a4ac8bb 100644 --- a/src/utils/storage.js +++ b/src/utils/storage.js @@ -42,18 +42,38 @@ export const Local = { export const Session = { // 设置临时缓存 set(key, val) { - if (key === 'token') return Cookies.set(key, val); + // if (key === 'token') return Cookies.set(key, val); window.sessionStorage.setItem(Local.setKey(key), JSON.stringify(val)); }, // 获取临时缓存 get(key) { - if (key === 'token') return Cookies.get(key); + // if (key === 'token') return Cookies.get(key); let json = window.sessionStorage.getItem(Local.setKey(key)); return JSON.parse(json); + }, + // 设置临时缓存 + setEx(key,val) { + let curTime = new Date().getTime(); + window.sessionStorage.setItem(Local.setKey(key), JSON.stringify({data:val,time:curTime})); + }, + //如果缓存过期则返回null + getEx(key,time = 6*60*1000) { + let data = window.sessionStorage.getItem(Local.setKey(key)); + let dataObj = JSON.parse(data); + //如果dataObj为null,表示该数据从未设置过期时间 + if (dataObj == null) { + return null; + } + if (new Date().getTime() - dataObj.time > time) { + window.sessionStorage.removeItem(Local.setKey(key)); + return null; + } else { + return dataObj.data; + } }, // 移除临时缓存 remove(key) { - if (key === 'token') return Cookies.remove(key); + // if (key === 'token') return Cookies.remove(key); window.sessionStorage.removeItem(Local.setKey(key)); }, // 移除全部临时缓存 diff --git a/src/views/dataService/multimediaData/component/boot.vue b/src/views/dataService/multimediaData/component/boot.vue index ac50b4e..c4100d8 100644 --- a/src/views/dataService/multimediaData/component/boot.vue +++ b/src/views/dataService/multimediaData/component/boot.vue @@ -160,7 +160,7 @@ + + \ No newline at end of file diff --git a/src/views/dataService/visualData/component/editHotspotForm.vue b/src/views/dataService/visualData/component/editHotspotForm.vue index 81c5f6b..58a7bb8 100644 --- a/src/views/dataService/visualData/component/editHotspotForm.vue +++ b/src/views/dataService/visualData/component/editHotspotForm.vue @@ -62,7 +62,6 @@ const uploadPic = (data) => { //移除时 const removePic = (data) => { state.fileArray.splice(state.fileArray.findIndex(item=>item.uid===data.raw.uid), 1) - console.log(state.fileArray) } //校验规则 const rules = reactive({ diff --git a/src/views/dataService/visualData/component/editWordCloudForm.vue b/src/views/dataService/visualData/component/editWordCloudForm.vue index 1dfa173..5d4bfa0 100644 --- a/src/views/dataService/visualData/component/editWordCloudForm.vue +++ b/src/views/dataService/visualData/component/editWordCloudForm.vue @@ -68,7 +68,6 @@ const uploadPic = (data) => { //移除时 const removePic = (data) => { state.fileArray.splice(state.fileArray.findIndex(item=>item.uid===data.raw.uid), 1) - console.log(state.fileArray) } //校验规则 const rules = reactive({ diff --git a/src/views/dataService/visualData/component/hotspotForm.vue b/src/views/dataService/visualData/component/hotspotForm.vue index 5f451b5..2d6889f 100644 --- a/src/views/dataService/visualData/component/hotspotForm.vue +++ b/src/views/dataService/visualData/component/hotspotForm.vue @@ -8,7 +8,7 @@ - +