From b53ee9dc413e066675129476ad2952fa0ab2a65c Mon Sep 17 00:00:00 2001 From: ronger Date: Fri, 26 Mar 2021 10:44:54 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E8=B7=AF=E5=BE=84=20/user/nickname=20->=20/user/accou?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/archive/list.vue | 2 +- components/common/user/list.vue | 2 +- components/layouts/mobile/header.vue | 14 +++++++++++++- components/layouts/pc/header.vue | 14 +++++++++++++- pages/admin/users.vue | 2 +- pages/article/_article_id.vue | 2 +- pages/article/post/_article_id.vue | 1 - pages/chats/{_nickname.vue => _account.vue} | 8 ++++---- pages/login.vue | 3 ++- pages/portfolio/_portfolio_id.vue | 2 +- pages/user/{_nickname.vue => _account.vue} | 16 ++++++++-------- plugins/sockjs.js | 4 ++-- store/user.js | 12 ++++++------ 13 files changed, 53 insertions(+), 29 deletions(-) rename pages/chats/{_nickname.vue => _account.vue} (97%) rename pages/user/{_nickname.vue => _account.vue} (96%) diff --git a/components/archive/list.vue b/components/archive/list.vue index 36256cb..111472d 100644 --- a/components/archive/list.vue +++ b/components/archive/list.vue @@ -31,7 +31,7 @@
- {{ article.articleAuthorName }} diff --git a/components/common/user/list.vue b/components/common/user/list.vue index 4f3c952..d0ff3ed 100644 --- a/components/common/user/list.vue +++ b/components/common/user/list.vue @@ -7,7 +7,7 @@
- + {{ user.nickname }} {{ user.signature }} diff --git a/components/layouts/mobile/header.vue b/components/layouts/mobile/header.vue index ae7ddd3..d3363fa 100644 --- a/components/layouts/mobile/header.vue +++ b/components/layouts/mobile/header.vue @@ -106,6 +106,18 @@ } return _ts.$store.state.userInfo?.nickname; }, + account() { + let _ts = this; + if (isBrowser) { + if (!_ts.$store.state.userInfo) { + let user = localStorage.getItem('user'); + if (user) { + _ts.$store.commit('setUser', JSON.parse(user)) + } + } + } + return _ts.$store.state.userInfo?.account; + }, hasPermissions() { return this.$store.getters.hasPermissions('blog_admin'); } @@ -154,7 +166,7 @@ switch (item) { case 'user': _ts.$router.push({ - path: '/user/' + _ts.nickname + path: '/user/' + _ts.account }) break; case 'user-info': diff --git a/components/layouts/pc/header.vue b/components/layouts/pc/header.vue index 32418dd..05b2ead 100644 --- a/components/layouts/pc/header.vue +++ b/components/layouts/pc/header.vue @@ -142,6 +142,18 @@ export default { } return _ts.$store.state.userInfo?.nickname; }, + account() { + let _ts = this; + if (isBrowser) { + if (!_ts.$store.state.userInfo) { + let user = localStorage.getItem('user'); + if (user) { + _ts.$store.commit('setUser', JSON.parse(user)) + } + } + } + return _ts.$store.state.userInfo?.account; + }, hasPermissions() { return this.$store.getters.hasPermissions('blog_admin'); } @@ -219,7 +231,7 @@ export default { switch (item) { case 'user': _ts.$router.push({ - path: '/user/' + _ts.nickname + path: '/user/' + _ts.account }) break; case 'user-info': diff --git a/pages/admin/users.vue b/pages/admin/users.vue index 09c2174..d727808 100644 --- a/pages/admin/users.vue +++ b/pages/admin/users.vue @@ -29,7 +29,7 @@ width="180" prop="nickname"> diff --git a/pages/article/_article_id.vue b/pages/article/_article_id.vue index 5741d01..7bb74b3 100644 --- a/pages/article/_article_id.vue +++ b/pages/article/_article_id.vue @@ -17,7 +17,7 @@
- {{ article.articleAuthorName }} {{ article.timeAgo }} diff --git a/pages/article/post/_article_id.vue b/pages/article/post/_article_id.vue index 23006ee..be31e60 100644 --- a/pages/article/post/_article_id.vue +++ b/pages/article/post/_article_id.vue @@ -48,7 +48,6 @@