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/image-viewer/image-viewer.js |  152 --------------------------------------------------
 1 files changed, 1 insertions(+), 151 deletions(-)

diff --git a/miniprogram_npm/tdesign-miniprogram/image-viewer/image-viewer.js b/miniprogram_npm/tdesign-miniprogram/image-viewer/image-viewer.js
index 4b319ff..2de47d7 100644
--- a/miniprogram_npm/tdesign-miniprogram/image-viewer/image-viewer.js
+++ b/miniprogram_npm/tdesign-miniprogram/image-viewer/image-viewer.js
@@ -1,151 +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 { styles, calcIcon } from '../common/utils';
-import { SuperComponent, wxComponent } from '../common/src/index';
-import config from '../common/config';
-import props from './props';
-const { prefix } = config;
-const name = `${prefix}-image-viewer`;
-let ImageViewer = class ImageViewer extends SuperComponent {
-    constructor() {
-        super(...arguments);
-        this.externalClasses = [`${prefix}-class`];
-        this.properties = Object.assign({}, props);
-        this.data = {
-            prefix,
-            classPrefix: name,
-            currentSwiperIndex: 0,
-            windowHeight: 0,
-            windowWidth: 0,
-            swiperStyle: {},
-            imagesStyle: {},
-            maskTop: 0,
-        };
-        this.options = {
-            multipleSlots: true,
-        };
-        this.controlledProps = [
-            {
-                key: 'visible',
-                event: 'close',
-            },
-        ];
-        this.observers = {
-            visible(value) {
-                this.setData({
-                    currentSwiperIndex: value ? this.properties.initialIndex : 0,
-                });
-            },
-            closeBtn(v) {
-                this.setData({
-                    _closeBtn: calcIcon(v, 'close'),
-                });
-            },
-            deleteBtn(v) {
-                this.setData({
-                    _deleteBtn: calcIcon(v, 'delete'),
-                });
-            },
-        };
-        this.methods = {
-            calcMaskTop() {
-                if (this.data.usingCustomNavbar) {
-                    const rect = (wx === null || wx === void 0 ? void 0 : wx.getMenuButtonBoundingClientRect()) || null;
-                    const { statusBarHeight } = wx.getSystemInfoSync();
-                    if (rect && statusBarHeight) {
-                        this.setData({
-                            maskTop: rect.top - statusBarHeight + rect.bottom,
-                        });
-                    }
-                }
-            },
-            saveScreenSize() {
-                const { windowHeight, windowWidth } = wx.getSystemInfoSync();
-                this.setData({
-                    windowHeight,
-                    windowWidth,
-                });
-            },
-            calcImageDisplayStyle(imageWidth, imageHeight) {
-                const { windowWidth, windowHeight } = this.data;
-                const ratio = imageWidth / imageHeight;
-                if (imageWidth < windowWidth && imageHeight < windowHeight) {
-                    return {
-                        styleObj: {
-                            width: `${imageWidth * 2}rpx`,
-                            height: `${imageHeight * 2}rpx`,
-                            left: '50%',
-                            transform: 'translate(-50%, -50%)',
-                        },
-                    };
-                }
-                if (ratio >= 1) {
-                    return {
-                        styleObj: {
-                            width: '100vw',
-                            height: `${(windowWidth / ratio) * 2}rpx`,
-                        },
-                    };
-                }
-                const scaledHeight = ratio * windowHeight * 2;
-                if (scaledHeight < windowWidth) {
-                    return {
-                        styleObj: {
-                            width: `${scaledHeight}rpx`,
-                            height: '100vh',
-                            left: '50%',
-                            transform: 'translate(-50%, -50%)',
-                        },
-                    };
-                }
-                return {
-                    styleObj: {
-                        width: '100vw',
-                        height: `${(windowWidth / imageWidth) * imageHeight * 2}rpx`,
-                    },
-                };
-            },
-            onImageLoadSuccess(e) {
-                const { detail: { width, height }, currentTarget: { dataset: { index }, }, } = e;
-                const { mode, styleObj } = this.calcImageDisplayStyle(width, height);
-                const originImagesStyle = this.data.imagesStyle;
-                const originSwiperStyle = this.data.swiperStyle;
-                this.setData({
-                    swiperStyle: Object.assign(Object.assign({}, originSwiperStyle), { [index]: {
-                            style: `height: ${styleObj.height}`,
-                        } }),
-                    imagesStyle: Object.assign(Object.assign({}, originImagesStyle), { [index]: {
-                            mode,
-                            style: styles(Object.assign({}, styleObj)),
-                        } }),
-                });
-            },
-            onSwiperChange(e) {
-                const { detail: { current }, } = e;
-                this.setData({
-                    currentSwiperIndex: current,
-                });
-                this._trigger('change', { index: current });
-            },
-            onClose(e) {
-                const { source } = e.currentTarget.dataset;
-                this._trigger('close', { visible: false, trigger: source || 'button', index: this.data.currentSwiperIndex });
-            },
-            onDelete() {
-                this._trigger('delete', { index: this.data.currentSwiperIndex });
-            },
-        };
-    }
-    ready() {
-        this.saveScreenSize();
-        this.calcMaskTop();
-    }
-};
-ImageViewer = __decorate([
-    wxComponent()
-], ImageViewer);
-export default ImageViewer;
+import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import{styles,calcIcon,systemInfo}from"../common/utils";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-image-viewer`;let ImageViewer=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`],this.properties=Object.assign({},props),this.data={prefix:prefix,classPrefix:name,currentSwiperIndex:0,loadedImageIndexes:[],windowHeight:0,windowWidth:0,swiperStyle:{},imagesStyle:{},maskTop:0},this.options={multipleSlots:!0},this.controlledProps=[{key:"visible",event:"close"}],this.observers={"visible,initialIndex,images"(e,t,s){e&&(null==s?void 0:s.length)&&this.setData({loadedImageIndexes:[],currentSwiperIndex:t>=s.length?s.length-1:t})},closeBtn(e){this.setData({_closeBtn:calcIcon(e,"close")})},deleteBtn(e){this.setData({_deleteBtn:calcIcon(e,"delete")})}},this.methods={calcMaskTop(){if(this.data.usingCustomNavbar){const e=(null===wx||void 0===wx?void 0:wx.getMenuButtonBoundingClientRect())||null,{statusBarHeight:t}=systemInfo;e&&t&&this.setData({maskTop:e.top-t+e.bottom})}},saveScreenSize(){const{windowHeight:e,windowWidth:t}=systemInfo;this.setData({windowHeight:e,windowWidth:t})},calcImageDisplayStyle(e,t){const{windowWidth:s,windowHeight:i}=this.data,a=e/t;if(e<s&&t<i)return{styleObj:{width:2*e+"rpx",height:2*t+"rpx",left:"50%",transform:"translate(-50%, -50%)"}};if(a>=1)return{styleObj:{width:"100vw",height:s/a*2+"rpx"}};const n=a*i*2;return n<s?{styleObj:{width:`${n}rpx`,height:"100vh",left:"50%",transform:"translate(-50%, -50%)"}}:{styleObj:{width:"100vw",height:s/e*t*2+"rpx"}}},onImageLoadSuccess(e){const{detail:{width:t,height:s},currentTarget:{dataset:{index:i}}}=e,{mode:a,styleObj:n}=this.calcImageDisplayStyle(t,s),o=this.data.imagesStyle,r=this.data.swiperStyle;this.data.loadedImageIndexes.includes(i)||this.setData({loadedImageIndexes:[...this.data.loadedImageIndexes,i]}),this.setData({swiperStyle:Object.assign(Object.assign({},r),{[i]:{style:`height: ${n.height}`}}),imagesStyle:Object.assign(Object.assign({},o),{[i]:{mode:a,style:styles(Object.assign({},n))}})})},onSwiperChange(e){const{detail:{current:t}}=e;this.setData({currentSwiperIndex:t}),this._trigger("change",{index:t})},onClose(e){const{source:t}=e.currentTarget.dataset;this._trigger("close",{visible:!1,trigger:t||"button",index:this.data.currentSwiperIndex})},onDelete(){this._trigger("delete",{index:this.data.currentSwiperIndex})}}}ready(){this.saveScreenSize(),this.calcMaskTop()}};ImageViewer=__decorate([wxComponent()],ImageViewer);export default ImageViewer;
\ No newline at end of file

--
Gitblit v1.9.3