acdr-ui/dist/dev/mp-weixin/modules/mall/sheep/components/s-live-block/s-live-block.js
2024-10-01 09:15:35 +08:00

125 lines
4.1 KiB
JavaScript

"use strict";
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const common_vendor = require("../../../../../common/vendor.js");
const modules_mall_sheep_index = require("../../index.js");
if (!Array) {
const _easycom_s_live_card2 = common_vendor.resolveComponent("s-live-card");
_easycom_s_live_card2();
}
const _easycom_s_live_card = () => "../s-live-card/s-live-card.js";
if (!Math) {
_easycom_s_live_card();
}
const _sfc_main = {
__name: "s-live-block",
props: {
data: {
type: Object,
default() {
}
},
styles: {
type: Object,
default() {
}
}
},
setup(__props) {
var _a, _b;
const state = common_vendor.reactive({
liveList: [],
mpLink: ""
});
const props = __props;
const { mode, goodsFields, mpliveIds } = (_a = props.data) != null ? _a : {};
(_b = props.styles) != null ? _b : {};
function getLiveListByIds(ids) {
return __async(this, null, function* () {
const { data } = yield modules_mall_sheep_index.sheep.$api.app.mplive.getRoomList(ids);
return data;
});
}
function goRoom(id) {
common_vendor.index.navigateTo({
url: `plugin-private://wx2b03c6e691cd7370/modules/mall/live-player-plugin?room_id=${id}`
});
}
common_vendor.onMounted(() => __async(this, null, function* () {
state.liveList = yield getLiveListByIds(mpliveIds);
}));
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.unref(mode) === 2 && state.liveList.length
}, common_vendor.unref(mode) === 2 && state.liveList.length ? {
b: common_vendor.f(state.liveList, (item, k0, i0) => {
var _a2, _b2;
return {
a: common_vendor.o(($event) => goRoom(item.roomid), item.id),
b: "20328f76-0-" + i0,
c: common_vendor.p({
size: "md",
goodsFields: common_vendor.unref(goodsFields),
data: item,
titleColor: (_a2 = common_vendor.unref(goodsFields).name) == null ? void 0 : _a2.color,
subTitleColor: (_b2 = common_vendor.unref(goodsFields).anchor_name) == null ? void 0 : _b2.color,
topRadius: __props.data.borderRadiusTop,
bottomRadius: __props.data.borderRadiusBottom
}),
d: item.id
};
}),
c: common_vendor.s({
padding: __props.data.space + "rpx"
}),
d: common_vendor.s({
margin: "-" + __props.data.space + "rpx"
})
} : {}, {
e: common_vendor.unref(mode) === 1 && state.liveList.length
}, common_vendor.unref(mode) === 1 && state.liveList.length ? {
f: common_vendor.f(state.liveList, (item, k0, i0) => {
var _a2;
return {
a: common_vendor.o(($event) => goRoom(item.roomid), item.id),
b: "20328f76-1-" + i0,
c: common_vendor.p({
size: "sl",
goodsFields: common_vendor.unref(goodsFields),
data: item,
titleColor: (_a2 = common_vendor.unref(goodsFields).name) == null ? void 0 : _a2.color,
subTitleColor: common_vendor.unref(goodsFields).anchor_name.color,
topRadius: __props.data.borderRadiusTop,
bottomRadius: __props.data.borderRadiusBottom
}),
d: item.id
};
}),
g: common_vendor.s({
marginBottom: __props.data.space + "px"
})
} : {});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-20328f76"]]);
wx.createComponent(Component);