😎前端文件格式化
This commit is contained in:
parent
71236007ee
commit
e6049c66fb
1
Web/src/types/pinia.d.ts
vendored
1
Web/src/types/pinia.d.ts
vendored
@ -46,7 +46,6 @@ declare interface RoutesListState<T = any> {
|
|||||||
// 布局配置
|
// 布局配置
|
||||||
declare interface ThemeConfigState {
|
declare interface ThemeConfigState {
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
serverTime?: Date; // 服务器时间
|
|
||||||
isDrawer: boolean; // 是否开启抽屉配置
|
isDrawer: boolean; // 是否开启抽屉配置
|
||||||
primary: string; // 主题颜色
|
primary: string; // 主题颜色
|
||||||
topBar: string; // 顶部栏背景
|
topBar: string; // 顶部栏背景
|
||||||
|
|||||||
@ -11,11 +11,6 @@ import { BaseAPI, BASE_PATH } from '../api-services/system/base';
|
|||||||
|
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { Local, Session } from '../utils/storage';
|
import { Local, Session } from '../utils/storage';
|
||||||
import { useThemeConfig } from '/@/stores/themeConfig';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
|
|
||||||
const storesThemeConfig = useThemeConfig();
|
|
||||||
const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
||||||
|
|
||||||
// 接口服务器配置
|
// 接口服务器配置
|
||||||
export const serveConfig = new Configuration({
|
export const serveConfig = new Configuration({
|
||||||
@ -71,7 +66,7 @@ axiosInstance.interceptors.request.use(
|
|||||||
const exp = getJWTDate(jwt.exp as number);
|
const exp = getJWTDate(jwt.exp as number);
|
||||||
|
|
||||||
// token 已经过期
|
// token 已经过期
|
||||||
if (themeConfig.value.serverTime && themeConfig.value.serverTime >= exp) {
|
if (new Date() >= exp) {
|
||||||
// 获取刷新 token
|
// 获取刷新 token
|
||||||
const refreshAccessToken = Local.get(refreshAccessTokenKey);
|
const refreshAccessToken = Local.get(refreshAccessTokenKey);
|
||||||
|
|
||||||
@ -108,9 +103,6 @@ axiosInstance.interceptors.request.use(
|
|||||||
// axios 响应拦截
|
// axios 响应拦截
|
||||||
axiosInstance.interceptors.response.use(
|
axiosInstance.interceptors.response.use(
|
||||||
(res) => {
|
(res) => {
|
||||||
// 记录服务器时间
|
|
||||||
themeConfig.value.serverTime = res.data.time ? new Date(res.data.time) : undefined;
|
|
||||||
|
|
||||||
// 获取状态码和返回数据
|
// 获取状态码和返回数据
|
||||||
var status = res.status;
|
var status = res.status;
|
||||||
var serve = res.data;
|
var serve = res.data;
|
||||||
|
|||||||
@ -65,8 +65,6 @@ export async function loadSysInfo(tenantid: number) {
|
|||||||
themeConfig.value.onlineNotice = data.onlineNotice;
|
themeConfig.value.onlineNotice = data.onlineNotice;
|
||||||
// 密码加解密公匙
|
// 密码加解密公匙
|
||||||
window.__env__.VITE_SM_PUBLIC_KEY = data.publicKey;
|
window.__env__.VITE_SM_PUBLIC_KEY = data.publicKey;
|
||||||
// 服务器时间
|
|
||||||
themeConfig.value.serverTime = res.data.time ? new Date(Date.parse(res.data.time as any)) : undefined;
|
|
||||||
|
|
||||||
// 更新 favicon
|
// 更新 favicon
|
||||||
updateFavicon(data.logo);
|
updateFavicon(data.logo);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user