From 04fb38757c78e0f6da581ad1d9e18af884c964dc Mon Sep 17 00:00:00 2001
From: Xwen <929716663@qq.com>
Date: Sat, 23 Dec 2023 19:05:51 +0800
Subject: [PATCH] =?UTF-8?q?perf:=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/TreeArticleInfo.vue | 84 +++++++++++--------
Yi.Bbs.Vue3/src/utils/auth.js | 2 +-
Yi.Bbs.Vue3/src/views/Article.vue | 16 +---
3 files changed, 54 insertions(+), 48 deletions(-)
diff --git a/Yi.Bbs.Vue3/src/components/TreeArticleInfo.vue b/Yi.Bbs.Vue3/src/components/TreeArticleInfo.vue
index c449024a..b14133d9 100644
--- a/Yi.Bbs.Vue3/src/components/TreeArticleInfo.vue
+++ b/Yi.Bbs.Vue3/src/components/TreeArticleInfo.vue
@@ -1,42 +1,52 @@
-
-
-
-
- {{data.name}}
-
-
- +
- 编辑
- 删除
-
+
+
+
+ {{ data.name }}
+
+
+ +
+
+
+ 编辑
+
+
+ 删除
+
-
-
+
+
+
\ No newline at end of file
+
diff --git a/Yi.Bbs.Vue3/src/utils/auth.js b/Yi.Bbs.Vue3/src/utils/auth.js
index 7e259f8d..c573648f 100644
--- a/Yi.Bbs.Vue3/src/utils/auth.js
+++ b/Yi.Bbs.Vue3/src/utils/auth.js
@@ -13,7 +13,7 @@ export function removeToken() {
return localStorage.removeItem(TokenKey);
}
-export function getPermission(code, isDisabled) {
+export function getPermission(code, isDisabled = false) {
const all_permission = "*:*:*";
const isHasPermission = useUserStore().permissions.some((permission) => {
if (all_permission === permission) {
diff --git a/Yi.Bbs.Vue3/src/views/Article.vue b/Yi.Bbs.Vue3/src/views/Article.vue
index 66a1695a..c23d5e41 100644
--- a/Yi.Bbs.Vue3/src/views/Article.vue
+++ b/Yi.Bbs.Vue3/src/views/Article.vue
@@ -26,6 +26,7 @@
@create="addNextArticle"
@handleNodeClick="handleNodeClick"
:currentNodeKey="currentNodeKey"
+ :isArticleUser="isArticleUser"
/>
@@ -223,18 +224,9 @@ const loadArticleData = async () => {
//主题初始化
const isDisabledCreateComment = ref(false);
const isArticleUser = ref(false);
-const { isHasPermission: isAddArticle } = getPermission(
- "bbs:article:add",
- isDisabledCreateComment.value
-);
-const { isHasPermission: isEditTheme } = getPermission(
- "bbs:discuss:edit",
- isDisabledCreateComment.value
-);
-const { isHasPermission: isRemoveTheme } = getPermission(
- "bbs:discuss:remove",
- isDisabledCreateComment.value
-);
+const { isHasPermission: isAddArticle } = getPermission("bbs:article:add");
+const { isHasPermission: isEditTheme } = getPermission("bbs:discuss:edit");
+const { isHasPermission: isRemoveTheme } = getPermission("bbs:discuss:remove");
const loadDiscuss = async (isRewrite) => {
if (isRewrite) {
//跳转路由