From 3837e9d3a724bf92ae3eec6ebbe401f74424e28c Mon Sep 17 00:00:00 2001 From: rsgltzyd Date: Tue, 17 Sep 2024 11:08:56 +0800 Subject: [PATCH] checkout init --- src/components/ContentCard.vue | 76 ++++ src/components/CustomCalendar.js | 78 ++++ src/components/CustomCalendar.vue | 126 +++++++ src/components/CustomPoem.vue | 83 +++++ src/components/PersonInfo.vue | 23 ++ src/components/TestApi.vue | 36 ++ src/components/XiaoMiLogin.vue | 340 ++++++++++++++++++ src/components/icons/IconCircleToTheLeft.vue | 25 ++ src/components/icons/IconCircleToTheRight.vue | 25 ++ src/views/HomeView.vue | 4 +- 10 files changed, 814 insertions(+), 2 deletions(-) create mode 100644 src/components/ContentCard.vue create mode 100644 src/components/CustomCalendar.js create mode 100644 src/components/CustomCalendar.vue create mode 100644 src/components/CustomPoem.vue create mode 100644 src/components/PersonInfo.vue create mode 100644 src/components/TestApi.vue create mode 100644 src/components/XiaoMiLogin.vue create mode 100644 src/components/icons/IconCircleToTheLeft.vue create mode 100644 src/components/icons/IconCircleToTheRight.vue diff --git a/src/components/ContentCard.vue b/src/components/ContentCard.vue new file mode 100644 index 0000000..30dab3c --- /dev/null +++ b/src/components/ContentCard.vue @@ -0,0 +1,76 @@ + + + + \ No newline at end of file diff --git a/src/components/CustomCalendar.js b/src/components/CustomCalendar.js new file mode 100644 index 0000000..183f44a --- /dev/null +++ b/src/components/CustomCalendar.js @@ -0,0 +1,78 @@ + + +const weekDayNumber = 7; +const week_zh_cn = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; +const week_en_us = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]; + +class Day { + constructor(year, month, day, content, isCurrentMonth = false, isCurrentDay = false) { + this.year = year; + this.month = month; + this.day = day; + this.content = content; + this.isCurrentMonth = isCurrentMonth; + this.isCurrentDay = isCurrentDay + } +} + +const defaultDate = new Date(); +const defaultYear = defaultDate.getFullYear() +const defaultMonth = defaultDate.getMonth() +const defaultDay = defaultDate.getDate() + +/** + * 初始化日历 + * @param {[Day]} currentDays + * @param {number} [year = defaultYear] + * @param {number} [month = defaultMonth] + * @param {number} [day = defaultDay] + * @returns {[Day]} + */ +function initDay(currentDays = new Array(42), year = defaultYear, month = defaultMonth, day = defaultDay) { + + if (!Array.isArray(currentDays)) { + currentDays = new Array(42); + } else if (currentDays.length != 42) { + console.log(currentDays); + throw new Error(currentDays) + } else { + currentDays = [...currentDays]; + } + + const days = currentDays; + const firstDayOfMonth = new Date(year, month, 1); + const lastDayOfMonth = new Date(year, month + 1, 0); + const currentDaysOfMonth = lastDayOfMonth.getDate(); + + for (let i = 0; i < firstDayOfMonth.getDay(); i++) { + days[i] = new Day('', ''); + } + + for (let i = 0; i < currentDaysOfMonth; i++) { + const weekDay = (firstDayOfMonth.getDay() + i) % weekDayNumber; + days[firstDayOfMonth.getDay() + i] = new Day(year, month, i + 1, week_zh_cn[weekDay], true); + if (i === day - 1) { + days[firstDayOfMonth.getDay() + i].isCurrentDay = true; + } + } + + for (let i = currentDaysOfMonth + firstDayOfMonth.getDay(); i < days.length; i++) { + const extraDay = i - currentDaysOfMonth - firstDayOfMonth.getDay() + 1; + const weekDay = i % weekDayNumber; + days[i] = new Day(year, month + 1, extraDay, week_zh_cn[weekDay]); + } + + return currentDays; +} + +export { week_zh_cn, week_en_us, defaultYear, defaultMonth, defaultDay, initDay }; + + + + + + + + + + diff --git a/src/components/CustomCalendar.vue b/src/components/CustomCalendar.vue new file mode 100644 index 0000000..5aebb36 --- /dev/null +++ b/src/components/CustomCalendar.vue @@ -0,0 +1,126 @@ + + + + + diff --git a/src/components/CustomPoem.vue b/src/components/CustomPoem.vue new file mode 100644 index 0000000..eb0f102 --- /dev/null +++ b/src/components/CustomPoem.vue @@ -0,0 +1,83 @@ + + + + + \ No newline at end of file diff --git a/src/components/PersonInfo.vue b/src/components/PersonInfo.vue new file mode 100644 index 0000000..0708e9b --- /dev/null +++ b/src/components/PersonInfo.vue @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/src/components/TestApi.vue b/src/components/TestApi.vue new file mode 100644 index 0000000..7620fb7 --- /dev/null +++ b/src/components/TestApi.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/src/components/XiaoMiLogin.vue b/src/components/XiaoMiLogin.vue new file mode 100644 index 0000000..3cfd7d6 --- /dev/null +++ b/src/components/XiaoMiLogin.vue @@ -0,0 +1,340 @@ + + + diff --git a/src/components/icons/IconCircleToTheLeft.vue b/src/components/icons/IconCircleToTheLeft.vue new file mode 100644 index 0000000..f4b454b --- /dev/null +++ b/src/components/icons/IconCircleToTheLeft.vue @@ -0,0 +1,25 @@ + diff --git a/src/components/icons/IconCircleToTheRight.vue b/src/components/icons/IconCircleToTheRight.vue new file mode 100644 index 0000000..ebeabb4 --- /dev/null +++ b/src/components/icons/IconCircleToTheRight.vue @@ -0,0 +1,25 @@ + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 6bb706f..72c1143 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,9 +1,9 @@