From cb8fafb81fbcb3e2d8137d31de20730fb1e07714 Mon Sep 17 00:00:00 2001 From: Guarp <guarp2022@163.com> Date: Sun, 16 Mar 2025 16:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BB=E9=A1=B5=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BF=E9=97=AE=E6=AC=A1=E6=95=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA;=20=E9=9A=90=E8=97=8F=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/NavBar.vue | 2 +- src/pages/Home.vue | 26 ++++++++++--------- src/pages/accountPages/Account_draft.vue | 7 +++-- .../accountPages/Account_worksmanage.vue | 8 ++++-- src/router/index.js | 5 ++++ src/store/index.js | 1 + 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index fb7af14..1f4ad36 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -63,7 +63,7 @@ const navItems = [ 'divider', {name: '博客', link: '/blog'}, // {name: '项目', link: '/projects'}, - {name: '实例', link: '/demos'}, + // {name: '实例', link: '/demos'}, {name: '小工具', link: '/tools'}, {name: '留言板', link: '/demos/board'}, 'divider', diff --git a/src/pages/Home.vue b/src/pages/Home.vue index e7039a4..70dfed7 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -26,17 +26,17 @@ onMounted(async () => { <template> <div class="container"> <el-container> - <div style="font-size: 50px; font-weight: inherit; padding: 20px">欢迎来到 MVA-CYBER !</div> -<!-- <el-main>--> -<!-- </el-main>--> -<!-- <el-footer>--> + <el-main> + <div style="font-size: 50px; font-weight: inherit; padding: 20px">欢迎来到 MVA-CYBER !</div> + </el-main> + <el-footer> <!-- <div class="text-bg"></div>--> <el-col v-if="viewCountDisplay"> <el-statistic title="网站累计访问次数" :value="outputValue"/> </el-col> -<!-- </el-footer>--> + </el-footer> </el-container> </div> @@ -57,7 +57,8 @@ img { } .el-main { - overflow: hidden; + display: flex; + justify-content: center; padding: 0; width: 100%; } @@ -65,12 +66,13 @@ img { position: relative; } .el-col { - position: absolute; - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; + + //position: absolute; + //width: 100%; + //height: 100%; + //display: flex; + //align-items: center; + //justify-content: center; } .el-statistic { display: flex; diff --git a/src/pages/accountPages/Account_draft.vue b/src/pages/accountPages/Account_draft.vue index ad0ee30..f639627 100644 --- a/src/pages/accountPages/Account_draft.vue +++ b/src/pages/accountPages/Account_draft.vue @@ -39,14 +39,17 @@ async function goPage(page) { } onMounted(async () => { - refreshDraft(1, 15); + if (store.getters.isCertified) { + refreshDraft(1, 15); + } }) </script> <template> <div class="container"> <!-- 顶部按钮居中 --> - <div class="top-bar"> + <div v-if="! store.getters.isCertified" style="padding: 20px 0;">请联系管理员进行认证, 认证后可编写博客</div> + <div v-else class="top-bar"> <button class="create-btn" @click="createNewDraft">新建博客</button> <div v-if="drafts === null">正在加载...</div> </div> diff --git a/src/pages/accountPages/Account_worksmanage.vue b/src/pages/accountPages/Account_worksmanage.vue index 9ec373c..9799273 100644 --- a/src/pages/accountPages/Account_worksmanage.vue +++ b/src/pages/accountPages/Account_worksmanage.vue @@ -37,14 +37,18 @@ async function goPage(page) { } onMounted(async () => { - refreshwork(1, 15); + if (store.getters.isCertified) { + refreshwork(1, 15); + } + }) </script> <template> <div class="container"> + <div v-if="! store.getters.isCertified" style="padding: 20px 0;">请联系管理员进行认证, 认证后可编写博客</div> <!-- 顶部按钮居中 --> - <div class="top-bar"> + <div v-else class="top-bar"> <button class="create-btn" @click="createNewwork">新建博客</button> <div v-if="works === null">正在加载...</div> </div> diff --git a/src/router/index.js b/src/router/index.js index 9adef1d..e5210bb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -155,6 +155,11 @@ router.beforeEach(async (to, from, next) => { store.state.isViewCounted = true; } + + if (/^\/demos\/?$/.test(to.path)) { + next('/404'); + } + if (!store.state.userInfo.uid && store.state.token) { AuthService.setSelfInfo(); } diff --git a/src/store/index.js b/src/store/index.js index 7549411..5ccb220 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -116,6 +116,7 @@ const store = createStore({ return '未知'; } }, + isCertified: state => state.userInfo.role_id >=1, isAdmin: state => state.userInfo.role_id >= 2, isSuperAdmin: state => state.userInfo.role_id >= 3, },