diff --git a/src/assets/images/home1.jpg b/src/assets/images/home1.jpg new file mode 100644 index 0000000..2fe864e Binary files /dev/null and b/src/assets/images/home1.jpg differ diff --git a/src/assets/images/home2.jpg b/src/assets/images/home2.jpg new file mode 100644 index 0000000..e4c4202 Binary files /dev/null and b/src/assets/images/home2.jpg differ diff --git a/src/components/navbar/index.vue b/src/components/navbar/index.vue index e9544ff..8fdbefa 100644 --- a/src/components/navbar/index.vue +++ b/src/components/navbar/index.vue @@ -81,7 +81,7 @@ -
  • +
  • avatar @@ -121,6 +135,8 @@ import { useDark, useFullscreen, useToggle } from '@vueuse/core' import { computed, inject, ref } from 'vue' import { useI18n } from 'vue-i18n' import MessageBox from '../message-box/index.vue' +import PasswordChange from '../password-change/index.vue' +import ProfileChange from '../profile-change/index.vue' const { t } = useI18n() @@ -157,6 +173,8 @@ const setVisible = () => { } const refBtn = ref() const triggerBtn = ref() +const passwordChangeVisible = ref(false) +const profileChangeVisible = ref(false) const setPopoverVisible = () => { const event = new MouseEvent('click', { view: window, @@ -168,6 +186,12 @@ const setPopoverVisible = () => { const handleLogout = () => { logout() } +const handleOpenPasswordChange = () => { + passwordChangeVisible.value = true +} +const handleOpenProfileChange = () => { + profileChangeVisible.value = true +} const setDropDownVisible = () => { const event = new MouseEvent('click', { view: window, diff --git a/src/components/password-change/index.vue b/src/components/password-change/index.vue new file mode 100644 index 0000000..3bf8c21 --- /dev/null +++ b/src/components/password-change/index.vue @@ -0,0 +1,117 @@ + + + \ No newline at end of file diff --git a/src/components/profile-change/index.vue b/src/components/profile-change/index.vue new file mode 100644 index 0000000..c576fd3 --- /dev/null +++ b/src/components/profile-change/index.vue @@ -0,0 +1,121 @@ + + + \ No newline at end of file diff --git a/src/router/guard/userLoginInfo.ts b/src/router/guard/userLoginInfo.ts index a7b4428..6c2c78a 100644 --- a/src/router/guard/userLoginInfo.ts +++ b/src/router/guard/userLoginInfo.ts @@ -4,6 +4,9 @@ import type { LocationQueryRaw, Router } from 'vue-router' import { useUserStore } from '@/store' import { isLogin } from '@/utils/auth' +// 不需要登录验证的路由名称 +const whiteList = ['login', 'home'] + export default function setupUserLoginInfoGuard(router: Router) { router.beforeEach(async (to, from, next) => { NProgress.start() @@ -27,7 +30,8 @@ export default function setupUserLoginInfoGuard(router: Router) { } } } else { - if (to.name === 'login') { + // 在白名单中的路由不需要登录验证 + if (whiteList.includes(to.name as string)) { next() return } diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 39dc655..4b5c4d7 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -68,7 +68,7 @@ const useUserStore = defineStore('user', { SafeStorage.set(AppStorageKey.USER_INFO, details) this.userInfo = details } else { - throw new Error('登录失败:未获取到 token') + throw new Error('登录失败') } } catch (err) { clearToken() diff --git a/src/views/help/index.vue b/src/views/help/index.vue index 900410a..e6427e5 100644 --- a/src/views/help/index.vue +++ b/src/views/help/index.vue @@ -4,7 +4,7 @@