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/skeleton/skeleton.js | 118 ----------------------------------------------------------
1 files changed, 1 insertions(+), 117 deletions(-)
diff --git a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
index 3356e6c..fdcd2b2 100644
--- a/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
+++ b/miniprogram_npm/tdesign-miniprogram/skeleton/skeleton.js
@@ -1,117 +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 { isNumber, classNames } from '../common/utils';
-const { prefix } = config;
-const name = `${prefix}-skeleton`;
-const ThemeMap = {
- avatar: [{ type: 'circle', size: '96rpx' }],
- image: [{ type: 'rect', size: '144rpx' }],
- text: [
- [
- { width: '24%', height: '32rpx', marginRight: '32rpx' },
- { width: '76%', height: '32rpx' },
- ],
- 1,
- ],
- paragraph: [1, 1, 1, { width: '55%' }],
-};
-let Skeleton = class Skeleton extends SuperComponent {
- constructor() {
- super(...arguments);
- this.externalClasses = [`${prefix}-class`, `${prefix}-class-col`, `${prefix}-class-row`];
- this.properties = props;
- this.data = {
- prefix,
- classPrefix: name,
- parsedRowcols: [],
- };
- this.observers = {
- rowCol() {
- this.init();
- },
- };
- this.lifetimes = {
- attached() {
- this.init();
- },
- };
- this.methods = {
- init() {
- const { theme, rowCol } = this.properties;
- const rowCols = [];
- if (rowCol.length) {
- rowCols.push(...rowCol);
- }
- else {
- rowCols.push(...ThemeMap[theme || 'text']);
- }
- const parsedRowcols = rowCols.map((item) => {
- if (isNumber(item)) {
- return [
- {
- class: this.getColItemClass({ type: 'text' }),
- style: {},
- },
- ];
- }
- if (Array.isArray(item)) {
- return item.map((col) => {
- return Object.assign(Object.assign({}, col), { class: this.getColItemClass(col), style: this.getColItemStyle(col) });
- });
- }
- const nItem = item;
- return [
- Object.assign(Object.assign({}, nItem), { class: this.getColItemClass(nItem), style: this.getColItemStyle(nItem) }),
- ];
- });
- this.setData({
- parsedRowcols,
- });
- },
- getColItemClass(obj) {
- return classNames([
- `${name}__col`,
- `${name}--type-${obj.type || 'text'}`,
- `${name}--animation-${this.properties.animation}`,
- ]);
- },
- getColItemStyle(obj) {
- const styleName = [
- 'width',
- 'height',
- 'marginRight',
- 'marginLeft',
- 'margin',
- 'size',
- 'background',
- 'backgroundColor',
- 'borderRadius',
- ];
- const style = {};
- styleName.forEach((name) => {
- if (name in obj) {
- const px = isNumber(obj[name]) ? `${obj[name]}px` : obj[name];
- if (name === 'size') {
- [style.width, style.height] = [px, px];
- }
- else {
- style[name] = px;
- }
- }
- });
- return style;
- },
- };
- }
-};
-Skeleton = __decorate([
- wxComponent()
-], Skeleton);
-export default Skeleton;
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{classNames}from"../common/utils";import{isNumber}from"../common/validator";const{prefix:prefix}=config,name=`${prefix}-skeleton`,ThemeMap={avatar:[{type:"circle",size:"96rpx"}],image:[{type:"rect",size:"144rpx"}],text:[[{width:"24%",height:"32rpx",marginRight:"32rpx"},{width:"76%",height:"32rpx"}],1],paragraph:[1,1,1,{width:"55%"}]};let Skeleton=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-col`,`${prefix}-class-row`],this.properties=props,this.timer=void 0,this.data={prefix:prefix,classPrefix:name,parsedRowCols:[]},this.observers={rowCol(){this.init()},"loading, delay"(){this.isShowSkeleton()}},this.lifetimes={attached(){this.init(),this.isShowSkeleton()},detached(){this.clearTimer()}},this.methods={init(){const{theme:e,rowCol:t}=this.properties,s=[];t.length?s.push(...t):s.push(...ThemeMap[e||"text"]);const i=s.map(e=>{if(isNumber(e))return new Array(e).fill({class:this.getColItemClass({type:"text"}),style:{}});if(Array.isArray(e))return e.map(e=>Object.assign(Object.assign({},e),{class:this.getColItemClass(e),style:this.getColItemStyle(e)}));const t=e;return[Object.assign(Object.assign({},t),{class:this.getColItemClass(t),style:this.getColItemStyle(t)})]});this.setData({parsedRowCols:i})},getColItemClass(e){return classNames([`${name}__col`,`${name}--type-${e.type||"text"}`,`${name}--animation-${this.properties.animation}`])},getColItemStyle(e){const t={};return["width","height","marginRight","marginLeft","margin","size","background","backgroundColor","borderRadius"].forEach(s=>{if(s in e){const i=isNumber(e[s])?`${e[s]}px`:e[s];"size"===s?[t.width,t.height]=[i,i]:t[s]=i}}),t},clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)},isShowSkeleton(){this.clearTimer();const{loading:e,delay:t}=this.properties;e&&0!==t?this.timer=setTimeout(()=>{this.setData({isShow:this.properties.loading})},t):this.setData({isShow:e})}}}};Skeleton=__decorate([wxComponent()],Skeleton);export default Skeleton;
\ No newline at end of file
--
Gitblit v1.9.3