diff --git a/Web/package-lock.json b/Web/package-lock.json index 0fec814..e06cb01 100644 --- a/Web/package-lock.json +++ b/Web/package-lock.json @@ -1856,9 +1856,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1876,9 +1873,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1896,9 +1890,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1916,9 +1907,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1936,9 +1924,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1956,9 +1941,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1976,9 +1958,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1996,9 +1975,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2220,9 +2196,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2240,9 +2213,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2260,9 +2230,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2280,9 +2247,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2300,9 +2264,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2320,9 +2281,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2340,9 +2298,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2360,9 +2315,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2594,9 +2546,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2614,9 +2563,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2634,9 +2580,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2654,9 +2597,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2674,9 +2614,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2694,9 +2631,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2714,9 +2648,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2734,9 +2665,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2959,9 +2887,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2983,9 +2908,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3007,9 +2929,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3031,9 +2950,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3055,9 +2971,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3079,9 +2992,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3572,9 +3482,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3589,9 +3496,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3606,9 +3510,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3623,9 +3524,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3640,9 +3538,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3657,9 +3552,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3674,9 +3566,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3691,9 +3580,6 @@ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3708,9 +3594,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3725,9 +3608,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3742,9 +3622,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3759,9 +3636,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -3776,9 +3650,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ diff --git a/Web/src/config/BaseConfig.ts b/Web/src/config/BaseConfig.ts index 5ef10a7..18c1514 100644 --- a/Web/src/config/BaseConfig.ts +++ b/Web/src/config/BaseConfig.ts @@ -2,8 +2,8 @@ 统一配置中心 */ export class BaseConfig { -public static BaseUrl:string="https://localhost:7198"; -public static BaseMediaUrl:string="https://localhost:7198"; -// public static BaseUrl:string="http://kx.iyba.cn:5291"; -// public static BaseMediaUrl:string="http://kx.iyba.cn:5291"; -} \ No newline at end of file + public static BaseUrl: string = 'https://192.168.0.142:7198' + public static BaseMediaUrl: string = 'https://192.168.0.142:7198' + // public static BaseUrl:string="http://kx.iyba.cn:5291"; + // public static BaseMediaUrl:string="http://kx.iyba.cn:5291"; +} diff --git a/Web/src/extends/TimeExtend.ts b/Web/src/extends/TimeExtend.ts index 192bb96..4846fa8 100644 --- a/Web/src/extends/TimeExtend.ts +++ b/Web/src/extends/TimeExtend.ts @@ -1,100 +1,115 @@ export class TimeExtend { - /** - * 格式化日期 - * @param date 日期对象/时间戳/日期字符串 - * @param format 格式化模板 - * 示例:yyyy-MM-dd、yyyy-MM-dd HH:mm:ss、HH:mm:ss、yyyy年MM月dd日 - */ - public static Format(date: Date | string | number, format = 'yyyy-MM-dd HH:mm:ss'): string { - let targetDate: Date - if (typeof date === 'number') { - date = date - 28800; - targetDate = date.toString().length === 10 ? new Date(date * 1000) : new Date(date) - } else { - targetDate = new Date(date) - } - - if (isNaN(targetDate.getTime())) return '' - - const year = targetDate.getFullYear() - const month = targetDate.getMonth() + 1 - const day = targetDate.getDate() - const hours = targetDate.getHours() - const minutes = targetDate.getMinutes() - const seconds = targetDate.getSeconds() - - const pad = (num: number) => num.toString().padStart(2, '0') - - return format - .replace('yyyy', String(year)) - .replace('MM', pad(month)) - .replace('dd', pad(day)) - .replace('HH', pad(hours)) - .replace('hh', pad(hours > 12 ? hours - 12 : hours)) - .replace('mm', pad(minutes)) - .replace('ss', pad(seconds)) + /** + * 格式化日期 + * @param date 日期对象/时间戳/日期字符串 + * @param format 格式化模板 + * 示例:yyyy-MM-dd、yyyy-MM-dd HH:mm:ss、HH:mm:ss、yyyy年MM月dd日 + */ + public static Format(date: Date | string | number, format = 'yyyy-MM-dd HH:mm:ss'): string { + let targetDate: Date + if (typeof date === 'number') { + date = date - 28800 + targetDate = date.toString().length === 10 ? new Date(date * 1000) : new Date(date) + } else { + targetDate = new Date(date) } - /** - * 获取当前时间格式化字符串 - * @param format 格式 - */ - public static Now(format = 'yyyy-MM-dd HH:mm:ss'): string { - return this.Format(new Date(), format) - } + if (isNaN(targetDate.getTime())) return '' - /** - * 获取当前毫秒时间戳 - */ - public static GetTimeStamp(): number { - return Date.now() - } + const year = targetDate.getFullYear() + const month = targetDate.getMonth() + 1 + const day = targetDate.getDate() + const hours = targetDate.getHours() + const minutes = targetDate.getMinutes() + const seconds = targetDate.getSeconds() - /** - * 获取当前秒级时间戳 - */ - public static GetSecondStamp(): number { - return Math.floor(Date.now() / 1000) + 28800 - } + const pad = (num: number) => num.toString().padStart(2, '0') - /** - * 获取当前日期 yyyy-MM-dd - */ - public static GetDateStr(): string { - return this.Now('yyyy-MM-dd') - } + return format + .replace('yyyy', String(year)) + .replace('MM', pad(month)) + .replace('dd', pad(day)) + .replace('HH', pad(hours)) + .replace('hh', pad(hours > 12 ? hours - 12 : hours)) + .replace('mm', pad(minutes)) + .replace('ss', pad(seconds)) + } - /** - * 获取当前时分秒 HH:mm:ss - */ - public static GetTimeStr(): string { - return this.Now('HH:mm:ss') - } + /** + * 获取当前时间格式化字符串 + * @param format 格式 + */ + public static Now(format = 'yyyy-MM-dd HH:mm:ss'): string { + return this.Format(new Date(), format) + } - /** - * 时间字符串 转换为 指定格式字符串 - * 场景:把 "2025-01-01 12:30:45" 转成 "2025年01月01日" / "01-01 12:30" 等 - * @param timeStr 时间字符串(如 2025-01-01、2025/01/01 12:30、2025-01-01 12:30:45) - * @param format 目标格式 - */ - public static StrToFormat(timeStr: string, format = 'yyyy-MM-dd HH:mm:ss'): string { - return this.Format(timeStr, format); - } - /** - * 时间字符串 转 日期对象 - * @param timeStr 时间字符串 - */ - public static StrToDate(timeStr: string): Date | null { - const date = new Date(timeStr); - return isNaN(date.getTime()) ? null : date; - } + /** + * 获取当前毫秒时间戳 + */ + public static GetTimeStamp(): number { + return Date.now() + } - /** - * 时间字符串 转 秒级时间戳 - * @param timeStr 时间字符串 - */ - public static StrToSecondStamp(timeStr: string): number | null { - const date = this.StrToDate(timeStr); - return date ? Math.floor(date.getTime() / 1000) : null; + /** + * 获取当前秒级时间戳 + */ + public static GetSecondStamp(): number { + return Math.floor(Date.now() / 1000) + 28800 + } + + /** + * 获取当前日期 yyyy-MM-dd + */ + public static GetDateStr(): string { + return this.Now('yyyy-MM-dd') + } + + /** + * 获取当前时分秒 HH:mm:ss + */ + public static GetTimeStr(): string { + return this.Now('HH:mm:ss') + } + + /** + * 时间字符串 转换为 指定格式字符串 + * 场景:把 "2025-01-01 12:30:45" 转成 "2025年01月01日" / "01-01 12:30" 等 + * @param timeStr 时间字符串(如 2025-01-01、2025/01/01 12:30、2025-01-01 12:30:45) + * @param format 目标格式 + */ + public static StrToFormat(timeStr: string, format = 'yyyy-MM-dd HH:mm:ss'): string { + return this.Format(timeStr, format) + } + /** + * 时间字符串 转 日期对象 + * @param timeStr 时间字符串 + */ + public static StrToDate(timeStr: string): Date | null { + const date = new Date(timeStr) + return isNaN(date.getTime()) ? null : date + } + + /** + * 时间字符串 转 秒级时间戳 + * @param timeStr 时间字符串 + */ + public static StrToSecondStamp(timeStr: string): number | null { + const date = this.StrToDate(timeStr) + return date ? Math.floor(date.getTime() / 1000) : null + } + + /** + * 计算目标时间与当前时间的剩余分钟数 + * @param timeStr 时间字符串 + */ + public static GetRemainingMinutes(timeStr: string): number { + const target = new Date(timeStr.replace(/-/g, '/')) + const now = new Date() + const diffMs = target.getTime() - now.getTime() + if (Math.floor(diffMs / 1000 / 60) <= 0) { + return 0 + } else { + return Math.floor(diffMs / 1000 / 60) } -} \ No newline at end of file + } +} diff --git a/Web/src/pages/index.vue b/Web/src/pages/index.vue index 33c05f7..461dd5a 100644 --- a/Web/src/pages/index.vue +++ b/Web/src/pages/index.vue @@ -31,8 +31,9 @@