From 5f603e6652a5f85654de1cc9d9ca37bb2030a630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Thu, 16 Mar 2023 21:34:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E6=88=90=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.BBS.Vue3/package-lock.json | 11 ++ Yi.BBS.Vue3/package.json | 1 + Yi.BBS.Vue3/src/apis/accountApi.js | 70 +++++++++-- .../src/components/TreeArticleInfo.vue | 1 + Yi.BBS.Vue3/src/layout/AppHeader.vue | 15 ++- Yi.BBS.Vue3/src/main.js | 1 + Yi.BBS.Vue3/src/permission.js | 65 ++++++++++ Yi.BBS.Vue3/src/router/index.js | 2 +- Yi.BBS.Vue3/src/stores/user.js | 68 ++++++++++- Yi.BBS.Vue3/src/utils/auth.js | 13 ++ Yi.BBS.Vue3/src/utils/request.js | 8 +- Yi.BBS.Vue3/src/views/Article.vue | 114 ++++++++---------- Yi.BBS.Vue3/src/views/Login.vue | 27 ++++- .../Auditing/IHasCreationTime.cs | 2 +- .../project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db | Bin 245760 -> 245760 bytes .../project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db | Bin 245760 -> 245760 bytes .../Logs/Entities/LoginLogEntity.cs | 2 +- 17 files changed, 310 insertions(+), 90 deletions(-) create mode 100644 Yi.BBS.Vue3/src/permission.js create mode 100644 Yi.BBS.Vue3/src/utils/auth.js diff --git a/Yi.BBS.Vue3/package-lock.json b/Yi.BBS.Vue3/package-lock.json index 1353b0d7..554b82f0 100644 --- a/Yi.BBS.Vue3/package-lock.json +++ b/Yi.BBS.Vue3/package-lock.json @@ -14,6 +14,7 @@ "highlight": "^0.2.4", "marked": "^4.2.12", "mavon-editor": "^3.0.0", + "nprogress": "^0.2.0", "pinia": "^2.0.32", "vue": "^3.2.47", "vue-router": "^4.1.6", @@ -2806,6 +2807,11 @@ "resolved": "https://registry.npmmirror.com/normalize-wheel-es/-/normalize-wheel-es-1.2.0.tgz", "integrity": "sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw==" }, + "node_modules/nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==" + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz", @@ -5948,6 +5954,11 @@ "resolved": "https://registry.npmmirror.com/normalize-wheel-es/-/normalize-wheel-es-1.2.0.tgz", "integrity": "sha512-Wj7+EJQ8mSuXr2iWfnujrimU35R2W4FAErEyTmJoJ7ucwTn2hOUSsRehMb5RSYkxXGTM7Y9QpvPmp++w5ftoJw==" }, + "nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==" + }, "path-parse": { "version": "1.0.7", "resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz", diff --git a/Yi.BBS.Vue3/package.json b/Yi.BBS.Vue3/package.json index ea49b3b7..0b62b03e 100644 --- a/Yi.BBS.Vue3/package.json +++ b/Yi.BBS.Vue3/package.json @@ -14,6 +14,7 @@ "highlight": "^0.2.4", "marked": "^4.2.12", "mavon-editor": "^3.0.0", + "nprogress": "^0.2.0", "pinia": "^2.0.32", "vue": "^3.2.47", "vue-router": "^4.1.6", diff --git a/Yi.BBS.Vue3/src/apis/accountApi.js b/Yi.BBS.Vue3/src/apis/accountApi.js index c42f888e..0cd9f8ec 100644 --- a/Yi.BBS.Vue3/src/apis/accountApi.js +++ b/Yi.BBS.Vue3/src/apis/accountApi.js @@ -1,11 +1,61 @@ -import myaxios from '@/utils/request' -export function login(username, password){ - return myaxios({ - url: '/Account/login', - method: 'post', - data: { - username, - password - } +import request from '@/utils/request' + +// 登录方法 +export function login(username, password, code, uuid) { + const data = { + username, + password, + code, + uuid + } + return request({ + url: '/account/login', + headers: { + isToken: false + }, + method: 'post', + data: data }) -}; \ No newline at end of file + } + + // 注册方法 + export function register(data) { + return request({ + url: '/register', + headers: { + isToken: false + }, + method: 'post', + data: data + }) + } + + // 获取用户详细信息 + export function getInfo() { + return request({ + url: '/account', + method: 'get' + }) + } + + +// 退出方法 +export function logout() { + return request({ + url: '/account/logout', + method: 'post' + }) + } + + // 获取验证码 + export function getCodeImg() { + return request({ + url: '/account/captcha-image', + headers: { + isToken: false + }, + method: 'get', + timeout: 20000 + }) + } + \ No newline at end of file diff --git a/Yi.BBS.Vue3/src/components/TreeArticleInfo.vue b/Yi.BBS.Vue3/src/components/TreeArticleInfo.vue index 9dd6cddf..f41cd5e3 100644 --- a/Yi.BBS.Vue3/src/components/TreeArticleInfo.vue +++ b/Yi.BBS.Vue3/src/components/TreeArticleInfo.vue @@ -5,6 +5,7 @@ @node-click="handleNodeClick" :expand-on-click-node="false" node-key="id" + :default-expand-all='true' >