From fbc2d19b705996e6623d207500a3498477b96cc0 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 4 Mar 2025 11:41:36 +0800 Subject: [PATCH] update --- components.d.ts | 1 + package-lock.json | 17 ++++++++-- src/api.ts | 7 ++++ src/pages/UserManage.vue | 69 +++++++++++++++++++++++++++++++++++++++- src/utils/helper.ts | 6 ++++ src/utils/type.ts | 8 +++++ 6 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 src/utils/helper.ts diff --git a/components.d.ts b/components.d.ts index d92864c..42efaad 100644 --- a/components.d.ts +++ b/components.d.ts @@ -15,6 +15,7 @@ declare module 'vue' { NButton: typeof import('naive-ui')['NButton'] NCard: typeof import('naive-ui')['NCard'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] + NDataTable: typeof import('naive-ui')['NDataTable'] NDialogProvider: typeof import('naive-ui')['NDialogProvider'] NDropdown: typeof import('naive-ui')['NDropdown'] NFlex: typeof import('naive-ui')['NFlex'] diff --git a/package-lock.json b/package-lock.json index ef56535..ee2920c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1474,10 +1474,11 @@ "license": "MIT" }, "node_modules/date-fns": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", - "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", "license": "MIT", + "peer": true, "funding": { "type": "github", "url": "https://github.com/sponsors/kossnocorp" @@ -2264,6 +2265,16 @@ "vue": "^3.0.0" } }, + "node_modules/naive-ui/node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/nanoid": { "version": "3.3.8", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", diff --git a/src/api.ts b/src/api.ts index 33041a6..5ebaddc 100644 --- a/src/api.ts +++ b/src/api.ts @@ -53,6 +53,13 @@ export class Account { const res = await http.get("/account/profile") return res.data } + + static async list(query: { username: string }) { + const res = await http.get("/account/list", { + params: query, + }) + return res.data + } } export class Tutorial { diff --git a/src/pages/UserManage.vue b/src/pages/UserManage.vue index e80737e..713fa3b 100644 --- a/src/pages/UserManage.vue +++ b/src/pages/UserManage.vue @@ -1 +1,68 @@ - \ No newline at end of file + + + diff --git a/src/utils/helper.ts b/src/utils/helper.ts new file mode 100644 index 0000000..5562f53 --- /dev/null +++ b/src/utils/helper.ts @@ -0,0 +1,6 @@ +import { useDateFormat } from "@vueuse/core" + +export function parseTime(utc: Date | string, format = "YYYY年M月D日") { + const time = useDateFormat(utc, format, { locales: "zh-CN" }) + return time.value +} diff --git a/src/utils/type.ts b/src/utils/type.ts index 2e5eb3c..e202e72 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -15,3 +15,11 @@ export interface TutorialIn { title: string content: string } + +export interface User { + username: string + date_joined: Date + last_login: Date + role: Role + is_active: boolean +} \ No newline at end of file