From 056c694a926d9643bf9f533b914fd7064fc26b81 Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Thu, 27 Apr 2023 17:57:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Diot=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E7=99=BB=E5=BD=95=E5=8F=AF=E8=A7=86=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 优化oauth页面 * fix: 修复iot账号无法登录可视化 --- config/config.ts | 2 +- src/router/index.ts | 7 +-- src/utils/request.ts | 19 +++++-- src/views/oauth/index.vue | 111 ++++++++++++++++++++++++-------------- 4 files changed, 91 insertions(+), 48 deletions(-) diff --git a/config/config.ts b/config/config.ts index 9a3c3b8a..6b94b56b 100644 --- a/config/config.ts +++ b/config/config.ts @@ -6,7 +6,7 @@ export default { title: 'Jetlinks', // 浏览器标签页title layout: { title: '物联网平台', // 平台title - logo: '/icons/icon-192x192.png', // 平台logo + logo: '/logo.png', // 平台logo siderWidth: 208, // 左侧菜单栏宽度 headerHeight: 48, // 头部高度 collapsedWidth: 48, diff --git a/src/router/index.ts b/src/router/index.ts index 1ecbc43e..1641803e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,5 +1,5 @@ import { createRouter, createWebHashHistory } from 'vue-router' -import menus, { AccountCenterBindPath, InitHomePath, LoginPath } from './menu' +import menus, { AccountCenterBindPath, InitHomePath, LoginPath, OauthPath } from './menu' import { cleanToken, getToken } from '@/utils/comm' import { useUserInfo } from '@/store/userInfo' import { useSystem } from '@/store/system' @@ -14,12 +14,13 @@ const router = createRouter({ } }) -const filterPath = [ InitHomePath, AccountCenterBindPath ] +const filterPath = [ InitHomePath ] +const noTokenPath = [ AccountCenterBindPath, OauthPath ] router.beforeEach((to, from, next) => { // TODO 切换路由取消请求 const token = getToken() - if (to.path === AccountCenterBindPath) { + if (noTokenPath.includes(to.path)) { next() } else if (token) { if (to.path === LoginPath) { diff --git a/src/utils/request.ts b/src/utils/request.ts index 9676b40d..f6b2d6ed 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -13,7 +13,16 @@ interface AxiosResponseRewrite extends AxiosResponse { export const SUCCESS_CODE = 200 // 成功代码 -const filterApiUrl = ['/system/version', '/system/config/front', '/authorize/captcha/config', '/application/sso/_all', '/authorize/captcha/image', '/application/sso/bind-code', '/authorize/login'] +const filterApiUrl = [ + '/system/version', + '/system/config/front', + '/authorize/captcha/config', + '/application/sso/_all', + '/authorize/captcha/image', + '/application/sso/bind-code', + '/authorize/login', + '/application/' +] export const request = axios.create({ withCredentials: false, @@ -149,10 +158,10 @@ const errorHandler = (error: any) => { } else if (status === 401) { showNotification('Unauthorized', '用户未登录', '401') setTimeout(() => { - cleanToken() - router.replace({ - path: LoginPath - }) + // cleanToken() + // router.replace({ + // path: LoginPath + // }) }, 0) } else if (status === 404) { showNotification(error?.code, error?.response?.data?.message, '404') diff --git a/src/views/oauth/index.vue b/src/views/oauth/index.vue index 547796f1..6fc36ac6 100644 --- a/src/views/oauth/index.vue +++ b/src/views/oauth/index.vue @@ -14,9 +14,10 @@
+

授权登录

- 您正在授权登录,{{ appName }}将获得以下权限: + 您正在授权登录, {{ appName }} 将获得以下权限:
  • 关联{{userName}}账号
  • @@ -32,15 +33,16 @@
    +

    授权登录