From 64cdcea6b9e28e524ab8821663a23f4b3d0e8ba6 Mon Sep 17 00:00:00 2001
From: Xwen <929716663@qq.com>
Date: Wed, 20 Dec 2023 21:52:42 +0800
Subject: [PATCH 1/2] =?UTF-8?q?perf:=E7=BB=9F=E4=B8=80layout=E5=AE=BD?=
=?UTF-8?q?=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Yi.Bbs.Vue3/src/layout/AppBody.vue | 34 +++---
Yi.Bbs.Vue3/src/layout/AppHeader.vue | 2 +-
Yi.Bbs.Vue3/src/stores/user.js | 2 -
Yi.Bbs.Vue3/src/views/Article.vue | 150 ++++++++++++++-------------
Yi.Bbs.Vue3/src/views/Discuss.vue | 122 +++++++++++-----------
Yi.Bbs.Vue3/src/views/Login.vue | 6 --
Yi.Bbs.Vue3/src/views/home/Index.vue | 90 ++++++++--------
7 files changed, 203 insertions(+), 203 deletions(-)
diff --git a/Yi.Bbs.Vue3/src/layout/AppBody.vue b/Yi.Bbs.Vue3/src/layout/AppBody.vue
index 47f5ca73..5cc8df80 100644
--- a/Yi.Bbs.Vue3/src/layout/AppBody.vue
+++ b/Yi.Bbs.Vue3/src/layout/AppBody.vue
@@ -1,24 +1,20 @@
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
+
diff --git a/Yi.Bbs.Vue3/src/layout/AppHeader.vue b/Yi.Bbs.Vue3/src/layout/AppHeader.vue
index 7e0fcdfd..e679ef15 100644
--- a/Yi.Bbs.Vue3/src/layout/AppHeader.vue
+++ b/Yi.Bbs.Vue3/src/layout/AppHeader.vue
@@ -123,7 +123,7 @@ const isLogin = getToken("AccessToken") ? true : false;
diff --git a/Yi.Bbs.Vue3/src/views/Discuss.vue b/Yi.Bbs.Vue3/src/views/Discuss.vue
index 803acc68..443714bd 100644
--- a/Yi.Bbs.Vue3/src/views/Discuss.vue
+++ b/Yi.Bbs.Vue3/src/views/Discuss.vue
@@ -1,5 +1,5 @@
-
-
-
From 7f399d6854c47e6b75c787f6ca2791509c1ecef7 Mon Sep 17 00:00:00 2001
From: Xwen <929716663@qq.com>
Date: Wed, 20 Dec 2023 22:51:24 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat:=E7=99=BB=E5=BD=95=E6=8E=A5=E5=85=A5?=
=?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Yi.Bbs.Vue3/src/apis/auth.js | 10 ++++++++
Yi.Bbs.Vue3/src/stores/user.js | 9 ++++++-
Yi.Bbs.Vue3/src/views/Discuss.vue | 5 +---
Yi.Bbs.Vue3/src/views/login/index.vue | 36 ++++++++++++++++++++++++++-
4 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/Yi.Bbs.Vue3/src/apis/auth.js b/Yi.Bbs.Vue3/src/apis/auth.js
index 37e2524b..8fcec5a6 100644
--- a/Yi.Bbs.Vue3/src/apis/auth.js
+++ b/Yi.Bbs.Vue3/src/apis/auth.js
@@ -63,3 +63,13 @@ export function getCodePhone(data) {
data,
});
}
+
+/**
+ * 获取登录验证码
+ */
+export function getLoginCode() {
+ return request({
+ url: `/account/captcha-image`,
+ method: "get",
+ });
+}
diff --git a/Yi.Bbs.Vue3/src/stores/user.js b/Yi.Bbs.Vue3/src/stores/user.js
index b4d656ff..428db43f 100644
--- a/Yi.Bbs.Vue3/src/stores/user.js
+++ b/Yi.Bbs.Vue3/src/stores/user.js
@@ -14,6 +14,7 @@ const useUserStore = defineStore("user", {
icon: null,
roles: [],
permissions: [],
+ hasPermissions: false,
}),
getters: {},
actions: {
@@ -42,16 +43,22 @@ const useUserStore = defineStore("user", {
getUserDetailInfo()
.then((response) => {
const res = response.data;
-
const user = res.user;
const avatar =
user.icon == "" || user.icon == null
? "/favicon.ico"
: import.meta.env.VITE_APP_BASEAPI + "/file/" + user.icon;
+ const all_permission = "*:*:*";
if (res.roleCodes && res.roleCodes.length > 0) {
// 验证返回的roles是否是一个非空数组
this.roles = res.roleCodes;
this.permissions = res.permissionCodes;
+ this.hasPermissions = res.permissionCodes.some((permission) => {
+ return (
+ all_permission === permission ||
+ permissionFlag.includes(permission)
+ );
+ });
// this.roles = ["admin"];
// this.permissions=["*:*:*"]
} else {
diff --git a/Yi.Bbs.Vue3/src/views/Discuss.vue b/Yi.Bbs.Vue3/src/views/Discuss.vue
index 443714bd..367ff6a7 100644
--- a/Yi.Bbs.Vue3/src/views/Discuss.vue
+++ b/Yi.Bbs.Vue3/src/views/Discuss.vue
@@ -20,10 +20,7 @@
"
>查询
- 发布主题
diff --git a/Yi.Bbs.Vue3/src/views/login/index.vue b/Yi.Bbs.Vue3/src/views/login/index.vue
index 81d2ff1e..723598d9 100644
--- a/Yi.Bbs.Vue3/src/views/login/index.vue
+++ b/Yi.Bbs.Vue3/src/views/login/index.vue
@@ -40,6 +40,25 @@
show-password
/>
+
+
+
+
+
+
+
+
+