90 lines
3.9 KiB
JavaScript
90 lines
3.9 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "index",
|
|
props: {
|
|
bottom: { default: 200 },
|
|
inline: { type: Boolean, default: false },
|
|
tone: { default: "default" }
|
|
},
|
|
setup(__props) {
|
|
const trainingItems = [
|
|
{ url: "/training/pages/dumbbell", title: "哑铃", sub: "力量塑形", icon: "dumbbell", iconClass: "menu-icon--dumbbell" },
|
|
{ url: "/training/pages/foot-pedal", title: "脚蹬器", sub: "下肢有氧", icon: "pedal", iconClass: "menu-icon--pedal" },
|
|
{ url: "/training/pages/pilates-ring", title: "瑜伽环", sub: "核心塑形", icon: "pilates", iconClass: "menu-icon--pilates" },
|
|
{ url: "/training/pages/grip-ring", title: "握力环", sub: "握力训练", icon: "grip", iconClass: "menu-icon--grip" },
|
|
{ url: "/training/pages/metronome", title: "耗糖节拍器", sub: "健走配速", icon: "metro", iconClass: "menu-icon--metro", featured: true }
|
|
];
|
|
const props = __props;
|
|
const inlineItems = common_vendor.computed(() => {
|
|
if (props.tone !== "weekly")
|
|
return trainingItems;
|
|
const metro = trainingItems.find((i) => i.icon === "metro");
|
|
const rest = trainingItems.filter((i) => i.icon !== "metro");
|
|
return metro ? [metro, ...rest] : trainingItems;
|
|
});
|
|
const visible = common_vendor.ref(true);
|
|
const expanded = common_vendor.ref(false);
|
|
const toggle = () => {
|
|
expanded.value = !expanded.value;
|
|
};
|
|
const goto = (url) => {
|
|
expanded.value = false;
|
|
common_vendor.index.navigateTo({ url });
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: visible.value && props.inline
|
|
}, visible.value && props.inline ? common_vendor.e({
|
|
b: props.tone === "weekly"
|
|
}, props.tone === "weekly" ? {} : {}, {
|
|
c: common_vendor.f(inlineItems.value, (item, k0, i0) => {
|
|
return common_vendor.e({
|
|
a: item.featured
|
|
}, item.featured ? {} : {}, {
|
|
b: item.icon === "dumbbell"
|
|
}, item.icon === "dumbbell" ? {} : item.icon === "pedal" ? {} : item.icon === "pilates" ? {} : item.icon === "grip" ? {} : item.icon === "metro" ? {} : {}, {
|
|
c: item.icon === "pedal",
|
|
d: item.icon === "pilates",
|
|
e: item.icon === "grip",
|
|
f: item.icon === "metro",
|
|
g: common_vendor.n(item.iconClass),
|
|
h: common_vendor.t(item.title),
|
|
i: common_vendor.t(item.sub),
|
|
j: item.url,
|
|
k: common_vendor.o(($event) => goto(item.url), item.url)
|
|
});
|
|
}),
|
|
d: props.tone === "weekly"
|
|
}, props.tone === "weekly" ? {} : {}, {
|
|
e: props.tone === "weekly" ? 1 : ""
|
|
}) : visible.value ? common_vendor.e({
|
|
g: expanded.value
|
|
}, expanded.value ? {
|
|
h: common_vendor.o(($event) => goto("/training/pages/dumbbell"), "fd"),
|
|
i: common_vendor.o(($event) => goto("/training/pages/foot-pedal"), "a5"),
|
|
j: common_vendor.o(($event) => goto("/training/pages/pilates-ring"), "3f"),
|
|
k: common_vendor.o(($event) => goto("/training/pages/grip-ring"), "23"),
|
|
l: common_vendor.o(($event) => goto("/training/pages/metronome"), "ca"),
|
|
m: common_vendor.o(() => {
|
|
}, "26")
|
|
} : {}, {
|
|
n: !expanded.value
|
|
}, !expanded.value ? {} : {}, {
|
|
o: !expanded.value
|
|
}, !expanded.value ? {} : {}, {
|
|
p: expanded.value
|
|
}, expanded.value ? {} : {}, {
|
|
q: expanded.value ? 1 : "",
|
|
r: common_vendor.o(toggle, "98"),
|
|
s: props.bottom + "rpx"
|
|
}) : {}, {
|
|
f: visible.value
|
|
});
|
|
};
|
|
}
|
|
});
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-17534d15"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/dev-training-entry/index.js.map
|