mirror of
https://github.com/jekip/naive-ui-admin.git
synced 2026-02-04 13:42:27 +08:00
fix bug
This commit is contained in:
@@ -171,7 +171,7 @@
|
||||
useColumns(getProps);
|
||||
|
||||
const state = reactive({
|
||||
tableSize: 'medium',
|
||||
tableSize: unref(getProps as any).size || 'medium',
|
||||
isColumnSetting: false,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const ACCESS_TOKEN = 'Access-Token'; // 用户token
|
||||
export const CURRENT_USER = 'Current-User'; // 当前用户信息
|
||||
export const IS_LOCKSCREEN = 'Is-Lockscreen'; // 是否锁屏
|
||||
export const TABS_ROUTES = 'Tabs-Routes'; // 标签页
|
||||
export const ACCESS_TOKEN = 'ACCESS-TOKEN'; // 用户token
|
||||
export const CURRENT_USER = 'CURRENT-USER'; // 当前用户信息
|
||||
export const IS_LOCKSCREEN = 'IS-LOCKSCREEN'; // 是否锁屏
|
||||
export const TABS_ROUTES = 'TABS-ROUTES'; // 标签页
|
||||
|
||||
@@ -5,6 +5,7 @@ import axios, { AxiosResponse } from 'axios';
|
||||
import { checkStatus } from './checkStatus';
|
||||
import { joinTimestamp, formatRequestDate } from './helper';
|
||||
import { RequestEnum, ResultEnum, ContentTypeEnum } from '@/enums/httpEnum';
|
||||
import { PageEnum } from '@/enums/pageEnum';
|
||||
|
||||
import { useGlobSetting } from '@/hooks/setting';
|
||||
|
||||
@@ -101,7 +102,8 @@ const transform: AxiosTransform = {
|
||||
|
||||
// 登录超时
|
||||
if (code === ResultEnum.TIMEOUT) {
|
||||
if (router.currentRoute.value.name == 'login') return;
|
||||
const LoginName = PageEnum.BASE_LOGIN_NAME;
|
||||
if (router.currentRoute.value.name == LoginName) return;
|
||||
// 到登录页
|
||||
const timeoutMsg = '登录超时,请重新登录!';
|
||||
Modal.warning({
|
||||
@@ -112,7 +114,7 @@ const transform: AxiosTransform = {
|
||||
onPositiveClick: () => {
|
||||
storage.clear();
|
||||
router.replace({
|
||||
name: 'login',
|
||||
name: LoginName,
|
||||
query: {
|
||||
redirect: router.currentRoute.value.fullPath,
|
||||
},
|
||||
@@ -143,6 +145,7 @@ const transform: AxiosTransform = {
|
||||
config.url = `${apiUrl}${config.url}`;
|
||||
}
|
||||
const params = config.params || {};
|
||||
const data = config.data || false;
|
||||
if (config.method?.toUpperCase() === RequestEnum.GET) {
|
||||
if (!isString(params)) {
|
||||
// 给 get 请求加上时间戳参数,避免从缓存中拿数据。
|
||||
@@ -155,10 +158,18 @@ const transform: AxiosTransform = {
|
||||
} else {
|
||||
if (!isString(params)) {
|
||||
formatDate && formatRequestDate(params);
|
||||
config.data = params;
|
||||
config.params = undefined;
|
||||
if (Reflect.has(config, 'data') && config.data && Object.keys(config.data).length) {
|
||||
config.data = data;
|
||||
config.params = params;
|
||||
} else {
|
||||
config.data = params;
|
||||
config.params = undefined;
|
||||
}
|
||||
if (joinParamsToUrl) {
|
||||
config.url = setObjToUrlParams(config.url as string, config.data);
|
||||
config.url = setObjToUrlParams(
|
||||
config.url as string,
|
||||
Object.assign({}, config.params, config.data)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 兼容restful风格
|
||||
|
||||
Reference in New Issue
Block a user