acdr-ui/dist/dev/mp-weixin/sheep/components/s-live-block/s-live-block.js

126 lines
4.1 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"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 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 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: "bad806d1-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: "bad806d1-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-bad806d1"]]);
wx.createComponent(Component);
//# sourceMappingURL=s-live-block.js.map