From 3282e95db0207ee133d1e98d9771dec9d83b0fc4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 02 四月 2026 16:24:38 +0800
Subject: [PATCH] 2026.4.2 新增专题管理功能
---
miniprogram_npm/tdesign-miniprogram/count-down/utils.js | 62 ------------------------------
1 files changed, 1 insertions(+), 61 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/utils.js b/miniprogram_npm/tdesign-miniprogram/count-down/utils.js
index 4aa6dc3..fb7c666 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/utils.js
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/utils.js
@@ -1,61 +1 @@
-export const TimeDataUnit = {
- DD: '澶�',
- HH: '鏃�',
- mm: '鍒�',
- ss: '绉�',
- SSS: '姣',
-};
-const SECOND = 1000;
-const MINUTE = 60 * SECOND;
-const HOUR = 60 * MINUTE;
-const DAY = 24 * HOUR;
-export const parseTimeData = function (time) {
- const days = Math.floor(time / DAY);
- const hours = Math.floor((time % DAY) / HOUR);
- const minutes = Math.floor((time % HOUR) / MINUTE);
- const seconds = Math.floor((time % MINUTE) / SECOND);
- const milliseconds = Math.floor(time % SECOND);
- return {
- DD: days,
- HH: hours,
- mm: minutes,
- ss: seconds,
- SSS: milliseconds,
- };
-};
-export const isSameSecond = function (time1, time2) {
- return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
-};
-export const parseFormat = function (time, format) {
- const obj = {
- 'D+': Math.floor(time / 86400000),
- 'H+': Math.floor((time % 86400000) / 3600000),
- 'm+': Math.floor((time % 3600000) / 60000),
- 's+': Math.floor((time % 60000) / 1000),
- 'S+': Math.floor(time % 1000),
- };
- const timeList = [];
- let timeText = format;
- Object.keys(obj).forEach((prop) => {
- if (new RegExp(`(${prop})`).test(timeText)) {
- timeText = timeText.replace(RegExp.$1, (match, offset, source) => {
- const v = `${obj[prop]}`;
- let digit = v;
- if (match.length > 1) {
- digit = (match.replace(new RegExp(match[0], 'g'), '0') + v).substr(v.length);
- }
- const unit = source.substr(offset + match.length);
- const last = timeList[timeList.length - 1];
- if (last) {
- const index = last.unit.indexOf(match);
- if (index !== -1) {
- last.unit = last.unit.substr(0, index);
- }
- }
- timeList.push({ digit, unit, match });
- return digit;
- });
- }
- });
- return { timeText, timeList };
-};
+export const TimeDataUnit={DD:"澶�",HH:"鏃�",mm:"鍒�",ss:"绉�",SSS:"姣"};const SECOND=1e3,MINUTE=6e4,HOUR=36e5,DAY=24*HOUR;export const parseTimeData=function(t){return{DD:Math.floor(t/DAY),HH:Math.floor(t%DAY/HOUR),mm:Math.floor(t%HOUR/6e4),ss:Math.floor(t%6e4/1e3),SSS:Math.floor(t%1e3)}};export const isSameSecond=function(t,e){return Math.floor(t/1e3)===Math.floor(e/1e3)};export const parseFormat=function(t,e){const o={"D+":Math.floor(t/864e5),"H+":Math.floor(t%864e5/36e5),"m+":Math.floor(t%36e5/6e4),"s+":Math.floor(t%6e4/1e3),"S+":Math.floor(t%1e3)},r=[];let n=e;return Object.keys(o).forEach(t=>{new RegExp(`(${t})`).test(n)&&(n=n.replace(RegExp.$1,(e,n,s)=>{const a=`${o[t]}`;let l=a;e.length>1&&(l=(e.replace(new RegExp(e[0],"g"),"0")+a).substr(a.length));const h=s.substr(n+e.length),c=r[r.length-1];if(c){const t=c.unit.indexOf(e);-1!==t&&(c.unit=c.unit.substr(0,t))}return r.push({digit:l,unit:h,match:e}),l}))}),{timeText:n,timeList:r}};
\ No newline at end of file
--
Gitblit v1.9.3