"use strict"; const common_vendor = require("../../common/vendor.js"); const utils_auth = require("../../utils/auth.js"); require("../../utils/api.js"); const _sfc_main = { __name: "pool", setup(__props) { const isPurchased = common_vendor.ref(false); const showModal = common_vendor.ref(false); const showPhoneAuth = common_vendor.ref(false); const selectedPlan = common_vendor.ref("daily"); const selectedDate = common_vendor.ref("2025年11月20日"); const isLoggedIn = common_vendor.ref(false); const checkLogin = () => { isLoggedIn.value = utils_auth.isLoggedIn(); console.log("[超短池] 登录状态:", isLoggedIn.value); return isLoggedIn.value; }; const checkPurchaseStatus = () => { try { const purchaseInfo = common_vendor.index.getStorageSync("pool_purchase"); if (purchaseInfo) { const now = Date.now(); const expireTime = purchaseInfo.expireTime; if (now < expireTime) { isPurchased.value = true; } else { common_vendor.index.removeStorageSync("pool_purchase"); isPurchased.value = false; } } else { isPurchased.value = false; } } catch (e) { console.error("检查购买状态失败:", e); isPurchased.value = false; } }; const showPurchaseModal = () => { console.log("点击立即解锁"); if (!checkLogin()) { console.log("未登录,跳转到登录页"); common_vendor.index.showModal({ title: "登录提示", content: "此功能需要登录后使用,是否前往登录?", confirmText: "去登录", cancelText: "取消", success: (res) => { if (res.confirm) { common_vendor.index.navigateTo({ url: "/pages/login/login" }); } } }); return; } console.log("已登录,显示购买弹窗"); showModal.value = true; }; const closePurchaseModal = () => { showModal.value = false; }; const handlePurchase = () => { if (!selectedPlan.value) { common_vendor.index.showToast({ title: "请选择订阅方案", icon: "none" }); return; } const now = Date.now(); let expireTime = now; if (selectedPlan.value === "daily") { const today = /* @__PURE__ */ new Date(); today.setHours(23, 59, 59, 999); expireTime = today.getTime(); } else if (selectedPlan.value === "weekly") { expireTime = now + 7 * 24 * 60 * 60 * 1e3; } const purchaseInfo = { plan: selectedPlan.value, purchaseTime: now, expireTime }; common_vendor.index.setStorageSync("pool_purchase", purchaseInfo); isPurchased.value = true; closePurchaseModal(); common_vendor.index.showToast({ title: "解锁成功", icon: "success" }); }; const onHistorySearch = () => { common_vendor.index.showToast({ title: "历史查询功能开发中", icon: "none" }); }; common_vendor.onLoad(() => { checkLogin(); checkPurchaseStatus(); }); common_vendor.onShow(() => { checkLogin(); checkPurchaseStatus(); common_vendor.index.setNavigationBarTitle({ title: "量化交易大师" }); }); return (_ctx, _cache) => { return common_vendor.e({ a: !isPurchased.value }, !isPurchased.value ? { b: common_vendor.o(showPurchaseModal) } : {}, { c: selectedDate.value, d: common_vendor.o(($event) => selectedDate.value = $event.detail.value), e: common_vendor.o(onHistorySearch), f: showPhoneAuth.value }, showPhoneAuth.value ? { g: common_vendor.o((...args) => _ctx.onGetPhoneNumber && _ctx.onGetPhoneNumber(...args)), h: common_vendor.o(() => { }), i: common_vendor.o((...args) => _ctx.closePhoneAuth && _ctx.closePhoneAuth(...args)) } : {}, { j: showModal.value }, showModal.value ? { k: common_vendor.o(closePurchaseModal), l: selectedPlan.value === "daily" ? 1 : "", m: common_vendor.o(($event) => selectedPlan.value = "daily"), n: selectedPlan.value === "weekly" ? 1 : "", o: common_vendor.o(($event) => selectedPlan.value = "weekly"), p: common_vendor.o(handlePurchase), q: common_vendor.o(() => { }), r: common_vendor.o(closePurchaseModal) } : {}); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/program/gupiao-wx/src/pages/pool/pool.vue"]]); wx.createPage(MiniProgramPage);