diff --git a/backend/user.go b/backend/user.go index b91dea5..268e33c 100644 --- a/backend/user.go +++ b/backend/user.go @@ -29,7 +29,7 @@ type getUserInfoResult struct { Desc string `json:"desc"` HomePath string `json:"homePath"` Roles []role `json:"roles"` - Date string `json:"date"` + Date int64 `json:"date"` Last string `json:"last"` Contact string `json:"contact"` } @@ -65,7 +65,7 @@ func getUserInfo(token string) (*getUserInfoResult, error) { return "/dashboard/workbench" }(), Roles: []role{{RoleName: user.Role.Nick(), Value: user.Role.String()}}, - Date: time.Unix(user.Date, 0).Format(chineseDateLayout), + Date: user.Date, Last: time.Unix(user.Last, 0).Format(chineseDateLayout), Contact: hideContact(user.Cont), }, nil diff --git a/frontend/vben/src/views/dashboard/workbench/components/WorkbenchHeader.vue b/frontend/vben/src/views/dashboard/workbench/components/WorkbenchHeader.vue index 5854550..0a94935 100644 --- a/frontend/vben/src/views/dashboard/workbench/components/WorkbenchHeader.vue +++ b/frontend/vben/src/views/dashboard/workbench/components/WorkbenchHeader.vue @@ -15,9 +15,13 @@ {{ userinfo.desc }}
+
+ 您已加入 + {{ enterDays }}天 +
课程组人数 - {{ userscount }} + {{ userscount }}人
@@ -31,6 +35,10 @@ const userStore = useUserStore() const userinfo = computed(() => userStore.getUserInfo) + const enterDays = computed(() => { + const date: Date = new Date(new Date().getTime() - userStore.getUserInfo.date * 1000) + return date.getDay() + }) const userscount = ref(0) getUsersCount().then((value: number) => { userscount.value = value diff --git a/frontend/vben/types/store.d.ts b/frontend/vben/types/store.d.ts index b2b3c62..3e9794c 100644 --- a/frontend/vben/types/store.d.ts +++ b/frontend/vben/types/store.d.ts @@ -30,7 +30,7 @@ export interface UserInfo { desc?: string homePath?: string roles: RoleInfo[] - date: string + date: number last: string contact: string }