first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:10:55 +08:00
commit 1c24452b6c
1735 changed files with 150474 additions and 0 deletions

View File

@@ -0,0 +1 @@
"use strict";const e=require("../common/props.js"),o={...e.baseProps,autoplay:e.makeBooleanProp(!0),current:e.makeNumberProp(0),direction:e.makeStringProp("horizontal"),displayMultipleItems:e.makeNumberProp(1),duration:e.makeNumberProp(300),easingFunction:e.makeStringProp("default"),height:e.makeNumericProp("192"),interval:e.makeNumberProp(5e3),list:{type:Array,default:()=>[]},loop:e.makeBooleanProp(!0),videoLoop:e.makeBooleanProp(!0),muted:e.makeBooleanProp(!0),nextMargin:e.makeNumericProp("0"),indicatorPosition:e.makeStringProp("bottom"),previousMargin:e.makeNumericProp("0"),snapToEdge:e.makeBooleanProp(!1),indicator:{type:[Boolean,Object],default:!0},imageMode:e.makeStringProp("aspectFill"),valueKey:e.makeStringProp("value"),textKey:e.makeStringProp("text"),autoplayVideo:e.makeBooleanProp(!0),stopPreviousVideo:e.makeBooleanProp(!0),stopAutoplayWhenVideoPlay:e.makeBooleanProp(!1),adjustHeight:e.makeStringProp("highest"),adjustVerticalHeight:e.makeBooleanProp(!1),customIndicatorClass:e.makeStringProp(""),customImageClass:e.makeStringProp(""),customPrevImageClass:e.makeStringProp(""),customNextImageClass:e.makeStringProp(""),customItemClass:e.makeStringProp(""),customPrevClass:e.makeStringProp(""),customNextClass:e.makeStringProp(""),customTextClass:e.makeStringProp(""),customTextStyle:e.makeStringProp("")};exports.swiperProps=o;

View File

@@ -0,0 +1 @@
"use strict";const e=require("../../../../common/vendor.js"),t=require("../common/util.js"),o=require("./types.js");Math||i();const i=()=>"../wd-swiper-nav/wd-swiper-nav.js",n=e.defineComponent({name:"wd-swiper",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"},props:o.swiperProps,emits:["click","change","animationfinish","update:current"],setup(o,{emit:i}){const n=e.useSlots(),s=o,u=i,a=e.ref(s.current),r=e.ref(s.current),l=(e,t=!1)=>{r.value=e,t&&(a.value=e),u("update:current",e)},c=e.ref(!1),{proxy:d}=e.getCurrentInstance(),p=e.ref(t.uuid());e.watch((()=>s.current),(e=>{e<0?s.loop?y():w():e>=s.list.length?s.loop?w():y():h(e)}));const v=e.computed((()=>"wd-swiper__item "+(n.default?"wd-swiper__item--slot":""))),m=e.computed((()=>{const{list:e,direction:o,indicatorPosition:i,indicator:n}=s,u={current:r.value||0,total:e.length||0,direction:o||"horizontal",indicatorPosition:i||"bottom"};return t.isObj(n)&&(u.type=n.type||"dots",u.minShowNum=n.minShowNum||2,u.showControls=n.showControls||!1),u})),f=e=>((e,o)=>{const i=e=>"video"===o?t.isVideoUrl(e):t.isImageUrl(e);return t.isObj(e)?e.type&&["video","image"].includes(e.type)?e.type===o:i(e[s.valueKey]):i(e)})(e,"video");function h(e){e!==r.value&&l(e,!0)}function w(){h(0)}function y(){h(s.list.length-1)}function g(){s.stopAutoplayWhenVideoPlay&&(c.value=!0)}function x(){c.value=!1}function C(e,t,o){let i="";return function(e,t,o){return(e-1+o.length)%o.length===t}(e,t,o)&&(i=s.customPrevClass||s.customPrevImageClass),function(e,t,o){return(e+1+o.length)%o.length===t}(e,t,o)&&(i=s.customNextClass||s.customNextImageClass),i}function j(o){const{current:i,source:n}=o.detail,a=r.value;if(u("change",{current:i,source:n}),i!==r.value){l(i,"autoplay"===n||"touch"===n)}!function(o,i){(function(o){if(s.stopPreviousVideo){const i=s.list[o];if(t.isDef(i)&&f(i)){e.index.createVideoContext(`video-${o}-${p.value}`,d).pause()}}else s.stopAutoplayWhenVideoPlay&&x()})(o),function(o){if(s.autoplayVideo){const i=s.list[o];if(t.isDef(i)&&f(i)){e.index.createVideoContext(`video-${o}-${p.value}`,d).play()}}}(i)}(a,i)}function $(e){const{current:t,source:o}=e.detail;if(t!==r.value){l(t,"autoplay"===o||"touch"===o)}u("animationfinish",{current:t,source:o})}function _(e,t){u("click",{index:e,item:t})}function b({dir:e}){const{list:t,loop:o}=s,i=t.length;let n="next"===e?r.value+1:r.value-1;n=o?"next"===e?(r.value+1)%i:(r.value-1+i)%i:n<0||n>=i?r.value:n,n!==r.value&&h(n)}return(o,i)=>e.e({a:e.f(o.list,((i,n,s)=>e.e({a:f(i)},f(i)?{b:`video-${n}-${p.value}`,c:e.unref(t.addUnit)(o.height),d:e.unref(t.isObj)(i)?i[o.valueKey]:i,e:e.unref(t.isObj)(i)?i.poster:"",f:e.n(`wd-swiper__video ${o.customItemClass} ${C(r.value,n,o.list)}`),g:e.o(g,n),h:e.o(x,n),i:o.videoLoop,j:o.muted,k:o.autoplayVideo,l:e.o((e=>_(n,i)),n)}:{m:e.unref(t.isObj)(i)?i[o.valueKey]:i,n:e.n(`wd-swiper__image ${o.customImageClass} ${o.customItemClass} ${C(r.value,n,o.list)}`),o:e.unref(t.addUnit)(o.height),p:o.imageMode,q:e.o((e=>_(n,i)),n)},{r:e.unref(t.isObj)(i)&&i[o.textKey]},e.unref(t.isObj)(i)&&i[o.textKey]?{s:e.t(i[o.textKey]),t:e.n(`wd-swiper__text ${o.customTextClass}`),v:e.s(o.customTextStyle)}:{},{w:"d-"+s,x:e.r("d",{item:i,index:n},s),y:n}))),b:e.n(v.value),c:o.adjustHeight,d:o.adjustVerticalHeight,e:o.autoplay&&!c.value,f:a.value,g:o.interval,h:o.duration,i:o.loop,j:"vertical"==o.direction,k:o.easingFunction,l:e.unref(t.addUnit)(o.previousMargin),m:e.unref(t.addUnit)(o.nextMargin),n:o.snapToEdge,o:o.displayMultipleItems,p:e.unref(t.addUnit)(o.height),q:e.o(j),r:e.o($),s:o.indicator},o.indicator?e.e({t:e.r("indicator",{current:r.value,total:o.list.length}),v:!o.$slots.indicator},o.$slots.indicator?{}:{w:e.o(b),x:e.p({"custom-class":o.customIndicatorClass,type:m.value.type,current:m.value.current,total:m.value.total,direction:m.value.direction,"indicator-position":m.value.indicatorPosition,"min-show-num":m.value.minShowNum,"show-controls":m.value.showControls})}):{},{y:e.n(`wd-swiper ${o.customClass}`),z:e.s(o.customStyle)})}}),s=e._export_sfc(n,[["__scopeId","data-v-9cd4e584"]]);wx.createComponent(s);

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"wd-swiper-nav": "../wd-swiper-nav/wd-swiper-nav"
}
}

