From 1730c2f51e9e8cd473452f91be63bda2d829afce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=99=E5=85=89?= <5248283+lsg15829561090@user.noreply.gitee.com> Date: Sun, 29 Sep 2024 20:15:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/access/index.ts | 34 ---- src/components/GlobalHeader.vue | 7 +- src/components/User/UserChangePwd.vue | 78 +++++++++ src/components/User/UserInfo.vue | 8 +- src/components/User/UserPost.vue | 93 ++++++++++ src/components/User/UserReview.vue | 98 +++++++++++ src/views/HomeView.vue | 64 +++++-- src/views/user/UserCenter.vue | 132 ++++++++++----- src/views/user/UserLoginView.vue | 73 ++++++-- src/views/user/UserRegView.vue | 233 ++++++++++++++++++++------ 10 files changed, 664 insertions(+), 156 deletions(-) create mode 100644 src/components/User/UserChangePwd.vue create mode 100644 src/components/User/UserPost.vue create mode 100644 src/components/User/UserReview.vue diff --git a/src/access/index.ts b/src/access/index.ts index 66bf8de..7d27f90 100644 --- a/src/access/index.ts +++ b/src/access/index.ts @@ -35,37 +35,3 @@ router.beforeEach(async (to, from, next) => { } next(); }); -// import router from "@/router"; -// import store from "@/store"; -// import ACCESS_ENUM from "@/access/ACCESS_ENUM"; -// import checkAccess from "@/access/access_check"; - -// router.beforeEach(async (to, from, next) => { -// console.log("登陆用户信息", store.state.user.loginUser); -// let loginUser = store.state.user.loginUser; -// // 如果之前没登陆过,自动登录 -// if (!loginUser || !loginUser.userRole) { -// // 加 await 是为了等用户登录成功之后,再执行后续的代码 -// await store.dispatch("user/getLoginUser"); -// loginUser = store.state.user.loginUser; -// } -// const needAccess = (to.meta?.access as string) ?? ACCESS_ENUM.NOT_LOGIN; -// // 要跳转的页面必须要登陆 -// if (needAccess !== ACCESS_ENUM.NOT_LOGIN) { -// // 如果没登陆,跳转到登录页面 -// if ( -// // !loginUser || -// // !loginUser.userRole || -// loginUser.userRole === ACCESS_ENUM.NOT_LOGIN -// ) { -// next(`/user/login?redirect=${to.fullPath}`); -// return; -// } -// // 如果已经登陆了,但是权限不足,那么跳转到无权限页面 -// if (!checkAccess(loginUser, needAccess)) { -// next("/noAuth"); -// return; -// } -// } -// next(); -// }); diff --git a/src/components/GlobalHeader.vue b/src/components/GlobalHeader.vue index 43dfb89..9cde60a 100644 --- a/src/components/GlobalHeader.vue +++ b/src/components/GlobalHeader.vue @@ -62,7 +62,7 @@