216 lines
7.8 KiB
JavaScript
216 lines
7.8 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 5d5b47876e53e564.da1ba52a93.js
|
|
* Module id: 388890
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(462214),
|
|
r = e.i(358379);
|
|
e.i(693602);
|
|
var n = e.i(612735),
|
|
o = e.i(911872),
|
|
a = e.i(272329);
|
|
let i = [
|
|
{ label: "1个月", type: 3 },
|
|
{ label: "12个月", type: 2 },
|
|
],
|
|
l = [
|
|
{ title: "按年购买", label: "7折", type: 2 },
|
|
{ title: "连续包月", label: "8折", type: 1 },
|
|
{ title: "单月购买", label: "", type: 3 },
|
|
];
|
|
e.s([
|
|
"LevelTab",
|
|
0,
|
|
(e) => {
|
|
let {
|
|
list: s,
|
|
selectedIndex: c,
|
|
onTabClick: u,
|
|
tabTitle: d = l,
|
|
singlePurchasePeriodType: f = 3,
|
|
onSinglePurchasePeriodChange: m,
|
|
} = e,
|
|
[p, h] = (0, r.useState)(!1),
|
|
[g, b] = (0, r.useState)(!1),
|
|
v = (0, r.useMemo)(
|
|
() => d?.some((e) => "isSinglePurchase" in e && e.isSinglePurchase),
|
|
[d],
|
|
),
|
|
_ = (0, r.useMemo)(
|
|
() =>
|
|
d?.map((e) => {
|
|
let t = ((e) => {
|
|
let t = e.isSinglePurchase
|
|
? [f]
|
|
: e.types?.length
|
|
? e.types
|
|
: e.type
|
|
? [e.type]
|
|
: [];
|
|
if (!t.length) return 100;
|
|
let r = s.filter((e) => t.includes(e.type));
|
|
return r.length
|
|
? Math.min(
|
|
...(t.length <= 1
|
|
? r
|
|
: Array.from(
|
|
r
|
|
.reduce((e, t) => {
|
|
let r = e.get(t.packageLevel);
|
|
return (
|
|
(!r || t.type > r.type) &&
|
|
e.set(t.packageLevel, t),
|
|
e
|
|
);
|
|
}, new Map())
|
|
.values(),
|
|
)
|
|
).map((e) => e.discountPercent || 100),
|
|
100,
|
|
)
|
|
: 100;
|
|
})(e),
|
|
r =
|
|
t && t < 100
|
|
? `${(0, n.formatNumber)(t)}折`
|
|
: e.label || "";
|
|
return { ...e, label: r };
|
|
}),
|
|
[s, d, f],
|
|
);
|
|
return (0, t.jsx)("div", {
|
|
className: a.default.tabTitle,
|
|
children: _.map((e, r) => {
|
|
let n = r === c,
|
|
l = "isSinglePurchase" in e && !0 === e.isSinglePurchase,
|
|
s = g ? (i.find((e) => e.type === f)?.label ?? e.title) : e.title;
|
|
return l && v && m
|
|
? (0, t.jsxs)(
|
|
o.Menu,
|
|
{
|
|
width: 160,
|
|
position: "bottom-end",
|
|
opened: p,
|
|
onClose: () => h(!1),
|
|
withinPortal: !0,
|
|
zIndex: 2e3,
|
|
classNames: {
|
|
dropdown: a.default.periodDropdown,
|
|
item: a.default.periodMenuItem,
|
|
},
|
|
children: [
|
|
(0, t.jsx)(o.Menu.Target, {
|
|
children: (0, t.jsxs)("div", {
|
|
className: `${a.default.tabItem} ${a.default.tabItemWide} ${n ? a.default.selected : a.default.unselected}`,
|
|
onClick: () => {
|
|
n ? h((e) => !e) : h(!0);
|
|
},
|
|
children: [
|
|
(0, t.jsx)("div", {
|
|
className: a.default.title,
|
|
children: s,
|
|
}),
|
|
e.label &&
|
|
(0, t.jsx)("div", {
|
|
className: n
|
|
? a.default.selectedLabel
|
|
: a.default.unselectedLabel,
|
|
children: e.label,
|
|
}),
|
|
(0, t.jsx)("span", {
|
|
className: a.default.periodArrowHit,
|
|
onClick: (e) => {
|
|
e.stopPropagation(), h((e) => !e);
|
|
},
|
|
children: (0, t.jsx)("svg", {
|
|
className: a.default.periodArrow,
|
|
width: "10",
|
|
height: "6",
|
|
viewBox: "0 0 10 6",
|
|
fill: "none",
|
|
children: (0, t.jsx)("path", {
|
|
d: "M1 1L5 5L9 1",
|
|
stroke: "currentColor",
|
|
strokeWidth: "1.5",
|
|
strokeLinecap: "round",
|
|
strokeLinejoin: "round",
|
|
}),
|
|
}),
|
|
}),
|
|
],
|
|
}),
|
|
}),
|
|
(0, t.jsx)(o.Menu.Dropdown, {
|
|
children: i.map((e) =>
|
|
(0, t.jsx)(
|
|
o.Menu.Item,
|
|
{
|
|
onClick: () => {
|
|
m(e.type), u(r), b(!0), h(!1);
|
|
},
|
|
style:
|
|
e.type === f
|
|
? {
|
|
fontWeight: 500,
|
|
color:
|
|
"var(--vip-tab-selected-text, #0d0d0d)",
|
|
}
|
|
: void 0,
|
|
children: e.label,
|
|
},
|
|
e.type,
|
|
),
|
|
),
|
|
}),
|
|
],
|
|
},
|
|
e.title,
|
|
)
|
|
: (0, t.jsxs)(
|
|
"div",
|
|
{
|
|
className: `${a.default.tabItem} ${n ? a.default.selected : a.default.unselected}`,
|
|
onClick: () => u(r),
|
|
children: [
|
|
(0, t.jsx)("div", {
|
|
className: a.default.title,
|
|
children: e.title,
|
|
}),
|
|
e.label &&
|
|
(0, t.jsx)("div", {
|
|
className: n
|
|
? a.default.selectedLabel
|
|
: a.default.unselectedLabel,
|
|
children: e.label,
|
|
}),
|
|
],
|
|
},
|
|
e.title,
|
|
);
|
|
}),
|
|
});
|
|
},
|
|
"SINGLE_PURCHASE_PERIODS",
|
|
0,
|
|
i,
|
|
"teamTabTitle",
|
|
0,
|
|
[
|
|
{ title: "按年购买", label: "8折", type: 2 },
|
|
{ title: "按月购买", label: "7折", type: 3 },
|
|
],
|
|
"vipHomeTabTitle",
|
|
0,
|
|
[
|
|
{ title: "按年购买", type: 4, types: [2, 4] },
|
|
{ title: "连续包月", type: 1 },
|
|
{ title: "单次购买", isSinglePurchase: !0, defaultType: 3 },
|
|
],
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|