From 9e8f6e7c9738bfb720923497cd7168f275a83b89 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Fri, 1 Aug 2025 15:14:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E5=BD=95=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 4 ++-- src/apis/login.ts | 2 +- src/app.vue | 2 -- src/layouts/default.vue | 4 ++-- src/types/system.d.ts | 4 ++-- src/views/login/index.vue | 11 ++++++----- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.env.prod b/.env.prod index 0a20bef..0b4755b 100644 --- a/.env.prod +++ b/.env.prod @@ -2,6 +2,6 @@ FT_NODE_ENV=prod -FT_WS_URL=ws://192.168.8.168:8080/ws -FT_PROXY=http://192.168.8.168:8080 +FT_WS_URL=ws://127.0.0.1:8080/ws +FT_PROXY=http://127.0.0.1:8080 FT_API_BASE=/api \ No newline at end of file diff --git a/src/apis/login.ts b/src/apis/login.ts index 0c51b78..c5d6e09 100644 --- a/src/apis/login.ts +++ b/src/apis/login.ts @@ -1,4 +1,4 @@ import http from 'libs/http' -export const login = (params: User.Login): Promise => http.post('/auth/login', params) +export const login = (params: System.LoginForm): Promise => http.post('/auth/login', params) export const logout = (): Promise => http.post('/auth/logout') diff --git a/src/app.vue b/src/app.vue index ff9c695..9a889ab 100644 --- a/src/app.vue +++ b/src/app.vue @@ -9,8 +9,6 @@ const systemStore = useSystemStore() onMounted(async () => { startProgress() const res = await getStatus() - // console.log(res) - // console.log(systemStore.systemStatus) systemStore.updateSystemStatus(res) }) diff --git a/src/layouts/default.vue b/src/layouts/default.vue index 6803fb0..736325f 100644 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -103,7 +103,7 @@ const checkCraftVisible = ref(false) // meta的isDefault=true 并且 当isDebug=true时,把debug路由的页面也显示 const menuList = computed(() => { return authRoutes.filter((item) => { - if (item.meta?.isDefault) { + if (item.meta?.isDefault && item.meta?.auth?.includes(systemStore.systemStatus.currentUser?.role)) { return true } return (['/debug', '/positionDebug'].includes(item.path) && systemStore.isDebug) @@ -194,7 +194,7 @@ const remoteControlState = computed(() => { img(src="../assets/images/logo.svg" alt="" @click="handleLogoClick") div(class="menu-box") el-tag( - v-for="item in menuList.filter((item) => item.meta?.auth?.includes(systemStore.systemStatus.currentUser?.role))" + v-for="item in menuList" :key="item.path" class="menu-tag" :effect="router.currentRoute.value.path.includes(item.path) ? 'dark' : 'plain'" diff --git a/src/types/system.d.ts b/src/types/system.d.ts index 9117925..7750798 100644 --- a/src/types/system.d.ts +++ b/src/types/system.d.ts @@ -96,8 +96,8 @@ declare namespace System { params: T } interface LoginForm { - username: string - password: string + username?: string + password?: string } interface ApiResponse { code: string diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 71666ed..8558f96 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -11,7 +11,8 @@ import { useRouter } from 'vue-router' const router = useRouter() const sys = useSystemStore() - +const form = ref(sys.loginForm) +form.value.password = undefined const formRef = ref() setToken('login success') const rules = { @@ -31,7 +32,7 @@ const loginHandle = async () => { if (!valid) { return } - const res = await login(sys.loginForm) + const res = await login(form.value) setToken('login success') sys.systemStatus.currentUser = res await router.push('/') @@ -47,15 +48,15 @@ const loginHandle = async () => { .login-box-content img(:src="logo", alt="" class="logo") //.title 长春黄金研究院有限公司 - el-form(ref="formRef", :model="sys.loginForm", :rules="rules", style="width: 100%") + el-form(ref="formRef", :model="form", :rules="rules", style="width: 100%") .input-title 用户名 el-form-item - ft-input(v-model="sys.loginForm.username", size="large", placeholder="请输入用户名") + ft-input(v-model="form.username", size="large", placeholder="请输入用户名") template(#prepend) img.input-icon(:src="user", alt="") .input-title 密码 el-form-item - ft-input(v-model="sys.loginForm.password", size="large", placeholder="请输入密码", type="password") + ft-input(autocomplete="new-password" v-model="form.password", size="large", placeholder="请输入密码", type="password") template(#prepend) img.input-icon(:src="password", alt="") el-form-item