diff --git a/.env b/.env index 301d2415..9af53db1 100644 --- a/.env +++ b/.env @@ -1,5 +1,14 @@ -# port 端口号 -VITE_PORT = 8888 +# 前端加密密钥 +VITE_PWD_ENC_KEY='pigxpigxpigxpigx' + +# OAUTH2 密码模式客户端信息 +VITE_OAUTH2_PASSWORD_CLIENT='pig:pig' + +# OAUTH2 短信客户端信息 +VITE_OAUTH2_MOBILE_CLIENT='app:app' + +# OAUTH2 社交登录客户端信息 +VITE_OAUTH2_SOCIAL_CLIENT='social:social' # ADMIN 服务地址 VITE_ADMIN_PROXY_PATH = http://localhost:9999 @@ -7,5 +16,12 @@ VITE_ADMIN_PROXY_PATH = http://localhost:9999 # 代码生成服务地址 VITE_GEN_PROXY_PATH = http://localhost:5003 +# 是否开启websocket 消息接受, +VITE_WEBSOCKET_ENABLE = false + +# 是否开启注册 +VITE_REGISTER_ENABLE = false + # 代码代码前缀 VITE_PUBLIC_PATH = / + diff --git a/src/api/login/index.ts b/src/api/login/index.ts index 93158f4d..b56b94de 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -8,7 +8,8 @@ import { useUserInfo } from "/@/stores/userInfo"; * @param data */ export const login = (data: any) => { - let basicAuth = 'Basic ' + window.btoa('pig:pig') + const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_PASSWORD_CLIENT) + Session.set('basicAuth', basicAuth) return request({ url: '/admin/oauth2/token', method: 'post', @@ -24,7 +25,8 @@ export const login = (data: any) => { export const loginByMobile = (mobile: any, code: any) => { const grant_type = 'mobile' const scope = 'server' - let basicAuth = 'Basic ' + window.btoa('app:app') + const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_MOBILE_CLIENT) + Session.set('basicAuth', basicAuth) return request({ url: '/admin/oauth2/token', @@ -41,7 +43,8 @@ export const loginByMobile = (mobile: any, code: any) => { export const loginBySocial = (state: string, code: string) => { const grant_type = 'mobile' const scope = 'server' - let basicAuth = 'Basic ' + window.btoa('social:social') + const basicAuth = 'Basic ' + window.btoa(import.meta.env.VITE_OAUTH2_SOCIAL_CLIENT) + Session.set('basicAuth', basicAuth) return request({ url: '/admin/oauth2/token', @@ -66,7 +69,7 @@ export const refreshTokenApi = (refresh_token: string) => { const grant_type = 'refresh_token' const scope = 'server' // 获取当前选中的 basic 认证信息 - let basicAuth = 'Basic ' + window.btoa('pig:pig') + const basicAuth = Session.get('basicAuth') return request({ url: '/admin/oauth2/token', @@ -85,7 +88,7 @@ export const refreshTokenApi = (refresh_token: string) => { * @param refreshLock */ export const checkToken = (refreshTime: number, refreshLock: boolean) => { - let basicAuth = 'Basic ' + window.btoa('pig:pig') + const basicAuth = Session.get('basicAuth') request({ url: '/admin/token/check_token', headers: { diff --git a/src/layout/navBars/breadcrumb/user.vue b/src/layout/navBars/breadcrumb/user.vue index 011a2d4c..42d578b4 100644 --- a/src/layout/navBars/breadcrumb/user.vue +++ b/src/layout/navBars/breadcrumb/user.vue @@ -7,27 +7,24 @@
- +