1.修复矿建鉴权报错
2.优化登录跳转接口 3.优化登录跳转接口 4.修复CURD生成代码模块表不加前缀访问返回404问题 5.系统级报错***优化报错Fatal error: Type of app\common\library\token\TokenExpirationException::$message
This commit is contained in:
@@ -100,6 +100,16 @@ export const useTerminal = defineStore(
|
||||
}
|
||||
|
||||
function addTask(command: string, blockOnFailure = true, extend = '', callback: Function = () => {}) {
|
||||
const duplicatePending = state.taskList.some(
|
||||
(item) =>
|
||||
item.command === command &&
|
||||
(item.status === taskStatus.Waiting ||
|
||||
item.status === taskStatus.Connecting ||
|
||||
item.status === taskStatus.Executing)
|
||||
)
|
||||
if (duplicatePending) {
|
||||
return
|
||||
}
|
||||
if (!state.show) toggleDot(true)
|
||||
state.taskList = state.taskList.concat({
|
||||
uuid: uuid(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { AxiosRequestConfig, Method } from 'axios'
|
||||
import axios from 'axios'
|
||||
import { ElLoading, ElNotification, type LoadingOptions } from 'element-plus'
|
||||
import { nextTick } from 'vue'
|
||||
import { refreshToken } from '/@/api/common'
|
||||
import { i18n } from '/@/lang/index'
|
||||
import router from '/@/router/index'
|
||||
@@ -20,6 +21,12 @@ const loadingInstance: LoadingInstance = {
|
||||
count: 0,
|
||||
}
|
||||
|
||||
/** 请求是否后台 /admin/ 接口(不依赖当前路由,避免 loading 等场景误判为前台) */
|
||||
function isAdminBackendRequest(config: AxiosRequestConfig): boolean {
|
||||
const u = `${config.baseURL ?? ''}${config.url ?? ''}`
|
||||
return /\/admin\//i.test(u)
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运行环境获取基础请求URL
|
||||
*/
|
||||
@@ -112,6 +119,22 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
|
||||
|
||||
if (response.config.responseType == 'json') {
|
||||
if (response.data && response.data.code !== 1) {
|
||||
const needLogin = response.data.data && typeof response.data.data === 'object' && response.data.data.type === 'need login'
|
||||
if (needLogin) {
|
||||
const isAdminAppFlag = isAdminApp() || isAdminBackendRequest(response.config)
|
||||
if (isAdminAppFlag) {
|
||||
adminInfo.removeToken()
|
||||
} else {
|
||||
userInfo.removeToken()
|
||||
}
|
||||
const loginRouteName = isAdminAppFlag ? 'adminLogin' : 'userLogin'
|
||||
if (router.currentRoute.value.name !== loginRouteName) {
|
||||
nextTick(() => {
|
||||
void router.replace({ name: loginRouteName })
|
||||
})
|
||||
}
|
||||
return Promise.reject(response.data)
|
||||
}
|
||||
if (response.data.code == 409) {
|
||||
if (!window.tokenRefreshing) {
|
||||
window.tokenRefreshing = true
|
||||
|
||||
Reference in New Issue
Block a user