From 13cabad76a2886ff0934619c357aca4b2cc34d74 Mon Sep 17 00:00:00 2001 From: luoer Date: Fri, 12 Jan 2024 14:56:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/interceptors/auth.ts | 7 +++-- src/libs/dayjs/index.ts | 13 ++++----- src/pages/_layout/UserDropdown.vue | 2 +- src/pages/_layout/index.vue | 44 +++++++++++++++--------------- src/pages/_login/index.vue | 31 +++++++++++---------- src/pages/home/index.vue | 5 ++-- src/pages/system/role/index.vue | 2 +- src/router/guards/auth.ts | 3 +- src/router/guards/progress.ts | 2 +- src/router/guards/title.ts | 3 +- src/store/index.ts | 2 -- src/styles/css-arco.less | 6 +++- 12 files changed, 62 insertions(+), 58 deletions(-) diff --git a/src/api/interceptors/auth.ts b/src/api/interceptors/auth.ts index 9af5bf4..f433c10 100644 --- a/src/api/interceptors/auth.ts +++ b/src/api/interceptors/auth.ts @@ -1,12 +1,13 @@ -import { store, useUserStore } from "@/store"; -import { AxiosInstance } from "axios"; +import { store } from '@/store'; +import { useUserStore } from '@/store/user'; +import { AxiosInstance } from 'axios'; /** * 登陆令牌拦截器 * @param axios Axios实例 */ export function addAuthInterceptor(axios: AxiosInstance) { - axios.interceptors.request.use((config) => { + axios.interceptors.request.use(config => { const userStore = useUserStore(store); if (userStore.accessToken) { config.headers.Authorization = `Bearer ${userStore.accessToken}`; diff --git a/src/libs/dayjs/index.ts b/src/libs/dayjs/index.ts index e73da4a..accf608 100644 --- a/src/libs/dayjs/index.ts +++ b/src/libs/dayjs/index.ts @@ -39,17 +39,17 @@ dayjs.extend(localData); /** * 默认时间格式 */ -dayjs.DATETIME = DATETIME; +dayjs.DATETIME = 'YYYY-MM-DD HH:mm'; /** * 默认日期格式 */ -dayjs.DATE = DATE; +dayjs.DATE = 'YYYY-MM-DD'; /** * 默认时间格式 */ -dayjs.TIME = TIME; +dayjs.TIME = 'HH:mm:ss'; /** * 保留原方法 @@ -59,11 +59,8 @@ dayjs.prototype._format = dayjs.prototype.format; /** * 重写,设置默认时间格式 */ -dayjs.prototype.format = function (format?: string) { - if (format) { - return this._format(format); - } - return this._format(dayjs.DATETIME); +dayjs.prototype.format = function (format: string = dayjs.DATETIME) { + return this._format(format); }; export { DATE, DATETIME, TIME, dayjs }; diff --git a/src/pages/_layout/UserDropdown.vue b/src/pages/_layout/UserDropdown.vue index b9cbab8..3be3592 100644 --- a/src/pages/_layout/UserDropdown.vue +++ b/src/pages/_layout/UserDropdown.vue @@ -62,7 +62,7 @@ @@ -209,8 +210,7 @@ const buttons = [ "name": "LayoutPage", "sort": 101, "title": "首页", - "icon": "icon-park-outline-home", - "keepAlive": true + "icon": "icon-park-outline-home" } } diff --git a/src/pages/_login/index.vue b/src/pages/_login/index.vue index 7cb700f..cc714a7 100644 --- a/src/pages/_login/index.vue +++ b/src/pages/_login/index.vue @@ -42,7 +42,7 @@ 忘记密码? - {{ loading ? "登陆中" : "立即登录" }} + {{ loading ? '登陆中' : '立即登录' }}

暂不支持其他方式登录

@@ -55,18 +55,19 @@