From cf4787bc8188cd0acc8a42793730b076742f29c1 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 16 四月 2026 17:37:35 +0800
Subject: [PATCH] 新增现场巡查模块(待完成)
---
miniprogram_npm/tdesign-miniprogram/count-down/count-down.js | 101 --------------------------------------------------
1 files changed, 1 insertions(+), 100 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/count-down/count-down.js b/miniprogram_npm/tdesign-miniprogram/count-down/count-down.js
index 3582cb4..ada596f 100644
--- a/miniprogram_npm/tdesign-miniprogram/count-down/count-down.js
+++ b/miniprogram_npm/tdesign-miniprogram/count-down/count-down.js
@@ -1,100 +1 @@
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-import { SuperComponent, wxComponent } from '../common/src/index';
-import config from '../common/config';
-import props from './props';
-import { isSameSecond, parseFormat, parseTimeData, TimeDataUnit } from './utils';
-const { prefix } = config;
-const name = `${prefix}-count-down`;
-let CountDown = class CountDown extends SuperComponent {
- constructor() {
- super(...arguments);
- this.externalClasses = [`${prefix}-class`, `${prefix}-class-count`, `${prefix}-class-split`];
- this.properties = props;
- this.observers = {
- time() {
- this.reset();
- },
- };
- this.data = {
- prefix,
- classPrefix: name,
- timeDataUnit: TimeDataUnit,
- timeData: parseTimeData(0),
- formattedTime: '0',
- };
- this.timeoutId = null;
- this.lifetimes = {
- detached() {
- if (this.timeoutId) {
- clearTimeout(this.timeoutId);
- this.timeoutId = null;
- }
- },
- };
- this.methods = {
- start() {
- if (this.counting) {
- return;
- }
- this.counting = true;
- this.endTime = Date.now() + this.remain;
- this.doCount();
- },
- pause() {
- this.counting = false;
- this.timeoutId && clearTimeout(this.timeoutId);
- },
- reset() {
- this.pause();
- this.remain = this.properties.time;
- this.updateTime(this.remain);
- if (this.properties.autoStart) {
- this.start();
- }
- },
- getTime() {
- return Math.max(this.endTime - Date.now(), 0);
- },
- updateTime(remain) {
- const { format } = this.properties;
- this.remain = remain;
- const timeData = parseTimeData(remain);
- this.triggerEvent('change', timeData);
- const { timeText } = parseFormat(remain, format);
- const timeRange = format.split(':');
- this.setData({
- timeRange,
- timeData,
- formattedTime: timeText.replace(/:/g, ' : '),
- });
- if (remain === 0) {
- this.pause();
- this.triggerEvent('finish');
- }
- },
- doCount() {
- this.timeoutId = setTimeout(() => {
- const time = this.getTime();
- if (this.properties.millisecond) {
- this.updateTime(time);
- }
- else if (!isSameSecond(time, this.remain) || time === 0) {
- this.updateTime(time);
- }
- if (time !== 0) {
- this.doCount();
- }
- }, 33);
- },
- };
- }
-};
-CountDown = __decorate([
- wxComponent()
-], CountDown);
-export default CountDown;
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{isSameSecond,parseFormat,parseTimeData,TimeDataUnit}from"./utils";const{prefix:prefix}=config,name=`${prefix}-count-down`;let CountDown=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-count`,`${prefix}-class-split`],this.properties=props,this.observers={time(){this.reset()}},this.data={prefix:prefix,classPrefix:name,timeDataUnit:TimeDataUnit,timeData:parseTimeData(0),formattedTime:"0"},this.timeoutId=null,this.isInitialTime=!1,this.lifetimes={detached(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}},this.methods={start(){this.counting||(this.counting=!0,this.endTime=Date.now()+this.remain,this.doCount())},pause(){this.counting=!1,this.timeoutId&&clearTimeout(this.timeoutId)},reset(){this.pause(),this.remain=this.properties.time,this.updateTime(this.remain),this.properties.autoStart&&this.remain>0&&this.start(),this.isInitialTime=!0},getTime(){return Math.max(this.endTime-Date.now(),0)},updateTime(t){const{format:i}=this.properties;this.remain=t;const e=parseTimeData(t);this.triggerEvent("change",e);const{timeText:s}=parseFormat(t,i),o=i.split(":");this.setData({timeRange:o,timeData:e,formattedTime:s.replace(/:/g," : ")}),0===t&&(this.counting||this.isInitialTime)&&(this.pause(),this.triggerEvent("finish"),this.counting=!1)},doCount(){this.timeoutId=setTimeout(()=>{const t=this.getTime();this.properties.millisecond?this.updateTime(t):isSameSecond(t,this.remain)&&0!==t||this.updateTime(t),0!==t&&this.doCount()},33)}}}};CountDown=__decorate([wxComponent()],CountDown);export default CountDown;
\ No newline at end of file
--
Gitblit v1.9.3