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] =?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
/>
+
+
+
+
+
+
+
+
+