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,206 @@
"use strict";
const uni_modules_wotDesignUni_components_common_props = require("../common/props.js");
const swiperProps = {
...uni_modules_wotDesignUni_components_common_props.baseProps,
/**
* 是否自动播放轮播图
* 类型boolean
* 默认值true
*/
autoplay: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 当前轮播在哪一项(下标)
* 类型number
* 默认值0
*/
current: uni_modules_wotDesignUni_components_common_props.makeNumberProp(0),
/**
* 轮播滑动方向,可选值:'horizontal'(水平)或'vertical'(垂直)
* 类型string
* 默认值:'horizontal'
*/
direction: uni_modules_wotDesignUni_components_common_props.makeStringProp("horizontal"),
/**
* 同时显示的滑块数量
* 类型number
* 默认值1
*/
displayMultipleItems: uni_modules_wotDesignUni_components_common_props.makeNumberProp(1),
/**
* 滑动动画时长,单位为毫秒
* 类型number
* 默认值300
*/
duration: uni_modules_wotDesignUni_components_common_props.makeNumberProp(300),
/**
* 指定 swiper 切换缓动动画类型
* 类型string
* 默认值:'default'
*/
easingFunction: uni_modules_wotDesignUni_components_common_props.makeStringProp("default"),
/**
* 轮播的高度
* 类型number 或 string数字或可转换为数字的字符串
* 默认值:'192'
*/
height: uni_modules_wotDesignUni_components_common_props.makeNumericProp("192"),
/**
* 轮播间隔时间,单位为毫秒
* 类型number
* 默认值5000
*/
interval: uni_modules_wotDesignUni_components_common_props.makeNumberProp(5e3),
/**
* 图片列表,可以是一个图片对象数组或字符串数组
* 类型array
* 默认值:空数组
*/
list: {
type: Array,
default: () => []
},
/**
* 是否循环播放轮播图
* 类型boolean
* 默认值true
*/
loop: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 视频是否循环播放
* 类型boolean
* 默认值true
*/
videoLoop: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 视频是否静音播放
* 类型boolean
* 默认值true
*/
muted: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 后边距
* 类型number 或 string数字或可转换为数字的字符串
* 默认值:'0'
*/
nextMargin: uni_modules_wotDesignUni_components_common_props.makeNumericProp("0"),
/**
* 页码信息展示位置,可选值:'left' | 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right' | 'right'
* 类型string
* 默认值:'bottom'
*/
indicatorPosition: uni_modules_wotDesignUni_components_common_props.makeStringProp("bottom"),
/**
* 前边距
* 类型number 或 string数字或可转换为数字的字符串
* 默认值:'0'
*/
previousMargin: uni_modules_wotDesignUni_components_common_props.makeNumericProp("0"),
/**
* 是否应用边距到第一个、最后一个元素
* 类型boolean
* 默认值false
*/
snapToEdge: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
/**
* 指示器全部配置,可以是布尔值或指示器配置对象
* 类型boolean 或 object
* 默认值true
*/
indicator: {
type: [Boolean, Object],
default: true
},
/**
* 图片裁剪、缩放的模式
* 类型string
* 默认值:'aspectFill'
*/
imageMode: uni_modules_wotDesignUni_components_common_props.makeStringProp("aspectFill"),
/**
* 选项对象中value 对应的 key
*/
valueKey: uni_modules_wotDesignUni_components_common_props.makeStringProp("value"),
/**
* 选项对象中,标题 text 对应的 key
*/
textKey: uni_modules_wotDesignUni_components_common_props.makeStringProp("text"),
/**
* 视频是否自动播放
* 类型boolean
* 默认值true
*/
autoplayVideo: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 切换轮播项时是否停止上一个视频的播放
* 类型boolean
* 默认值true
*/
stopPreviousVideo: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(true),
/**
* 视频播放时是否停止自动轮播
* 类型boolean
* 默认值false
*/
stopAutoplayWhenVideoPlay: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
/**
* 自动以指定滑块的高度为整个容器的高度。当 vertical 为 true 时,默认不调整
* 仅支付宝小程序支持
* 类型:'first' | 'current' | 'highest' | 'none'
* 默认值false
*/
adjustHeight: uni_modules_wotDesignUni_components_common_props.makeStringProp("highest"),
/**
* vertical 为 true 时强制使 adjust-height 生效。
* 仅支付宝小程序支持
* 类型boolean
* 默认值false
*/
adjustVerticalHeight: uni_modules_wotDesignUni_components_common_props.makeBooleanProp(false),
/**
* 自定义指示器类名
* 类型string
*/
customIndicatorClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义图片类名
* 类型string
*/
customImageClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义上一个图片类名
* 类型string
*/
customPrevImageClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义下一个图片类名
* 类型string
*/
customNextImageClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义swiper子项类名
* 类型string
*/
customItemClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义上一个子项类名
* 类型string
*/
customPrevClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义下一个子项类名
* 类型string
*/
customNextClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义文字标题类名
* 类型string
*/
customTextClass: uni_modules_wotDesignUni_components_common_props.makeStringProp(""),
/**
* 自定义文字标题样式
* 类型string
*/
customTextStyle: uni_modules_wotDesignUni_components_common_props.makeStringProp("")
};
exports.swiperProps = swiperProps;
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-swiper/types.js.map

