| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const utils_auth = require("../../utils/auth.js");
- require("../../utils/api.js");
- const _sfc_main = {
- __name: "strong",
- setup(__props) {
- common_vendor.ref(false);
- const isPurchased = common_vendor.ref(false);
- const showModal = common_vendor.ref(false);
- const selectedPlan = common_vendor.ref("monthly");
- const stockList = common_vendor.ref([
- {
- name: "美的集团",
- code: "000333",
- price: "68.00",
- score: "88.5"
- },
- {
- name: "贵州茅台",
- code: "600519",
- price: "1700.00",
- score: "85.1"
- }
- ]);
- const selectedDate = common_vendor.ref("2025年11月20日");
- const checkPurchaseStatus = () => {
- try {
- const purchaseInfo = common_vendor.index.getStorageSync("strong_pool_purchase");
- if (purchaseInfo) {
- const now = Date.now();
- const expireTime = purchaseInfo.expireTime;
- if (now < expireTime) {
- isPurchased.value = true;
- } else {
- common_vendor.index.removeStorageSync("strong_pool_purchase");
- isPurchased.value = false;
- }
- } else {
- isPurchased.value = false;
- }
- } catch (e) {
- console.error("检查购买状态失败:", e);
- isPurchased.value = false;
- }
- };
- const showPurchaseModal = () => {
- console.log("点击立即解锁");
- if (!utils_auth.isLoggedIn()) {
- 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 === "monthly") {
- expireTime = now + 30 * 24 * 60 * 60 * 1e3;
- }
- const purchaseInfo = {
- plan: selectedPlan.value,
- purchaseTime: now,
- expireTime
- };
- common_vendor.index.setStorageSync("strong_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(() => {
- checkPurchaseStatus();
- });
- common_vendor.onShow(() => {
- 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.f(stockList.value, (stock, index, i0) => {
- return {
- a: common_vendor.t(stock.name),
- b: common_vendor.t(stock.code),
- c: index
- };
- })
- }, {
- d: selectedDate.value,
- e: common_vendor.o(($event) => selectedDate.value = $event.detail.value),
- f: common_vendor.o(onHistorySearch),
- g: showModal.value
- }, showModal.value ? {
- h: common_vendor.o(closePurchaseModal),
- i: common_vendor.o(handlePurchase),
- j: common_vendor.o(() => {
- }),
- k: common_vendor.o(closePurchaseModal)
- } : {});
- };
- }
- };
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/program/gupiao-wx/src/pages/strong/strong.vue"]]);
- wx.createPage(MiniProgramPage);
|