"use strict"; const common_vendor = require("../../common/vendor.js"); const utils_auth = require("../../utils/auth.js"); require("../../utils/api.js"); if (!Math) { (PerformanceCard + HistorySearchCard + PurchaseModal)(); } const PurchaseModal = () => "../../components/PurchaseModal.js"; const PerformanceCard = () => "../../components/PerformanceCard.js"; const HistorySearchCard = () => "../../components/HistorySearchCard.js"; const _sfc_main = { __name: "pool", setup(__props) { const isPurchased = common_vendor.ref(false); const showModal = common_vendor.ref(false); const isLoggedIn = common_vendor.ref(false); const checkLogin = () => { isLoggedIn.value = utils_auth.isLoggedIn(); return isLoggedIn.value; }; const checkPurchaseStatus = () => { if (!checkLogin()) { isPurchased.value = false; return; } try { const purchaseInfo = common_vendor.index.getStorageSync("pool_purchase"); if (purchaseInfo) { const now = Date.now(); if (now < purchaseInfo.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 = () => { if (!checkLogin()) { common_vendor.index.showModal({ title: "登录提示", content: "此功能需要登录后使用,是否前往登录?", confirmText: "去登录", cancelText: "取消", success: (res) => { if (res.confirm) { common_vendor.index.navigateTo({ url: "/pages/login/login" }); } } }); return; } showModal.value = true; }; const closePurchaseModal = () => { showModal.value = false; }; const handlePurchase = () => { const now = Date.now(); const today = /* @__PURE__ */ new Date(); today.setHours(23, 59, 59, 999); common_vendor.index.setStorageSync("pool_purchase", { plan: "reward", purchaseTime: now, expireTime: today.getTime() }); isPurchased.value = true; closePurchaseModal(); common_vendor.index.showToast({ title: "解锁成功", icon: "success" }); }; const onHistorySearch = ({ startMonth, endMonth }) => { const formatMonth = (monthStr) => { const [year, month] = monthStr.split("-"); return `${year}年${month}月`; }; common_vendor.index.showToast({ title: `查询${formatMonth(startMonth)}至${formatMonth(endMonth)}`, icon: "none", duration: 2e3 }); }; common_vendor.onLoad(() => { console.log("[超短池] 登录状态:", checkLogin()); checkPurchaseStatus(); }); common_vendor.onShow(() => { console.log("[超短池] 登录状态:", checkLogin()); checkPurchaseStatus(); common_vendor.index.setNavigationBarTitle({ title: "量化交易大师" }); }); return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.p({ successRate: "75%", profitRate: "+3.2%", totalTrades: 120 }), b: !isPurchased.value }, !isPurchased.value ? { c: common_vendor.o(showPurchaseModal) } : {}, { d: common_vendor.o(onHistorySearch), e: common_vendor.o(closePurchaseModal), f: common_vendor.o(handlePurchase), g: common_vendor.p({ visible: showModal.value, icon: "💰", title: "打赏解锁", description: "支持作者,解锁今日超短池内容", amountLabel: "打赏金额:", amount: 1 }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/program/gupiao-wx/src/pages/pool/pool.vue"]]); wx.createPage(MiniProgramPage);