diff --git a/src/plugins/http-fetch.ts b/src/plugins/http-fetch.ts index df9da37b..c4f33e56 100644 --- a/src/plugins/http-fetch.ts +++ b/src/plugins/http-fetch.ts @@ -186,7 +186,7 @@ function beforeRequest(options: OptionsType): OptionsType | Promise { if (paramStr) { const separator = options.url.includes('?') ? '&' : '?'; // 请求加密 - if (options.crypto) { + if (options.crypto && token !== '== Not Login Auth ==') { const data = encryptAES(JSON.stringify(paramStr), APP_DATA_API_KEY); options.url += `${separator}data=${encodeURIComponent(data)}`; } else { diff --git a/src/router/index.ts b/src/router/index.ts index b16ea27c..a2f467e0 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -8,7 +8,7 @@ import NProgress from 'nprogress'; import 'nprogress/nprogress.css'; import BasicLayout from '../layouts/BasicLayout.vue'; import BlankLayout from '../layouts/BlankLayout.vue'; -import { getToken } from '@/plugins/auth-token'; +import { getToken, setToken } from '@/plugins/auth-token'; import { validHttp } from '@/utils/regular-utils'; import useUserStore from '@/store/modules/user'; import useAppStore from '@/store/modules/app'; @@ -187,6 +187,7 @@ router.beforeEach(async (to, from, next) => { // 免用户登录认证 if (!appStore.loginAuth) { token = '== Not Login Auth =='; + setToken('== Not Login Auth =='); } // 没有token