token存储换localStorage、baseURL换网址截取、异常接口取消调用、高德切片换内网扒下的切片图片、

Lvtianfang
吕天方 3 months ago
parent 6f5f121d23
commit b90d3ec072

@ -6,7 +6,7 @@ ENV = 'development'
# 若依管理系统/开发环境
# VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = 'http://192.168.0.107:9102/api'
VUE_APP_BASE_API = 'http://192.168.0.108:9102/api'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

@ -1,5 +1,5 @@
.L-ultimately-container {
margin: 20px;
// margin: 20px;
background-color: #fff;
border-radius: 5px;
height: calc(100% - 40px);

@ -27,31 +27,31 @@ export default {
}
},
watch:{
$route:{
handler(route){
let timeOne;
let timeTwo;
if(route.meta.title == '算法运行监测') {
this.isTrue = true;
this.getGetErrorMsg();
//
timeOne = setInterval(()=>{
this.getGetErrorMsg();
},3600000)
clearInterval(timeTwo)
} else {
clearInterval(timeTwo)
this.isTrue = false;
this.getLimitOneMsg();
//
timeTwo = setInterval(()=>{
this.getLimitOneMsg();
},60000)
clearInterval(timeOne)
}
},
immediate:true,
}
// $route:{
// handler(route){
// let timeOne;
// let timeTwo;
// if(route.meta.title == '') {
// this.isTrue = true;
// this.getGetErrorMsg();
// //
// timeOne = setInterval(()=>{
// this.getGetErrorMsg();
// },3600000)
// clearInterval(timeTwo)
// } else {
// clearInterval(timeTwo)
// this.isTrue = false;
// this.getLimitOneMsg();
// //
// timeTwo = setInterval(()=>{
// this.getLimitOneMsg();
// },60000)
// clearInterval(timeOne)
// }
// },
// immediate:true,
// }
},
methods:{
//

@ -11,7 +11,18 @@ NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register']
router.beforeEach((to, from, next) => {
NProgress.start()
NProgress.start();
// console.log("1111");
// if(window.location.href.includes("cyToken=") && window.location.href.includes("userName=")) {
// var regOne = new RegExp(/[?&]cyToken=([^&#]+)/);
// var regTwo = new RegExp(/[?&]userName=([^&#]+)/);
// const queryOne = window.location.href.match(regOne);
// const queryTwo = window.location.href.match(regTwo);
// const cyToken = queryOne && queryOne[1];
// const userName = queryTwo && queryTwo[1];
// // console.log(cyToken,"cyToken");
// // console.log(userName,"userName");
// }
next();
NProgress.done()
// if (getToken()) {

@ -149,7 +149,9 @@ L.TileLayer.ChinaProvider.providers = {
GaoDe: {
Normal: {
// Map: 'https://webst0{s}.is.autonavi.com/appmaptile?style=7&x={x}&y={y}&z={z}' //高清
Map: '//webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}'
// Map: '//webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}'
// http://202.102.20.34:9001
Map: location.origin + '/map/{z}/{x}/{y}.png'
},
Satellite: {
Map: 'https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',

@ -16,6 +16,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.NODE_ENV === "production" ? location.origin + '/api' : process.env.VUE_APP_BASE_API,
// baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
})
@ -26,8 +27,11 @@ service.interceptors.request.use(config => {
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// if (getToken() && !isToken) {
// config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
// }
if (localStorage.getItem('Admin-Token') && !isToken) {
config.headers['Authorization'] = 'Bearer ' + localStorage.getItem('Admin-Token') // 让每个请求携带自定义token 请根据实际情况自行修改
}
// get请求映射params参数
if (config.method === 'get' && config.params) {

@ -303,7 +303,7 @@ export default {
zoomControl: false,
});
this.basemap = L.tileLayer.chinaProvider("GaoDe.Normal.Map", {
maxZoom: 18,
maxZoom: 14,
minZoom: 5,
});
this.map.addLayer(this.basemap);

@ -93,7 +93,8 @@ export default {
},
mounted() {
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -135,6 +135,7 @@ export default {
eventList:[],
map:null,
basemap:null,
layerVectorLabel: null,
loading:false,
mapLoading:false,
mapLayers: {
@ -150,7 +151,8 @@ export default {
},
mounted() {
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
// setToken(res.token)
this.$nextTick(() => {
this.initMap();
});
@ -183,10 +185,28 @@ export default {
zoomControl: false,
});
this.basemap = L.tileLayer.chinaProvider("GaoDe.Normal.Map", {
maxZoom: 18,
maxZoom: 14,
minZoom: 5,
});
// this.basemap = L.tileLayer(
// 'https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=e64b3084dbc6333293d73a1e7b39463e',
// {
// maxZoom: 18,
// minZoom: 9,
// subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
// }
// )
// /
// this.layerVectorLabel = L.tileLayer(
// 'https://t{s}.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=e64b3084dbc6333293d73a1e7b39463e',
// {
// maxZoom: 18,
// minZoom: 9,
// subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
// }
// )
this.map.addLayer(this.basemap);
// this.map.addLayer(this.layerVectorLabel)
this.map.createPane("mapLayer1");
this.map.getPane("mapLayer1").style.zIndex = 501;

@ -120,7 +120,8 @@ export default {
},
mounted(){
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -120,7 +120,8 @@ export default {
},
mounted(){
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -122,7 +122,8 @@ export default {
},
mounted(){
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -120,7 +120,8 @@ export default {
},
mounted(){
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -120,7 +120,8 @@ export default {
},
mounted(){
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -112,7 +112,8 @@ export default {
},
mounted(){
login("admin",encrypt("Suanfa@2024//**...")).then(res=>{
setToken(res.token)
// setToken(res.token)
localStorage.setItem('Admin-Token',res.token)
this.getList();
this.cancalDebounce();
window.addEventListener('resize', this.cancalDebounce);

@ -18,7 +18,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)

Loading…
Cancel
Save