lcw
This commit is contained in:
@ -6,6 +6,7 @@ import { saveAs } from 'file-saver'
|
||||
import { tansParams, blobValidate } from "@/utils/ruoyi";
|
||||
let downloadLoadingInstance;
|
||||
const service = axios.create({
|
||||
withCredentials: true,
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
timeout: 100000
|
||||
});
|
||||
@ -66,6 +67,8 @@ service.interceptors.response.use(
|
||||
error.response.data &&
|
||||
error.response.data.code === 401
|
||||
) {
|
||||
console.log("Xxxxx");
|
||||
|
||||
store.dispatch('user/logout');
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,10 @@ export const setItem = (key, value) => {
|
||||
export const getItem = (key) => {
|
||||
const data = window.localStorage.getItem(key);
|
||||
try {
|
||||
if (typeof data === 'string' && /^\d+$/.test(data) && data.length > 15) {
|
||||
// 如果是长数字字符串,直接返回,不进行 JSON.parse
|
||||
return data;
|
||||
}
|
||||
return JSON.parse(data);
|
||||
} catch (err) {
|
||||
return data;
|
||||
|
||||
@ -90,6 +90,18 @@ export function timeValidate(date, type) {
|
||||
if (type == 'md') {
|
||||
return `${MM}.${dd}`
|
||||
}
|
||||
if (type == 'td') {
|
||||
return `${yyyy}年${MM}月${dd}日`
|
||||
}
|
||||
if (type == 'yd') {
|
||||
return `${yyyy}`
|
||||
}
|
||||
if (type == 'mm') {
|
||||
return `${yyyy}${MM}${dd}${hh}${mm}${ss}`
|
||||
}
|
||||
if (type == 'ydm') {
|
||||
return `${yyyy}年${MM}月${dd}日${hh}时${mm}分${ss}秒`
|
||||
}
|
||||
return `${yyyy}-${MM}-${dd} ${hh}:${mm}:${ss}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user