View File

@@ -0,0 +1,252 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
const uni_modules_wotDesignUni_components_wdSwiper_types = require("./types.js");
if (!Math) {
wdSwiperNav();
}
const wdSwiperNav = () => "../wd-swiper-nav/wd-swiper-nav.js";
const __default__ = {
name: "wd-swiper",
options: {
addGlobalClass: true,
virtualHost: true,
styleIsolation: "shared"
}
};
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
...__default__,
props: uni_modules_wotDesignUni_components_wdSwiper_types.swiperProps,
emits: ["click", "change", "animationfinish", "update:current"],
setup(__props, { emit: __emit }) {
const slots = common_vendor.useSlots();
const props = __props;
const emit = __emit;
const navCurrent = common_vendor.ref(props.current);
const currentValue = common_vendor.ref(props.current);
const updateCurrent = (current, force = false) => {
currentValue.value = current;
if (force) {
navCurrent.value = current;
}
emit("update:current", current);
};
const videoPlaying = common_vendor.ref(false);
const { proxy } = common_vendor.getCurrentInstance();
const uid = common_vendor.ref(uni_modules_wotDesignUni_components_common_util.uuid());
common_vendor.watch(
() => props.current,
(val) => {
if (val < 0) {
props.loop ? goToEnd() : goToStart();
} else if (val >= props.list.length) {
props.loop ? goToStart() : goToEnd();
} else {
navTo(val);
}
}
);
const swiperItemClass = common_vendor.computed(() => {
return `wd-swiper__item ${slots.default ? "wd-swiper__item--slot" : ""}`;
});
const swiperIndicator = common_vendor.computed(() => {
const { list, direction, indicatorPosition, indicator } = props;
const swiperIndicator2 = {
current: currentValue.value || 0,
total: list.length || 0,
direction: direction || "horizontal",
indicatorPosition: indicatorPosition || "bottom"
};
if (uni_modules_wotDesignUni_components_common_util.isObj(indicator)) {
swiperIndicator2.type = indicator.type || "dots";
swiperIndicator2.minShowNum = indicator.minShowNum || 2;
swiperIndicator2.showControls = indicator.showControls || false;
}
return swiperIndicator2;
});
const getMediaType = (item, type) => {
const checkType = (url) => type === "video" ? uni_modules_wotDesignUni_components_common_util.isVideoUrl(url) : uni_modules_wotDesignUni_components_common_util.isImageUrl(url);
if (uni_modules_wotDesignUni_components_common_util.isObj(item)) {
return item.type && ["video", "image"].includes(item.type) ? item.type === type : checkType(item[props.valueKey]);
} else {
return checkType(item);
}
};
const isVideo = (item) => {
return getMediaType(item, "video");
};
function navTo(index) {
if (index === currentValue.value)
return;
updateCurrent(index, true);
}
function goToStart() {
navTo(0);
}
function goToEnd() {
navTo(props.list.length - 1);
}
function handleVideoPaly() {
props.stopAutoplayWhenVideoPlay && (videoPlaying.value = true);
}
function handleVideoPause() {
videoPlaying.value = false;
}
function isPrev(current, index, list) {
return (current - 1 + list.length) % list.length === index;
}
function isNext(current, index, list) {
return (current + 1 + list.length) % list.length === index;
}
function getCustomItemClass(current, index, list) {
let customItemClass = "";
if (isPrev(current, index, list)) {
customItemClass = props.customPrevClass || props.customPrevImageClass;
}
if (isNext(current, index, list)) {
customItemClass = props.customNextClass || props.customNextImageClass;
}
return customItemClass;
}
function handleChange(e) {
const { current, source } = e.detail;
const previous = currentValue.value;
emit("change", { current, source });
if (current !== currentValue.value) {
const forceUpdate = source === "autoplay" || source === "touch";
updateCurrent(current, forceUpdate);
}
handleVideoChange(previous, current);
}
function handleVideoChange(previous, current) {
handleStopVideoPaly(previous);
handleStartVideoPaly(current);
}
function handleStartVideoPaly(index) {
if (props.autoplayVideo) {
const currentItem = props.list[index];
if (uni_modules_wotDesignUni_components_common_util.isDef(currentItem) && isVideo(currentItem)) {
const video = common_vendor.index.createVideoContext(`video-${index}-${uid.value}`, proxy);
video.play();
}
}
}
function handleStopVideoPaly(index) {
if (props.stopPreviousVideo) {
const previousItem = props.list[index];
if (uni_modules_wotDesignUni_components_common_util.isDef(previousItem) && isVideo(previousItem)) {
const video = common_vendor.index.createVideoContext(`video-${index}-${uid.value}`, proxy);
video.pause();
}
} else if (props.stopAutoplayWhenVideoPlay) {
handleVideoPause();
}
}
function handleAnimationfinish(e) {
const { current, source } = e.detail;
if (current !== currentValue.value) {
const forceUpdate = source === "autoplay" || source === "touch";
updateCurrent(current, forceUpdate);
}
emit("animationfinish", { current, source });
}
function handleClick(index, item) {
emit("click", { index, item });
}
function handleIndicatorChange({ dir }) {
const { list, loop } = props;
const total = list.length;
let nextPos = dir === "next" ? currentValue.value + 1 : currentValue.value - 1;
if (loop) {
nextPos = dir === "next" ? (currentValue.value + 1) % total : (currentValue.value - 1 + total) % total;
} else {
nextPos = nextPos < 0 || nextPos >= total ? currentValue.value : nextPos;
}
if (nextPos === currentValue.value)
return;
navTo(nextPos);
}
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(_ctx.list, (item, index, i0) => {
return common_vendor.e({
a: isVideo(item)
}, isVideo(item) ? {
b: `video-${index}-${uid.value}`,
c: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(_ctx.height),
d: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isObj)(item) ? item[_ctx.valueKey] : item,
e: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isObj)(item) ? item.poster : "",
f: common_vendor.n(`wd-swiper__video ${_ctx.customItemClass} ${getCustomItemClass(currentValue.value, index, _ctx.list)}`),
g: common_vendor.o(handleVideoPaly, index),
h: common_vendor.o(handleVideoPause, index),
i: _ctx.videoLoop,
j: _ctx.muted,
k: _ctx.autoplayVideo,
l: common_vendor.o(($event) => handleClick(index, item), index)
} : {
m: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isObj)(item) ? item[_ctx.valueKey] : item,
n: common_vendor.n(`wd-swiper__image ${_ctx.customImageClass} ${_ctx.customItemClass} ${getCustomItemClass(currentValue.value, index, _ctx.list)}`),
o: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(_ctx.height),
p: _ctx.imageMode,
q: common_vendor.o(($event) => handleClick(index, item), index)
}, {
r: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isObj)(item) && item[_ctx.textKey]
}, common_vendor.unref(uni_modules_wotDesignUni_components_common_util.isObj)(item) && item[_ctx.textKey] ? {
s: common_vendor.t(item[_ctx.textKey]),
t: common_vendor.n(`wd-swiper__text ${_ctx.customTextClass}`),
v: common_vendor.s(_ctx.customTextStyle)
} : {}, {
w: "d-" + i0,
x: common_vendor.r("d", {
item,
index
}, i0),
y: index
});
}),
b: common_vendor.n(swiperItemClass.value),
c: _ctx.adjustHeight,
d: _ctx.adjustVerticalHeight,
e: _ctx.autoplay && !videoPlaying.value,
f: navCurrent.value,
g: _ctx.interval,
h: _ctx.duration,
i: _ctx.loop,
j: _ctx.direction == "vertical",
k: _ctx.easingFunction,
l: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(_ctx.previousMargin),
m: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(_ctx.nextMargin),
n: _ctx.snapToEdge,
o: _ctx.displayMultipleItems,
p: common_vendor.unref(uni_modules_wotDesignUni_components_common_util.addUnit)(_ctx.height),
q: common_vendor.o(handleChange),
r: common_vendor.o(handleAnimationfinish),
s: _ctx.indicator
}, _ctx.indicator ? common_vendor.e({
t: common_vendor.r("indicator", {
current: currentValue.value,
total: _ctx.list.length
}),
v: !_ctx.$slots.indicator
}, !_ctx.$slots.indicator ? {
w: common_vendor.o(handleIndicatorChange),
x: common_vendor.p({
["custom-class"]: _ctx.customIndicatorClass,
type: swiperIndicator.value.type,
current: swiperIndicator.value.current,
total: swiperIndicator.value.total,
direction: swiperIndicator.value.direction,
["indicator-position"]: swiperIndicator.value.indicatorPosition,
["min-show-num"]: swiperIndicator.value.minShowNum,
["show-controls"]: swiperIndicator.value.showControls
})
} : {}) : {}, {
y: common_vendor.n(`wd-swiper ${_ctx.customClass}`),
z: common_vendor.s(_ctx.customStyle)
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f903ae98"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/wot-design-uni/components/wd-swiper/wd-swiper.js.map

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-f903ae98', y]}}" style="{{z}}"><scroll-view class="data-v-f903ae98" scroll-x scroll-y style="width:100%;height:100%"><swiper adjust-height="{{c}}" adjust-vertical-height="{{d}}" class="wd-swiper__track data-v-f903ae98" 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-f903ae98', 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-f903ae98', 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-f903ae98', item.n]}}" style="{{'height:' + item.o}}" mode="{{item.p}}" bindtap="{{item.q}}"/><text wx:if="{{item.r}}" class="{{['data-v-f903ae98', 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-f903ae98" bindchange="{{w}}" u-i="f903ae98-0" bind:__l="__l" u-p="{{x}}"/></block></view>

View File

@@ -0,0 +1,195 @@
/* 水平间距 */
/* 水平间距 */
/**
* 辅助函数
*/
/**
* SCSS 配置项命名空间以及BEM
*/
/* 转换成字符串 */
/* 判断是否存在 Modifier */
/* 判断是否存在伪类 */
/**
* 主题色切换
* @params $theme-color 主题色
* @params $type 变暗dark 变亮 'light'
* @params $mix-color 自己设置的混色
*/
/**
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
* @params $open-linear 是否开启线性渐变色
* @params $deg 渐变色角度
* @params $theme-color 当前配色
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
* @params [Array] $per-list 渐变色比例
*/
/**
* UI规范基础变量
*/
/*----------------------------------------- Theme color. start ----------------------------------------*/
/* 主题颜色 */
/* 辅助色 */
/* 文字颜色(默认浅色背景下 */
/* 暗黑模式 */
/* 图形颜色 */
/*----------------------------------------- Theme color. end -------------------------------------------*/
/*-------------------------------- Theme color application size. start --------------------------------*/
/* 文字字号 */
/* 文字字重 */
/* 尺寸 */
/*-------------------------------- Theme color application size. end --------------------------------*/
/* component var */
/* action-sheet */
/* badge */
/* button */
/* cell */
/* calendar */
/* checkbox */
/* collapse */
/* divider */
/* drop-menu */
/* input-number */
/* input */
/* textarea */
/* loadmore */
/* message-box */
/* notice-bar */
/* pagination */
/* picker */
/* col-picker */
/* overlay */
/* popup */
/* progress */
/* radio */
/* search */
/* slider */
/* sort-button */
/* steps */
/* switch */
/* tabs */
/* tag */
/* toast */
/* loading */
/* tooltip */
/* popover */
/* grid-item */
/* statustip */
/* card */
/* upload */
/* curtain */
/* notify */
/* skeleton */
/* circle */
/* swiper */
/* swiper-nav */
/* segmented */
/* tabbar */
/* tabbar-item */
/* navbar */
/* navbar-capsule */
/* table */
/* sidebar */
/* sidebar-item */
/* fab */
/* count-down */
/* keyboard */
/* number-keyboard */
/* passwod-input */
/* form-item */
/* backtop */
/* index-bar */
/* text */
/* video-preview */
/* img-cropper */
/* floating-panel */
/* signature */
/**
* 混合宏
*/
/**
* SCSS 配置项命名空间以及BEM
*/
/**
* 辅助函数
*/
/**
* SCSS 配置项命名空间以及BEM
*/
/* 转换成字符串 */
/* 判断是否存在 Modifier */
/* 判断是否存在伪类 */
/**
* 主题色切换
* @params $theme-color 主题色
* @params $type 变暗dark 变亮 'light'
* @params $mix-color 自己设置的混色
*/
/**
* 颜色结果切换, 如果开启线性渐变色 使用渐变色,如果没有开启,那么使用主题色
* @params $open-linear 是否开启线性渐变色
* @params $deg 渐变色角度
* @params $theme-color 当前配色
* @params [Array] $set 主题色明暗设置,与 $color-list 数量对应
* @params [Array] $color-list 渐变色顺序, $color-list 和 $per-list 数量相同
* @params [Array] $per-list 渐变色比例
*/
/**
* BEM定义块b)
*/
/* 定义元素e对于伪类会自动将 e 嵌套在 伪类 底下 */
/* 此方法用于生成穿透样式 */
/* 定义元素e对于伪类会自动将 e 嵌套在 伪类 底下 */
/* 定义状态m */
/* 定义状态m */
/* 对于需要需要嵌套在 m 底下的 e调用这个混合宏一般在切换整个组件的状态如切换颜色的时候 */
/* 状态,生成 is-$state 类名 */
/**
* 常用混合宏
*/
/* 单行超出隐藏 */
/* 多行超出隐藏 */
/* 清除浮动 */
/* 0.5px 边框 指定方向*/
/* 0.5px 边框 环绕 */
/**
* 三角形实现尖角样式,适用于背景透明情况
* @param $size 三角形高,底边为 $size * 2
* @param $bg 三角形背景颜色
*/
/**
* 正方形实现尖角样式,适用于背景不透明情况
* @param $size 正方形边长
* @param $bg 正方形背景颜色
* @param $z-index z-index属性值不得大于外部包裹器
* @param $box-shadow 阴影
*/
.wd-swiper.data-v-f903ae98 {
position: relative;
}
.wd-swiper__track.data-v-f903ae98 {
border-radius: var(--wot-swiper-radius, 8px);
overflow: hidden;
transform: translateY(0);
}
.wd-swiper__item.data-v-f903ae98 {
display: flex;
align-items: center;
box-sizing: border-box;
padding: var(--wot-swiper-item-padding, 0);
}
.wd-swiper__item--slot.data-v-f903ae98 view:not([class]) {
width: 100%;
height: 100%;
}
.wd-swiper__image.data-v-f903ae98, .wd-swiper__video.data-v-f903ae98 {
width: 100%;
transition: all 0.3s ease;
}
.wd-swiper__text.data-v-f903ae98 {
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));
}