From 59c030171dae778402cbe2fc1185178d06daa75c Mon Sep 17 00:00:00 2001 From: xjh22222228 Date: Tue, 1 Oct 2024 16:22:46 +0800 Subject: [PATCH 1/2] feat(component): add holiday component --- scripts/start.mjs | 15 ++ scripts/util.mjs | 1 + src/app/app.module.ts | 4 + src/assets/img/component/rest.svg | 147 ------------------ src/assets/img/component/runtime.svg | 1 - src/components/calendar/index.component.scss | 1 - src/components/calendar/index.component.ts | 4 +- .../component-group/index.component.html | 1 + .../component-group/index.component.scss | 8 +- src/components/countdown/index.component.scss | 1 - .../create-web/index.component.html | 2 - src/components/create-web/index.component.ts | 9 +- .../holiday/drawer/index.component.html | 68 ++++++++ .../holiday/drawer/index.component.scss | 0 .../holiday/drawer/index.component.ts | 90 +++++++++++ src/components/holiday/index.component.html | 30 ++++ src/components/holiday/index.component.scss | 81 ++++++++++ src/components/holiday/index.component.ts | 79 ++++++++++ src/components/html/index.component.scss | 1 - .../image/drawer/index.component.html | 7 + .../image/drawer/index.component.ts | 1 + src/components/image/index.component.html | 2 + src/components/image/index.component.scss | 1 - src/components/image/index.component.ts | 3 +- src/components/off-work/index.component.html | 7 +- src/components/off-work/index.component.scss | 1 - src/components/runtime/index.component.html | 5 +- src/components/runtime/index.component.scss | 1 - src/components/swiper/index.component.html | 2 +- src/locale/english.ts | 7 +- src/locale/zh_CN.ts | 5 +- src/types/index.ts | 1 + src/utils/index.ts | 6 +- src/view/light/index.component.scss | 2 +- src/view/side/index.component.scss | 1 + src/view/sim/index.component.scss | 3 +- src/view/super/index.component.scss | 3 +- .../system/component/index.component.html | 2 + src/view/system/component/index.component.ts | 3 + src/view/system/component/types.ts | 1 + src/view/system/web/index.component.html | 17 +- src/view/system/web/index.component.scss | 2 +- src/view/system/web/index.component.ts | 2 + 43 files changed, 439 insertions(+), 189 deletions(-) delete mode 100644 src/assets/img/component/rest.svg delete mode 100644 src/assets/img/component/runtime.svg create mode 100644 src/components/holiday/drawer/index.component.html create mode 100644 src/components/holiday/drawer/index.component.scss create mode 100644 src/components/holiday/drawer/index.component.ts create mode 100644 src/components/holiday/index.component.html create mode 100644 src/components/holiday/index.component.scss create mode 100644 src/components/holiday/index.component.ts diff --git a/scripts/start.mjs b/scripts/start.mjs index f36eedcd2..4aaafca94 100644 --- a/scripts/start.mjs +++ b/scripts/start.mjs @@ -120,6 +120,7 @@ try { type: 4, id: -4, url: 'https://gcore.jsdelivr.net/gh/xjh22222228/public@gh-pages/nav/component1.jpg', + go: '', text: '只有认可,才能强大', } if (idx >= 0) { @@ -183,6 +184,20 @@ try { } else { components.push(html) } + idx = components.findIndex((item) => item.type === 7) + const holiday = { + type: 7, + id: -7, + items: [], + } + if (idx >= 0) { + components[idx] = { + ...holiday, + ...components[idx], + } + } else { + components.push(holiday) + } fs.writeFileSync(componentPath, JSON.stringify(components)) } diff --git a/scripts/util.mjs b/scripts/util.mjs index 86b0e0f4d..d770ef59b 100644 --- a/scripts/util.mjs +++ b/scripts/util.mjs @@ -78,6 +78,7 @@ export function setWeb(nav, settings, tags = []) { if (typeof item.icon === 'string' && item.icon.startsWith('icon')) { item.icon = '' } + item.icon = replaceJsdelivrCDN(item.icon, settings) } function formatDate(item) { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3c527b425..e0f245f0c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -79,6 +79,8 @@ import { CountdownComponent } from '../components/countdown/index.component' import { CountdownDrawerComponent } from '../components/countdown/drawer/index.component' import { HTMLComponent } from '../components/html/index.component' import { HTMLDrawerComponent } from '../components/html/drawer/index.component' +import { HolidayComponent } from '../components/holiday/index.component' +import { HolidayDrawerComponent } from '../components/holiday/drawer/index.component' import LightComponent from '../view/light/index.component' import SuperComponent from '../view/super/index.component' @@ -175,6 +177,8 @@ const icons: IconDefinition[] = [ CountdownDrawerComponent, HTMLComponent, HTMLDrawerComponent, + HolidayComponent, + HolidayDrawerComponent, OffWorkDrawerComponent, CalendarDrawerComponent, ComponentGroupComponent, diff --git a/src/assets/img/component/rest.svg b/src/assets/img/component/rest.svg deleted file mode 100644 index bb2fae545..000000000 --- a/src/assets/img/component/rest.svg +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/assets/img/component/runtime.svg b/src/assets/img/component/runtime.svg deleted file mode 100644 index 646e11104..000000000 --- a/src/assets/img/component/runtime.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/calendar/index.component.scss b/src/components/calendar/index.component.scss index e4a662806..b28b3c070 100644 --- a/src/components/calendar/index.component.scss +++ b/src/components/calendar/index.component.scss @@ -1,7 +1,6 @@ .calendar { width: 130px; height: var(--componentHeight); - max-width: 100%; max-height: 100%; border-radius: 12px; text-align: center; diff --git a/src/components/calendar/index.component.ts b/src/components/calendar/index.component.ts index 8b593fb4e..240b57d57 100644 --- a/src/components/calendar/index.component.ts +++ b/src/components/calendar/index.component.ts @@ -15,14 +15,14 @@ export class CalendarComponent { @Input() data!: IComponentProps date = '' - day = 0 + day = '' week = '' dayOfYear = 0 constructor() { const date = getDateTime() this.date = `${date.year}年${date.month}月` - this.day = date.date + this.day = date.zeroDate this.week = date.dayText this.dayOfYear = getDayOfYear() } diff --git a/src/components/component-group/index.component.html b/src/components/component-group/index.component.html index 8aa4ea008..93fd3405a 100644 --- a/src/components/component-group/index.component.html +++ b/src/components/component-group/index.component.html @@ -15,6 +15,7 @@ [data]="item" [class.hidden]="!item['html']" /> + diff --git a/src/components/component-group/index.component.scss b/src/components/component-group/index.component.scss index 15bcf4667..fa008634f 100644 --- a/src/components/component-group/index.component.scss +++ b/src/components/component-group/index.component.scss @@ -21,15 +21,21 @@ user-select: none; column-gap: 15px; justify-content: flex-start; + max-width: 100%; &.directionCol { flex-wrap: wrap; justify-content: center; row-gap: 15px; overflow-x: hidden; + ::ng-deep { + > .ng-star-inserted, + .citems { + max-width: 100%; + } + } } ::ng-deep { > .ng-star-inserted { - max-width: 100%; animation-duration: 0.5s; animation-fill-mode: both; animation-name: zoomInDown; diff --git a/src/components/countdown/index.component.scss b/src/components/countdown/index.component.scss index e19d70663..7b9f81dbf 100644 --- a/src/components/countdown/index.component.scss +++ b/src/components/countdown/index.component.scss @@ -2,7 +2,6 @@ position: relative; width: 160px; height: var(--componentHeight); - max-width: 100%; max-height: 100%; border-radius: 12px; overflow: hidden; diff --git a/src/components/create-web/index.component.html b/src/components/create-web/index.component.html index 16be5d81a..1f2008f50 100644 --- a/src/components/create-web/index.component.html +++ b/src/components/create-web/index.component.html @@ -35,7 +35,6 @@ @@ -132,7 +131,6 @@