123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- "use strict";
- const common_vendor = require("../../../common/vendor.js");
- const sheep_index = require("../../index.js");
- require("../../api/index.js");
- require("../../api/distri/score.js");
- require("../../request/index.js");
- require("../../config/index.js");
- require("../../store/index.js");
- require("../../store/app.js");
- require("../../api/promotion/diy.js");
- require("../../platform/index.js");
- require("../../platform/provider/wechat/index.js");
- require("../../platform/provider/wechat/miniProgram.js");
- require("../../api/member/auth.js");
- require("../../api/member/social.js");
- require("../../api/member/user.js");
- require("../../platform/provider/apple/index.js");
- require("../../platform/share.js");
- require("../../router/index.js");
- require("../../hooks/useModal.js");
- require("../../helper/index.js");
- require("../../helper/test.js");
- require("../../helper/digit.js");
- require("../../api/member/signin.js");
- require("../../helper/throttle.js");
- require("../../url/index.js");
- require("../../platform/pay.js");
- require("../../api/pay/order.js");
- require("../../store/user.js");
- require("../../store/cart.js");
- require("../../api/trade/cart.js");
- require("../../api/pay/wallet.js");
- require("../../api/trade/order.js");
- require("../../api/promotion/coupon.js");
- require("../../store/sys.js");
- require("../../store/modal.js");
- require("../../api/distri/share.js");
- require("../../api/distri/team.js");
- require("../../api/infra/file.js");
- require("../../api/member/address.js");
- require("../../api/member/point.js");
- require("../../api/migration/app.js");
- require("../../api/migration/chat.js");
- require("../../api/migration/index.js");
- require("../../api/migration/third.js");
- require("../../api/pay/channel.js");
- require("../../api/product/category.js");
- require("../../api/product/comment.js");
- require("../../api/product/favorite.js");
- require("../../api/product/history.js");
- require("../../api/product/spu.js");
- require("../../api/promotion/activity.js");
- require("../../api/promotion/article.js");
- require("../../api/promotion/bargain.js");
- require("../../api/promotion/combination.js");
- require("../../api/promotion/rewardActivity.js");
- require("../../api/promotion/seckill.js");
- require("../../api/system/area.js");
- require("../../api/system/voice.js");
- require("../../api/trade/afterSale.js");
- require("../../api/trade/brokerage.js");
- require("../../api/trade/config.js");
- require("../../api/trade/delivery.js");
- require("../../config/zIndex.js");
- if (!Array) {
- const _easycom_su_video2 = common_vendor.resolveComponent("su-video");
- _easycom_su_video2();
- }
- const _easycom_su_video = () => "../su-video/su-video.js";
- if (!Math) {
- _easycom_su_video();
- }
- const _sfc_main = {
- __name: "su-swiper",
- props: {
- circular: {
- type: Boolean,
- default: true
- },
- autoplay: {
- type: Boolean,
- default: false
- },
- interval: {
- type: Number,
- default: 3e3
- },
- duration: {
- type: Number,
- default: 500
- },
- mode: {
- type: String,
- default: "default"
- },
- imageMode: {
- type: String,
- default: "scaleToFill"
- },
- list: {
- type: Array,
- default() {
- return [];
- }
- },
- dotStyle: {
- type: String,
- default: "long"
- //default long tag
- },
- dotCur: {
- type: String,
- default: "ss-bg-opactity-block"
- },
- bg: {
- type: String,
- default: "bg-none"
- },
- height: {
- type: Number,
- default: 0
- },
- imgHeight: {
- type: Number,
- default: 0
- },
- imgTopRadius: {
- type: Number,
- default: 0
- },
- imgBottomRadius: {
- type: Number,
- default: 0
- },
- isPreview: {
- type: Boolean,
- default: false
- },
- seizeHeight: {
- type: Number,
- default: 200
- }
- },
- setup(__props) {
- const state = common_vendor.reactive({
- imgHeight: 0,
- cur: 0,
- moveX: 0,
- videoPlaySataus: false,
- heightList: []
- });
- const refs = common_vendor.reactive({
- videoRef: {}
- });
- const props = __props;
- const swiperChange = (e) => {
- if (e.detail.source !== "touch" && e.detail.source !== "autoplay")
- return;
- state.cur = e.detail.current;
- state.videoPlaySataus = false;
- if (props.list[state.cur].type === "video") {
- refs.videoRef[`video_${state.cur}`].pausePlay();
- }
- };
- const onSwiperItem = (item) => {
- if (item.type === "video") {
- state.videoPlaySataus = true;
- } else {
- sheep_index.sheep.$router.go(item.url);
- onPreview();
- }
- };
- const onPreview = () => {
- if (!props.isPreview)
- return;
- let previewImage = common_vendor.lodashExports.clone(props.list);
- previewImage.forEach((item, index) => {
- if (item.type === "video") {
- previewImage.splice(index, 1);
- }
- });
- common_vendor.index.previewImage({
- urls: previewImage.length < 1 ? [props.src] : previewImage.reduce((pre, cur) => {
- pre.push(cur.src);
- return pre;
- }, []),
- current: state.cur
- // longPressActions: {
- // itemList: ['发送给朋友', '保存图片', '收藏'],
- // success: function (data) {
- // console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
- // },
- // fail: function (err) {
- // console.log(err.errMsg);
- // },
- // },
- });
- };
- const transition = (e) => {
- };
- const animationfinish = (e) => {
- state.moveX = 0;
- };
- const videoTimeupdate = (e) => {
- props.list[state.cur].currentTime = e.detail.currentTime;
- };
- const customStyle = common_vendor.computed(() => {
- let height;
- if (props.height !== 0) {
- height = props.height;
- }
- if (props.height === 0) {
- if (state.imgHeight !== 0) {
- height = state.imgHeight;
- } else if (props.seizeHeight !== 0) {
- height = props.seizeHeight;
- }
- }
- return {
- height: height + "rpx"
- };
- });
- function onImgLoad(e) {
- if (props.height === 0) {
- let newHeight = e.detail.height / e.detail.width * 750;
- if (state.imgHeight < newHeight) {
- state.imgHeight = newHeight;
- }
- }
- }
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.f(props.list, (item, index, i0) => {
- return common_vendor.e({
- a: item.type === "image"
- }, item.type === "image" ? {
- b: props.imageMode,
- c: item.src,
- d: common_vendor.o(onImgLoad, index)
- } : {
- e: common_vendor.sr((el) => refs.videoRef[`video_${index}`] = el, "b37b3c30-0-" + i0, {
- "f": 1
- }),
- f: (el) => refs.videoRef[`video_${index}`] = el,
- g: common_vendor.o(videoTimeupdate, index),
- h: "b37b3c30-0-" + i0,
- i: common_vendor.p({
- poster: common_vendor.unref(sheep_index.sheep).$url.cdn(item.poster),
- src: common_vendor.unref(sheep_index.sheep).$url.cdn(item.src),
- index,
- moveX: state.moveX,
- initialTime: item.currentTime || 0,
- height: __props.seizeHeight
- })
- }, {
- j: index,
- k: state.cur == index ? 1 : "",
- l: common_vendor.o(($event) => onSwiperItem(item), index)
- });
- }),
- b: props.circular,
- c: state.cur,
- d: props.autoplay && !state.videoPlaySataus,
- e: props.interval,
- f: props.duration,
- g: common_vendor.o(transition),
- h: common_vendor.o(animationfinish),
- i: common_vendor.s(customStyle.value),
- j: common_vendor.o(swiperChange),
- k: !state.videoPlaySataus
- }, !state.videoPlaySataus ? common_vendor.e({
- l: props.dotStyle != "tag"
- }, props.dotStyle != "tag" ? {
- m: common_vendor.f(props.list, (item, index, i0) => {
- return {
- a: index,
- b: common_vendor.n(state.cur == index ? "cur" : "")
- };
- }),
- n: common_vendor.n(props.dotCur),
- o: common_vendor.n(props.dotStyle)
- } : {}, {
- p: props.dotStyle == "tag"
- }, props.dotStyle == "tag" ? {
- q: common_vendor.t(state.cur + 1),
- r: common_vendor.t(props.list.length),
- s: common_vendor.n(props.dotCur),
- t: common_vendor.n(props.dotStyle)
- } : {}) : {}, {
- v: common_vendor.n(props.mode),
- w: common_vendor.n(props.bg),
- x: common_vendor.n(props.ui)
- });
- };
- }
- };
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b37b3c30"], ["__file", "D:/zx/mall-front-app/sheep/ui/su-swiper/su-swiper.vue"]]);
- wx.createComponent(Component);
|