"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); common_vendor.ref("reward"); const startMonth = common_vendor.ref("2025-01"); const endMonth = common_vendor.ref("2025-11"); const isLoggedIn = common_vendor.ref(false); const formatMonth = (monthStr) => { if (!monthStr) return "请选择"; const [year, month] = monthStr.split("-"); return `${year}年${month}月`; }; 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(); 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 = () => { 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); const expireTime = today.getTime(); const purchaseInfo = { plan: "reward", purchaseTime: now, expireTime }; common_vendor.index.setStorageSync("pool_purchase", purchaseInfo); isPurchased.value = true; closePurchaseModal(); common_vendor.index.showToast({ title: "解锁成功", icon: "success" }); }; const onStartMonthChange = (e) => { startMonth.value = e.detail.value; }; const onEndMonthChange = (e) => { endMonth.value = e.detail.value; }; const onHistorySearch = () => { if (!startMonth.value || !endMonth.value) { common_vendor.index.showToast({ title: "请选择开始和结束月份", icon: "none" }); return; } if (startMonth.value > endMonth.value) { common_vendor.index.showToast({ title: "开始月份不能晚于结束月份", icon: "none" }); return; } common_vendor.index.showToast({ title: `查询${formatMonth(startMonth.value)}至${formatMonth(endMonth.value)}`, icon: "none", duration: 2e3 }); }; common_vendor.onLoad(() => { const loginStatus = checkLogin(); console.log("[超短池] 登录状态:", loginStatus); checkPurchaseStatus(); }); common_vendor.onShow(() => { const loginStatus = checkLogin(); console.log("[超短池] 登录状态:", loginStatus); checkPurchaseStatus(); common_vendor.index.setNavigationBarTitle({ title: "量化交易大师" }); }); return (_ctx, _cache) => { return common_vendor.e({ a: !isPurchased.value }, !isPurchased.value ? { b: common_vendor.o(showPurchaseModal) } : {}, { c: common_vendor.t(formatMonth(startMonth.value)), d: startMonth.value, e: common_vendor.o(onStartMonthChange), f: common_vendor.t(formatMonth(endMonth.value)), g: endMonth.value, h: common_vendor.o(onEndMonthChange), i: common_vendor.o(onHistorySearch), j: showPhoneAuth.value }, showPhoneAuth.value ? { k: common_vendor.o((...args) => _ctx.onGetPhoneNumber && _ctx.onGetPhoneNumber(...args)), l: common_vendor.o(() => { }), m: common_vendor.o((...args) => _ctx.closePhoneAuth && _ctx.closePhoneAuth(...args)) } : {}, { n: showModal.value }, showModal.value ? { o: common_vendor.o(closePurchaseModal), 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);