20260426:大屏技术初始化
This commit is contained in:
parent
1586645838
commit
d433c25f7b
1
.gitignore
vendored
1
.gitignore
vendored
@ -44,3 +44,4 @@ own-*
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
/yack-view/package-lock.json
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
# 本地开发文件上传路径(Windows 下 /uploadPath 会解析到 Tomcat Temp 目录,必须用绝对路径)
|
||||
fastbee:
|
||||
profile: D:/uploadPath
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
import axios, { AxiosResponse, AxiosRequestConfig, Axios, AxiosError, InternalAxiosRequestConfig } from 'axios'
|
||||
import { RequestHttpHeaderEnum, ResultEnum, ModuleTypeEnum } from '@/enums/httpEnum'
|
||||
import { ResultEnum } from '@/enums/httpEnum'
|
||||
import { PageEnum, ErrorPageNameMap } from '@/enums/pageEnum'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { axiosPre } from '@/settings/httpSetting'
|
||||
import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d'
|
||||
import { redirectErrorPage, getLocalStorage, routerTurnByName, isPreview, getCookie } from '@/utils'
|
||||
import { redirectErrorPage, routerTurnByName, isPreview, getCookie, clearCookie, clearLocalStorage } from '@/utils'
|
||||
import { fetchAllowList } from './axios.config'
|
||||
import includes from 'lodash/includes'
|
||||
|
||||
@ -58,9 +56,11 @@ axiosInstance.interceptors.response.use(
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
// 登录过期
|
||||
if (code === ResultEnum.TOKEN_OVERDUE) {
|
||||
// 登录过期(886)或未认证(401)— 后端 renderString 固定返回 HTTP 200,code 在 body 中
|
||||
if (code === ResultEnum.TOKEN_OVERDUE || code === 401) {
|
||||
window['$message'].error(window['$t']('http.token_overdue_message'))
|
||||
clearCookie(StorageEnum.ADMIN_TOKEN)
|
||||
clearLocalStorage(StorageEnum.GO_SYSTEM_STORE)
|
||||
routerTurnByName(PageEnum.BASE_LOGIN_NAME)
|
||||
return Promise.resolve(res.data)
|
||||
}
|
||||
|
||||
@ -28,10 +28,10 @@ export function createRouterGuards(router: Router) {
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
if (!routerAllowList.includes(to.name) && !loginCheck()) {
|
||||
next({ name: PageEnum.BASE_LOGIN_NAME })
|
||||
if (!routerAllowList.includes(to.name) && await loginCheck()) {
|
||||
return next({ name: PageEnum.BASE_LOGIN_NAME })
|
||||
}
|
||||
next()
|
||||
return next()
|
||||
})
|
||||
|
||||
router.afterEach((to, _, failure) => {
|
||||
|
||||
@ -23,14 +23,14 @@ export const useDataListInit = () => {
|
||||
// 数据请求
|
||||
const fetchList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await projectListApi({
|
||||
pageNum: paginat.page,
|
||||
pageSize: paginat.limit
|
||||
}) as any
|
||||
if (res.rows) {
|
||||
if (res && res.rows) {
|
||||
const { total } = res
|
||||
paginat.count = total
|
||||
|
||||
list.value = res.rows.map((e: any) => {
|
||||
const { id, projectName, state, createTime, updateTime, indexImage, createBy } = e
|
||||
return {
|
||||
@ -39,17 +39,21 @@ export const useDataListInit = () => {
|
||||
createId: createBy,
|
||||
time: createTime,
|
||||
updateTime: updateTime,
|
||||
image: `${import.meta.env.VITE_GLOB_API_URL}${indexImage}`,
|
||||
// indexImage 为空时传空字符串,触发 n-image 的 fallback-src 显示占位图
|
||||
image: indexImage ? `${import.meta.env.VITE_GLOB_API_URL}${indexImage}` : '',
|
||||
release: state !== 0
|
||||
}
|
||||
})
|
||||
setTimeout(() => {
|
||||
loading.value = false
|
||||
}, 500)
|
||||
return
|
||||
}
|
||||
// 401/认证失败由 axios 拦截器统一处理(跳转登录),此处仅处理其他失败
|
||||
if (res && res.code !== 401) {
|
||||
httpErrorHandle()
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 修改页数
|
||||
const changePage = (_page: number) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user