修复登录问题,修复Generate词云生成 修复热点区域生成
This commit is contained in:
parent
1d1189f6bc
commit
0154a21f7d
|
@ -86,7 +86,6 @@ const getDictBizData = () => {
|
|||
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 => {
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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));
|
||||
},
|
||||
// 移除全部临时缓存
|
||||
|
|
|
@ -35,7 +35,12 @@
|
|||
</el-card>
|
||||
|
||||
<el-card class="box-card" style="margin-top: 3%;">
|
||||
<span>Select a region</span>
|
||||
<span>Select a region <el-switch
|
||||
v-model="state.switch"
|
||||
size="large"
|
||||
active-text="Area"
|
||||
inactive-text="Polygon"
|
||||
/></span>
|
||||
<el-scrollbar wrap-class="list" view-class="view-box" :native="false">
|
||||
<div v-for="(coordinate, i) in state.coordinateList ">
|
||||
<el-row class="coordinateContainer">
|
||||
|
@ -125,6 +130,7 @@ const disabledDate = (time) => {
|
|||
// 初始化数据
|
||||
const map = ref()
|
||||
const state = reactive({
|
||||
switch:true,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
addCoord: false,
|
||||
|
@ -264,19 +270,32 @@ const changeLatLon = (e) => {
|
|||
// 添加坐标点
|
||||
const addCoordinate = () => {
|
||||
state.addCoord = !state.addCoord;
|
||||
if (state.addCoord && state.coordinateList.length <= 2) {
|
||||
map.value.mapOperations.drawRectangle()
|
||||
map.value.mapOperations.on("click", onMapClick)
|
||||
document.getElementsByClassName('coordinateBtn')[0].innerText = 'Stop';
|
||||
}
|
||||
else {
|
||||
map.value.mapOperations.off("click", onMapClick)
|
||||
document.getElementsByClassName('coordinateBtn')[0].innerText = 'Add coordinates';
|
||||
if(state.switch){
|
||||
if (state.addCoord && state.coordinateList.length <= 2) {
|
||||
map.value.mapOperations.drawRectangle()
|
||||
map.value.mapOperations.on("click", onMapClick)
|
||||
document.getElementsByClassName('coordinateBtn')[0].innerText = 'Stop';
|
||||
}
|
||||
else {
|
||||
map.value.mapOperations.off("click", onMapClick)
|
||||
document.getElementsByClassName('coordinateBtn')[0].innerText = 'Add coordinates';
|
||||
}
|
||||
}else{
|
||||
map.value.mapOperations.off("click", onMapClick)
|
||||
map.value.mapOperations.drawPolygon()
|
||||
map.value.mapOperations.drawCreated()
|
||||
}
|
||||
|
||||
}
|
||||
const mapClick = (res) => {
|
||||
map.value.mapOperations.addInteractMarker(res.latlng.lat.toFixed(3), res.latlng.lng.toFixed(3))
|
||||
}
|
||||
// 清空坐标点
|
||||
const clearCoordinate = () => {
|
||||
if(!state.switch){
|
||||
map.value.mapOperations.clearPolygon()
|
||||
return;
|
||||
}
|
||||
state.coordinateList = [];
|
||||
state.startTime = '';
|
||||
state.endTime = '';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<el-input v-model="state.ruleForm.areaEn" placeholder="please enter area en" style="width: 300px"/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="frequency" label="frequency">
|
||||
<el-input v-model="state.ruleForm.frequency" placeholder="please enter frequency" style="width: 300px"/>
|
||||
<el-input v-model="state.ruleForm.frequency" placeholder="please enter frequency" style="width: 300px" type="number"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
|
|
@ -259,18 +259,18 @@ const generateData = () => {
|
|||
}
|
||||
//记录爬虫信息
|
||||
submit(
|
||||
{
|
||||
[{
|
||||
type: 8,
|
||||
manageId: userInfo.userInfos.id,
|
||||
status: 0,
|
||||
disasterId: state.disasterId,
|
||||
keywords: 'word clouds',
|
||||
}
|
||||
}]
|
||||
).then(ret => {
|
||||
if (ret == 1042) {
|
||||
ElMessage.error("error")
|
||||
} else {
|
||||
landsat(ret.disasterId, 30, ret.id).then(res => {
|
||||
landsat(ret[0].disasterId, 30, ret[0].id).then(res => {
|
||||
getTableData;
|
||||
ElMessage.success("success")
|
||||
})
|
||||
|
|
|
@ -125,7 +125,7 @@ const onSignIn = () => {
|
|||
code: state.ruleForm.code,
|
||||
grantType: state.captchaMode ? "captcha" : "password"
|
||||
}).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);
|
||||
if (themeConfig.value.isRequestRoutes) {
|
||||
|
|
Loading…
Reference in New Issue