From 51f0be0fec4ecfcfe69d6912d1bf11de5876fc3b Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Tue, 13 Oct 2020 16:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=8E=86=E6=A0=B7=E5=BC=8F=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 4 + src/utils/date.ts | 31 ++++++ src/views/regime/date.vue | 2 +- src/views/regime/week.vue | 225 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 src/views/regime/week.vue diff --git a/src/router/index.ts b/src/router/index.ts index 52b7dcf..583f76c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -96,6 +96,10 @@ const routes: Array = [ { path: "date", component: () => import("../views/regime/date.vue") + }, + { + path: "week", + component: () => import("../views/regime/week.vue") } ] }, diff --git a/src/utils/date.ts b/src/utils/date.ts index 58b3640..36d0dbe 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -48,3 +48,34 @@ export function getdate(yue?: number){ return {date, year, yue, day, zhou}; } + +export function getweek(zhou?: number){ + let now = dayjs() + if(zhou != undefined){ + now = now.day(now.day() + (zhou * 6)); + } + const yue = now.month() + 1; + const day = now.date() // 当前天 + zhou = now.day(); // 当前周几 + const year = now.year() + interface Date{ + day: string; + list?: Array; + } + const date: Array = []; + for(let i = 0; i < 7; i++){ + console.log(i); + now = now.day(i + 1) + date[i] = {day: ""}; + date[i].day = now.year() + "-" + (now.month() < 10 ? '0' + now.month() : now.month()) + "-" + (now.date() < 10 ? '0' + now.date() : now.date()) + date[i].list = [] + for(let j = 0;j < 24; j++){ + date[i].list?.push({ + start:"", + num:"" + }) + } + } + console.log(date) + return {date, year, yue, day, zhou} +} \ No newline at end of file diff --git a/src/views/regime/date.vue b/src/views/regime/date.vue index afbbd55..2a54c8c 100644 --- a/src/views/regime/date.vue +++ b/src/views/regime/date.vue @@ -179,9 +179,9 @@ >div::last-child{ border: unset; } - } } } + } } diff --git a/src/views/regime/week.vue b/src/views/regime/week.vue new file mode 100644 index 0000000..deb160f --- /dev/null +++ b/src/views/regime/week.vue @@ -0,0 +1,225 @@ + + + \ No newline at end of file