View File

@@ -0,0 +1 @@
<view class="{{['data-v-9cd4e584', y]}}" style="{{z}}"><scroll-view class="data-v-9cd4e584" scroll-x scroll-y style="width:100%;height:100%"><swiper adjust-height="{{c}}" adjust-vertical-height="{{d}}" class="wd-swiper__track data-v-9cd4e584" autoplay="{{e}}" current="{{f}}" interval="{{g}}" duration="{{h}}" circular="{{i}}" vertical="{{j}}" easing-function="{{k}}" previous-margin="{{l}}" next-margin="{{m}}" snap-to-edge="{{n}}" display-multiple-items="{{o}}" style="{{'height:' + p}}" bindchange="{{q}}" bindanimationfinish="{{r}}"><swiper-item wx:for="{{a}}" wx:for-item="item" wx:key="y" class="{{['data-v-9cd4e584', b]}}"><block wx:if="{{$slots.d}}"><slot name="{{item.w}}"></slot></block><block wx:else><video wx:if="{{item.a}}" id="{{item.b}}" style="{{'height:' + item.c}}" src="{{item.d}}" poster="{{item.e}}" class="{{['data-v-9cd4e584', item.f]}}" bindplay="{{item.g}}" bindpause="{{item.h}}" enable-progress-gesture="{{false}}" loop="{{item.i}}" muted="{{item.j}}" autoplay="{{item.k}}" objectFit="cover" bindtap="{{item.l}}"/><image wx:else src="{{item.m}}" class="{{['data-v-9cd4e584', item.n]}}" style="{{'height:' + item.o}}" mode="{{item.p}}" bindtap="{{item.q}}"/><text wx:if="{{item.r}}" class="{{['data-v-9cd4e584', item.t]}}" style="{{item.v}}">{{item.s}}</text></block></swiper-item></swiper></scroll-view><block wx:if="{{s}}"><slot name="indicator"></slot><wd-swiper-nav wx:if="{{v}}" class="data-v-9cd4e584" bindchange="{{w}}" u-i="9cd4e584-0" bind:__l="__l" u-p="{{x}}"/></block></view>

View File

@@ -0,0 +1 @@
.wd-swiper.data-v-9cd4e584{position:relative}.wd-swiper__track.data-v-9cd4e584{border-radius:var(--wot-swiper-radius, 8px);overflow:hidden;transform:translateY(0)}.wd-swiper__item.data-v-9cd4e584{display:flex;align-items:center;box-sizing:border-box;padding:var(--wot-swiper-item-padding, 0)}.wd-swiper__item--slot.data-v-9cd4e584 view:not([class]){width:100%;height:100%}.wd-swiper__image.data-v-9cd4e584,.wd-swiper__video.data-v-9cd4e584{width:100%;transition:all .3s ease}.wd-swiper__text.data-v-9cd4e584{position:absolute;right:24rpx;top:24rpx;color:var(--wot-swiper-item-text-color, #ffffff);font-size:var(--wot-swiper-item-text-fs, var(--wot-fs-title, 16px))}