23 lines
762 B
TypeScript
23 lines
762 B
TypeScript
/**
|
||
* 支付状态 - 适配 nomadvip paidType(克隆自 nomadlms)
|
||
*
|
||
* CTA 校验逻辑:有本地 paidType=vip 时优先使用;无则点击「立即加入」直接进入支付流程
|
||
*/
|
||
|
||
/** nomadvip 使用 paidType=vip 表示已支付 */
|
||
export function isPaid(): boolean {
|
||
if (typeof window === "undefined") return false;
|
||
return localStorage.getItem("paidType") === "vip";
|
||
}
|
||
|
||
/** 暂时全部加锁,仅 VIP 可看(原前 2 节试看已关闭) */
|
||
export function isFreeTrial(_moduleIndex: number, _lessonIndex: number): boolean {
|
||
return false;
|
||
}
|
||
|
||
/** 章节是否可观看 */
|
||
export function canWatchLesson(moduleIndex: number, lessonIndex: number): boolean {
|
||
if (isFreeTrial(moduleIndex, lessonIndex)) return true;
|
||
return isPaid();
|
||
}
|