From e5e68ed8a8d1cba1786a1a44b7c2b765f4beebb7 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 21 Mar 2024 16:26:03 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat:=20=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/user.ts | 10 +++++++++- ui/src/stores/modules/user.ts | 12 +++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ui/src/api/user.ts b/ui/src/api/user.ts index 3dbe9211..a49646d6 100644 --- a/ui/src/api/user.ts +++ b/ui/src/api/user.ts @@ -124,6 +124,13 @@ const getUserList: (email_or_username: string, loading?: Ref) => Promis return get('/user/list', { email_or_username }, loading) } +/** + * 获取version + */ +const getVersion: (loading?: Ref) => Promise> = (loading) => { + return get('/api/profile', undefined, loading) +} + export default { login, register, @@ -134,5 +141,6 @@ export default { sendEmailToCurrent, resetCurrentUserPassword, logout, - getUserList + getUserList, + getVersion } diff --git a/ui/src/stores/modules/user.ts b/ui/src/stores/modules/user.ts index ecdc0776..471542cc 100644 --- a/ui/src/stores/modules/user.ts +++ b/ui/src/stores/modules/user.ts @@ -6,6 +6,7 @@ export interface userStateTypes { userType: number // 1 系统操作者 2 对话用户 userInfo: User | null token: any + version?: string } const useUserStore = defineStore({ @@ -13,7 +14,8 @@ const useUserStore = defineStore({ state: (): userStateTypes => ({ userType: 1, userInfo: null, - token: '' + token: '', + version: '' }), actions: { getToken(): String | null { @@ -42,9 +44,17 @@ const useUserStore = defineStore({ changeUserType(num: number) { this.userType = num }, + + async asyncGetVersion() { + return UserApi.getVersion().then((ok) => { + this.version = ok.data + }) + }, + async profile() { return UserApi.profile().then((ok) => { this.userInfo = ok.data + this.asyncGetVersion() }) }, From 389e620913c49db1b76d502602b2ac2edff32d0c Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 21 Mar 2024 16:33:13 +0800 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20=E5=85=B3=E4=BA=8E=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/user.ts | 2 +- ui/src/layout/components/top-bar/avatar/AboutDialog.vue | 7 +++++-- ui/src/stores/modules/user.ts | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ui/src/api/user.ts b/ui/src/api/user.ts index a49646d6..e11d7016 100644 --- a/ui/src/api/user.ts +++ b/ui/src/api/user.ts @@ -128,7 +128,7 @@ const getUserList: (email_or_username: string, loading?: Ref) => Promis * 获取version */ const getVersion: (loading?: Ref) => Promise> = (loading) => { - return get('/api/profile', undefined, loading) + return get('/profile', undefined, loading) } export default { diff --git a/ui/src/layout/components/top-bar/avatar/AboutDialog.vue b/ui/src/layout/components/top-bar/avatar/AboutDialog.vue index 6f15aba8..97f742fe 100644 --- a/ui/src/layout/components/top-bar/avatar/AboutDialog.vue +++ b/ui/src/layout/components/top-bar/avatar/AboutDialog.vue @@ -31,7 +31,7 @@ 论坛求助 -
当前版本号:{{ PackageJSON.version }}
+
当前版本号:{{ version }}
+
+ 当前版本号:v1.0.0-dev (build at 2024-03-21T17:32, commit: 40608781) +