From 9292e8dc0f87d4dc2e35870399eeb314e3f17900 Mon Sep 17 00:00:00 2001 From: huanglimeng <627513797@qq.com> Date: Sun, 15 Feb 2026 23:50:01 +0800 Subject: [PATCH] V1.5 --- app.json | 3 +- pages/home/home.js | 180 +++++- pages/home/home.wxml | 4 + pages/index/index.js | 648 ++++++++++++++++++++- pages/index/index.wxml | 80 ++- pages/index/index.wxss | 1085 +++++++++++++++++++++++++++++++++--- pages/privacy/privacy.js | 16 + pages/privacy/privacy.json | 5 + pages/privacy/privacy.wxml | 139 +++++ pages/privacy/privacy.wxss | 107 ++++ spreads_reference.js | 185 ++++++ 11 files changed, 2323 insertions(+), 129 deletions(-) create mode 100644 pages/privacy/privacy.js create mode 100644 pages/privacy/privacy.json create mode 100644 pages/privacy/privacy.wxml create mode 100644 pages/privacy/privacy.wxss create mode 100644 spreads_reference.js diff --git a/app.json b/app.json index 08b036c..dd75728 100644 --- a/app.json +++ b/app.json @@ -5,7 +5,8 @@ "pages/knowledge/index", "pages/knowledge/list", "pages/knowledge/article", - "pages/webview/index" + "pages/webview/index", + "pages/privacy/privacy" ], "window": { "navigationBarTitleText": "我的第一个小程序" diff --git a/pages/home/home.js b/pages/home/home.js index 9db7097..8735b40 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -2,6 +2,16 @@ const { getPoints, checkDailyReward, canWatchAd, getTodayAdCount, rewardFromAd, const { getDailyAdvice } = require('../../utils/dailyAdvice'); const { getDailyArticle, getCategories } = require('../../utils/knowledgeData'); +/** + * 🔧 开发模式配置 + * + * DEV_MODE = true: 使用模拟广告(开发测试) + * DEV_MODE = false: 使用真实广告(正式上线) + * + * ⚠️ 上线前务必改为 false! + */ +const DEV_MODE = true; // 👈 开发时设为 true,上线前改为 false + Page({ data: { currentPoints: 0, @@ -21,6 +31,94 @@ Page({ onLoad: function () { // 加载每日内容 this.loadDailyContent(); + + // 初始化激励视频广告 + this.initRewardedAd(); + }, + + /** + * 初始化激励视频广告 + * ⚠️ 需要在微信公众平台开通流量主并获取广告位ID + */ + initRewardedAd: function () { + // 🔧 开发模式:跳过真实广告初始化 + if (DEV_MODE) { + console.log('[广告系统] 🔧 开发模式:使用模拟广告'); + return; + } + + // 检查是否支持激励视频广告 + if (!wx.createRewardedVideoAd) { + console.warn('[广告系统] 当前微信版本不支持激励视频广告'); + return; + } + + try { + // 创建激励视频广告实例 + // ⚠️ TODO: 替换为你的真实广告位ID + this.rewardedAd = wx.createRewardedVideoAd({ + adUnitId: 'adunit-xxxxxxxxxxxxxxxx' // 请替换为你的广告位ID + }); + + // 监听广告关闭事件 + this.rewardedAd.onClose((res) => { + console.log('[广告系统] 广告关闭回调:', res); + + // 用户看完广告(isEnded = true 表示正常播放结束) + if (res && res.isEnded) { + console.log('[广告系统] 用户完整观看广告'); + this.handleAdReward(); + } else { + // 用户中途关闭广告 + console.log('[广告系统] 用户未看完广告'); + wx.showToast({ + title: '未看完广告,无法获得积分', + icon: 'none', + duration: 2000 + }); + } + }); + + // 监听广告加载错误 + this.rewardedAd.onError((err) => { + console.error('[广告系统] 广告加载失败:', err); + }); + + console.log('[广告系统] 激励视频广告初始化成功'); + } catch (error) { + console.error('[广告系统] 初始化失败:', error); + } + }, + + /** + * 处理广告奖励 + */ + handleAdReward: function () { + const result = rewardFromAd(); + + if (result.success) { + // 刷新积分显示 + this.setData({ + currentPoints: getPoints() + }); + + // 显示奖励提示 + const message = `${result.message}!今日还可观看 ${result.remainingCount} 次`; + wx.showToast({ + title: message, + icon: 'success', + duration: 2500 + }); + + console.log('[广告系统] 奖励发放成功:', result); + } else { + // 显示失败提示(通常是次数用完) + wx.showToast({ + title: result.message, + icon: 'none', + duration: 2000 + }); + } }, onShow: function () { @@ -140,6 +238,13 @@ Page({ }, 300); }, + // 跳转到隐私政策 + goToPrivacy: function () { + wx.navigateTo({ + url: '/pages/privacy/privacy' + }); + }, + // 显示积分说明 showPointsInfo: function () { try { @@ -185,29 +290,68 @@ Page({ } }, - // 观看广告获取积分(模拟) + // 观看广告获取积分(支持开发模式) watchAdForPoints: function () { - const result = rewardFromAd(); - - if (result.success) { - // 刷新积分显示 - this.setData({ - currentPoints: getPoints() - }); - - // 显示奖励提示 + // 检查是否还有观看次数 + if (!canWatchAd()) { wx.showToast({ - title: result.message, - icon: 'success', - duration: 2000 - }); - } else { - // 显示失败提示 - wx.showToast({ - title: result.message, + title: '今日广告次数已用完', icon: 'none', duration: 2000 }); + return; } + + // 🔧 开发模式:模拟广告播放 + if (DEV_MODE) { + console.log('[广告系统] 🔧 开发模式:模拟广告播放中...'); + + wx.showLoading({ + title: '广告播放中...', + mask: true + }); + + // 模拟广告播放时长(1.5秒) + setTimeout(() => { + wx.hideLoading(); + console.log('[广告系统] 🔧 开发模式:模拟广告播放完成'); + this.handleAdReward(); + }, 1500); + + return; + } + + // 生产模式:播放真实广告 + // 检查广告实例是否存在 + if (!this.rewardedAd) { + wx.showToast({ + title: '广告功能暂不可用', + icon: 'none', + duration: 2000 + }); + console.warn('[广告系统] 广告实例不存在'); + return; + } + + // 显示广告 + this.rewardedAd.show() + .catch((err) => { + console.log('[广告系统] 广告未加载,尝试重新加载:', err); + + // 广告可能未加载,先加载再显示 + this.rewardedAd.load() + .then(() => { + console.log('[广告系统] 广告加载成功,开始播放'); + return this.rewardedAd.show(); + }) + .catch((loadErr) => { + console.error('[广告系统] 广告加载失败:', loadErr); + wx.showToast({ + title: '广告加载失败,请稍后再试', + icon: 'none', + duration: 2000 + }); + }); + }); } }); diff --git a/pages/home/home.wxml b/pages/home/home.wxml index a5ca5ff..c694de8 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -41,6 +41,10 @@ 🎯 积分说明 + + 🔒 + 隐私政策 + diff --git a/pages/index/index.js b/pages/index/index.js index e9991f6..4f7eafb 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,3 +1,8 @@ +// ===== 积分系统开关 ===== +// 上架时设置为 true, 测试时设置为 false +const ENABLE_POINTS = false; +// ========================= + // AI 配置 (建议后续迁移至后端以保证 API Key 安全) const DEEPSEEK_API_KEY = 'sk-f659b4c3aa954baaa6cbdbd5cae0b7d1'; // 请在此处替换您的 API Key const DEEPSEEK_BASE_URL = 'https://api.deepseek.com/chat/completions'; @@ -153,7 +158,7 @@ const TAROT_PROMPT_ENHANCED = `📏 解读稳定规则(高优先级执行) ] }`; -// --- 牌阵定义 --- +// 牌阵配置 - 包含所有可用牌阵 const SPREADS = [ { "id": "one_card_guidance", @@ -161,43 +166,68 @@ const SPREADS = [ "cardCount": 1, "cost": 1, "positions": ["当下的指引"], - "description": "为你此刻的状态提供一个温和而清晰的方向提示。", + "description": "为你此刻的状态提供一个温和而清晰的方向提示", + "tags": ["综合"], "aiSchema": ["core_theme", "current_state", "action_advice"] }, { "id": "three_time_flow", - "name": "过去 · 现在 · 未来", + "name": "过去·现在·未来", "cardCount": 3, "cost": 3, "positions": ["过去", "现在", "未来"], - "description": "帮助你理解事情的发展过程与可能走向。", + "description": "帮助你理解事情的发展过程与可能走向", + "tags": ["综合", "决策"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { "id": "three_problem_solution", - "name": "问题 · 阻碍 · 建议", + "name": "问题·阻碍·建议", "cardCount": 3, "cost": 3, "positions": ["问题核心", "当前阻碍", "行动建议"], - "description": "聚焦关键问题,找出当下最可行的应对方式。", + "description": "聚焦关键问题,找出当下最可行的应对方式", + "tags": ["决策"], "aiSchema": ["core_theme", "current_state", "action_advice"] }, + { + "id": "love_spark", + "name": "爱情火花", + "cardCount": 3, + "cost": 3, + "positions": ["你的感受", "对方的感受", "关系潜力"], + "description": "探索彼此的真实感受与这段关系的可能性", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, { "id": "two_choice_decision", "name": "二选一抉择", "cardCount": 4, "cost": 4, "positions": ["选择A的发展", "选择A的结果", "选择B的发展", "选择B的结果"], - "description": "对比两种选择的潜在走向,辅助理性决策。", + "description": "对比两种选择的潜在走向,辅助理性决策", + "tags": ["决策"], "aiSchema": ["core_theme", "potential_influence", "action_advice"] }, + { + "id": "relationship_healing", + "name": "关系修复", + "cardCount": 4, + "cost": 4, + "positions": ["问题根源", "你的责任", "对方的责任", "修复方向"], + "description": "深入理解关系裂痕,找到和解与修复的路径", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, { "id": "five_situation_analysis", "name": "现状分析", "cardCount": 5, "cost": 5, "positions": ["现状", "内在因素", "外在影响", "行动方向", "可能结果"], - "description": "从内外层面拆解局势,明确下一步行动。", + "description": "从内外层面拆解局势,明确下一步行动", + "tags": ["事业", "综合"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -206,7 +236,28 @@ const SPREADS = [ "cardCount": 5, "cost": 5, "positions": ["你的位置", "对方的位置", "关系现状", "隐藏影响", "未来趋势"], - "description": "理解一段关系中的互动模式与发展方向。", + "description": "理解一段关系中的互动模式与发展方向", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "destiny_connection", + "name": "缘分探索", + "cardCount": 5, + "cost": 5, + "positions": ["前世因缘", "今生相遇", "情感纽带", "考验挑战", "缘分走向"], + "description": "探索两人之间的灵性连接与命运安排", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "career_breakthrough", + "name": "职场突破", + "cardCount": 5, + "cost": 5, + "positions": ["当前困境", "优势资源", "潜在机会", "需要克服", "突破方向"], + "description": "识别职场瓶颈,找到突破与晋升的关键", + "tags": ["事业"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -215,7 +266,8 @@ const SPREADS = [ "cardCount": 5, "cost": 5, "positions": ["远古根源", "过去影响", "当下状态", "近期发展", "未来趋势"], - "description": "追溯事件的时间线,看清发展脉络。", + "description": "追溯事件的时间线,看清发展脉络", + "tags": ["综合"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -224,7 +276,28 @@ const SPREADS = [ "cardCount": 5, "cost": 5, "positions": ["问题本质", "过去原因", "未来发展", "外部资源", "最佳行动"], - "description": "多角度剖析问题,找到解决之道。", + "description": "多角度剖析问题,找到解决之道", + "tags": ["决策"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "career_planning", + "name": "事业规划", + "cardCount": 6, + "cost": 6, + "positions": ["当前位置", "核心优势", "发展方向", "潜在障碍", "贵人助力", "长期目标"], + "description": "全面规划职业发展路径,明确长期目标", + "tags": ["事业"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "wealth_analysis", + "name": "财运分析", + "cardCount": 6, + "cost": 6, + "positions": ["财务现状", "收入来源", "支出模式", "投资机会", "财务风险", "财富增长"], + "description": "深入分析财务状况,找到财富增长的路径", + "tags": ["事业"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -233,7 +306,8 @@ const SPREADS = [ "cardCount": 7, "cost": 7, "positions": ["当前能量", "内在阻碍", "潜在天赋", "灵性课题", "指导建议", "未来机遇", "最高指引"], - "description": "深入探索内在世界,获得灵性层面的启发。", + "description": "深入探索内在世界,获得灵性层面的启发", + "tags": ["深度"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -242,7 +316,8 @@ const SPREADS = [ "cardCount": 7, "cost": 7, "positions": ["过去", "现在", "未来", "你的态度", "他人影响", "障碍", "最终结果"], - "description": "全面了解情况的来龙去脉与未来走向。", + "description": "全面了解情况的来龙去脉与未来走向", + "tags": ["综合"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -251,7 +326,8 @@ const SPREADS = [ "cardCount": 10, "cost": 10, "positions": ["现状", "挑战", "根基", "过去", "可能性", "近期未来", "你的态度", "外部影响", "希望与恐惧", "最终结果"], - "description": "最经典的综合牌阵,深度解析生命议题。", + "description": "最经典的综合牌阵,深度解析生命议题", + "tags": ["深度"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] }, { @@ -260,11 +336,379 @@ const SPREADS = [ "cardCount": 10, "cost": 10, "positions": ["王冠", "智慧", "理解", "慈悲", "严厉", "美丽", "胜利", "荣耀", "基础", "王国"], - "description": "基于卡巴拉生命之树的深度灵性探索。", + "description": "基于卡巴拉生命之树的深度灵性探索", + "tags": ["深度"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + // 新增爱情牌阵 + { + "id": "lover_pyramid", + "name": "恋人金字塔", + "cardCount": 4, + "cost": 4, + "positions": ["核心关系", "你的状态", "对方状态", "未来发展"], + "description": "适合恋人关系 & 互动解析", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "new_love", + "name": "新爱牌阵", + "cardCount": 3, + "cost": 3, + "positions": ["当前状态", "遇见契机", "发展方向"], + "description": "适合新的感情 & 遇见新欢,为单身的你或刚分手的你带来新爱提示", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "relationship_basic", + "name": "人际关系牌阵", + "cardCount": 3, + "cost": 3, + "positions": ["你的想法", "对方想法", "关系走向"], + "description": "适合梳理关系 & 拉近距离,回溯结识初衷,梳理人际关系,拉近彼此距离", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "love_tree_spread", + "name": "爱情树牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["核心问题", "过去影响", "现在状况", "未来趋势", "最终结果"], + "description": "适合深度求爱 & 寻找症结,解析前因后果,回溯爱情过往,探究本源核心", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "love_cross_spread", + "name": "爱情大十字", + "cardCount": 5, + "cost": 5, + "positions": ["你的状态", "对方状态", "过去影响", "现在情况", "未来发展"], + "description": "适合解析两性关系 & 爱情状况,基于洞悉彼此关系中的情感状况并分析结果", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "mr_right", + "name": "真命天子牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["内心期待", "现实阻碍", "理想对象", "行动建议", "遇见时机"], + "description": "单身探索有缘人 & 合适对象,探索内心的想法,改善外在的行为,遇到适合的人", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "search_lover", + "name": "寻找对象牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["当前状态", "优势特质", "改进方向", "寻找方式", "目标确定"], + "description": "适合寻找意中人 & 有缘人,睁全宫中人的愿景,帮助自己确定目标", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "inspiration_correspondence", + "name": "灵感对应牌阵", + "cardCount": 6, + "cost": 6, + "positions": ["情感现状", "内心需求", "对方感受", "互动方式", "发展建议", "最终走向"], + "description": "适合情感困惑 & 人际关系,增长解析指缘联接或情感互动,帮您交融状态", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "gypsy_spread", + "name": "吉普赛牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["你的想法", "对方想法", "过去经历", "现在状况", "未来发展"], + "description": "适合情侣分析 & 关系延展,探索彼此内心想法,找到合适的相处方式", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "venus_spread", + "name": "维纳斯牌阵", + "cardCount": 8, + "cost": 8, + "positions": ["你的状态", "对方状态", "关系开始", "当前情况", "核心问题", "最终结果", "外部影响", "内在感受"], + "description": "适合爱情发展 & 判断走向,全面的爱情解析牌阵,深入分析两性关系", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "lover_tree", + "name": "恋人之树牌阵", + "cardCount": 7, + "cost": 7, + "positions": ["你的行为", "对方行为", "你的想法", "对方想法", "你的感受", "对方感受", "关系走向"], + "description": "适合探究对方心理 & 行为模式,对比情侣间的行为差异,进而根据事实做出判断", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "marriage_spread", + "name": "婚姻牌阵", + "cardCount": 7, + "cost": 7, + "positions": ["婚姻基础", "你的期望", "对方期望", "核心问题", "外部影响", "内在感受", "未来走向"], + "description": "适合婚姻状况 & 内在剖析,针对婚姻状况和期望进行解析,通过细致分析把握婚姻走向", + "tags": ["爱情"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + // 新增事业牌阵 + { + "id": "golden_triangle", + "name": "金三角牌阵", + "cardCount": 3, + "cost": 3, + "positions": ["问题核心", "左侧因素", "右侧因素"], + "description": "适合财富探索 & 问题解析,清楚审视整个问题的来龙去脉,进而做出正确决策", + "tags": ["事业", "财富"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "success_star", + "name": "成功之星牌阵", + "cardCount": 3, + "cost": 3, + "positions": ["当前位置", "行动方向", "成功目标"], + "description": "适合走位辨路 & 累积行动,锁定目标破除阻碍,告诉星光,心有明月再出发", + "tags": ["事业"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "career_pyramid", + "name": "事业金字塔", + "cardCount": 4, + "cost": 4, + "positions": ["核心优势", "需要改进", "外部机会", "未来发展"], + "description": "适合解析财富运势 & 提升财商,明晰自我的优缺点,帮助自己除弊趋利在事业中获得优势", + "tags": ["事业"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "wealth_tree", + "name": "财富之树牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["财务基础", "收入来源", "支出状况", "当前状态", "未来趋势"], + "description": "适合事业发展 & 状态评估,通过对财富的梳理,健全适合自己的财务模式", + "tags": ["事业", "财富"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "x_opportunity", + "name": "X时机牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["当前时机", "有利因素", "不利因素", "行动建议", "结果预测"], + "description": "适合时机捕捉 & 临场决策,以事物处理时机为主线轴,牵挂问题解决的成功概率", + "tags": ["事业", "决策"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "job_interview", + "name": "面试求职牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["自我状态", "优势展现", "需要注意", "面试官印象", "录用可能"], + "description": "适合解析应聘面试 & 求职状况,洞察对方需求与自我留言,有效提高面试成功率", + "tags": ["事业"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "work_problems", + "name": "工作问题牌阵", + "cardCount": 6, + "cost": 6, + "positions": ["问题核心", "上级态度", "同事关系", "个人能力", "外部环境", "解决方案"], + "description": "适合聚焦目标 & 优化路径,当你明确自己的目标,全世界都会为你让路", + "tags": ["事业"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "turbulent_finances", + "name": "财富波浪牌阵", + "cardCount": 6, + "cost": 6, + "positions": ["财务起点", "第一波动", "稳定期", "第二波动", "调整期", "未来趋势"], + "description": "适合借力打力 & 多空对比,追问本质,结合正反两方面的分析,做出理智判断", + "tags": ["事业", "财富"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "desired_job", + "name": "期望的工作", + "cardCount": 6, + "cost": 6, + "positions": ["理想工作", "个人优势", "需要提升", "寻找方向", "关键因素", "实现可能"], + "description": "适合评估工作前景 & 关联因素,剖析工作前景,理清相关因素,给出明确的思路", + "tags": ["事业"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + // 新增决策牌阵 + { + "id": "two_options", + "name": "二个选择牌阵", + "cardCount": 3, + "cost": 3, + "positions": ["选项A", "选项B", "建议方向"], + "description": "适合评测选项 & 做出抉择,在两难的处境中给出建议,选出适合自己的抉择", + "tags": ["决策"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "three_options", + "name": "三个选择牌阵", + "cardCount": 3, + "cost": 3, + "positions": ["当前状况", "参考方向一", "参考方向二"], + "description": "提供参考方向 & 行动指向,遇到3个选择时,给你提供参考的方向", + "tags": ["决策"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "daily_tree", + "name": "每日树牌阵", + "cardCount": 4, + "cost": 4, + "positions": ["今日核心", "需要注意", "有利因素", "行动建议"], + "description": "适长当日难题 & 当日解决,天天没烦恼,解决每天遇到的问题", + "tags": ["综合"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "weigh_two", + "name": "二选一牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["当前状况", "选项A优势", "选项B优势", "选项A劣势", "选项B劣势"], + "description": "主要用于抉择 & 判断,二选一,适用于二种情况选择其中一种", + "tags": ["决策"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "comparing_choices", + "name": "比较选择牌阵", + "cardCount": 6, + "cost": 6, + "positions": ["选项A现状", "选项A发展", "选项A结果", "选项B现状", "选项B发展", "选项B结果"], + "description": "适合判断情势 & 决定方向,多层面聚焦两个方向,更多的线索更多的细节", + "tags": ["决策"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "weigh_three", + "name": "三选一牌阵", + "cardCount": 7, + "cost": 7, + "positions": ["当前状况", "选项A优势", "选项B优势", "选项A劣势", "选项C优势", "选项C劣势", "选项B劣势"], + "description": "适合事情抉择 & 选择评估,对利弊关系进行分析判断,权衡利弊,做出最终的选择", + "tags": ["决策"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + // 新增深度探索牌阵 + { + "id": "mind_body_spirit", + "name": "身心灵牌阵", + "cardCount": 4, + "cost": 4, + "positions": ["身体", "心智", "灵性", "整体状态"], + "description": "适合自我探索 & 了解自己,透彻审视自我,更直切明了自身成长路径", + "tags": ["成长", "综合"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "four_elements", + "name": "四元素牌阵", + "cardCount": 4, + "cost": 4, + "positions": ["感性", "理性", "物质", "行动"], + "description": "适合问题探索 & 多方解析,从感性、理性、物质、行动四方面分析,进而接近实质", + "tags": ["探索", "综合"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "self_discovery", + "name": "自我探索牌阵", + "cardCount": 4, + "cost": 4, + "positions": ["核心自我", "潜能", "优势", "需要提升"], + "description": "适合认识自我 & 提升潜能,开发自身潜力,提高对自己的认识", + "tags": ["探索", "成长"], + "aiSchema": ["core_theme", "current_state", "action_advice"] + }, + { + "id": "know_yourself", + "name": "认识你自己", + "cardCount": 5, + "cost": 5, + "positions": ["核心自我", "思想", "行为", "情感", "环境影响"], + "description": "适合自我剖析 & 境况认知,人无时无刻不受环境的影响,在各种关系的交织中成长", + "tags": ["成长", "综合"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "your_breakthrough", + "name": "你的突破牌阵", + "cardCount": 5, + "cost": 5, + "positions": ["当前困境", "阻碍因素", "突破点", "行动方向", "预期结果"], + "description": "适合打破僵环 & 突破自我,识别固定模式,突破往复循环", + "tags": ["成长"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "elemental_cross", + "name": "元素十字牌阵", + "cardCount": 6, + "cost": 6, + "positions": ["核心问题", "火元素", "水元素", "风元素", "土元素", "解决方案"], + "description": "主要用于带入问题 & 解决问题,根据现实情况全面运用四元素能提升自己", + "tags": ["探索", "综合"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "wheel_spread", + "name": "车轮牌阵", + "cardCount": 7, + "cost": 7, + "positions": ["中心", "过去", "现在", "未来", "机会", "挑战", "结果"], + "description": "适合专注自我 & 探寻改变,有时走出循环照顾的舒适圈,有所改变时,才能成长", + "tags": ["成长"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "seven_planets", + "name": "七行星牌阵", + "cardCount": 7, + "cost": 7, + "positions": ["核心", "月亮", "水星", "金星", "太阳", "火星", "木星"], + "description": "适合审视目前状态 & 了解自己,综合分析当下状况,全面的了解自己", + "tags": ["成长", "综合"], + "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] + }, + { + "id": "dream_mirror", + "name": "梦镜牌阵", + "cardCount": 7, + "cost": 7, + "positions": ["梦境表象", "潜意识", "情感", "符号", "启示", "行动", "整合"], + "description": "适合分析梦境 & 获得启迪,梦像一面镜子,解读梦境,是理解自己的渠道", + "tags": ["探索"], "aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"] } ]; + + + Page({ data: { todayDate: '', // 用于存储今天的日期 @@ -281,6 +725,11 @@ Page({ cardBackImage: '/images/beimian.png', spreads: SPREADS, + // 牌阵筛选状态 + activeTag: '全部', + filteredSpreads: SPREADS, + spreadTags: ['全部', '综合', '爱情', '事业', '决策', '深度', '成长', '探索'], + // 动画数据 deckAnimation: {}, cardAnimation: {}, @@ -482,7 +931,72 @@ Page({ ], // 合并大牌和小牌 allCards: [], - aiResult: null + aiResult: null, + + // 塔罗低语 - 分类问题库 + tarotWhispersBank: { + '爱情': [ + { text: '我们的关系会如何发展?' }, + { text: '这段感情值得继续吗?' }, + { text: '对方对我是什么感觉?' }, + { text: 'TA是我的灵魂伴侣吗?' }, + { text: '我们之间的问题能解决吗?' }, + { text: '这段关系的未来如何?' }, + { text: '我该如何改善这段关系?' }, + { text: '我们的缘分有多深?' } + ], + '事业': [ + { text: '我是否应该换工作?' }, + { text: '这个合作值得继续吗?' }, + { text: '我的事业发展方向是什么?' }, + { text: '现在适合创业吗?' }, + { text: '我的职场瓶颈在哪里?' }, + { text: '如何提升我的职场竞争力?' }, + { text: '这个投资机会如何?' }, + { text: '我的财运走势怎样?' } + ], + '决策': [ + { text: '我应该选择A还是B?' }, + { text: '现在是做这个决定的好时机吗?' }, + { text: '这个选择会带来什么结果?' }, + { text: '我该如何做出正确的决定?' }, + { text: '这条路适合我吗?' }, + { text: '我需要考虑哪些因素?' }, + { text: '放弃还是坚持?' }, + { text: '改变会带来什么?' } + ], + '综合': [ + { text: '我现在的状态如何?' }, + { text: '我需要关注什么?' }, + { text: '未来会发生什么?' }, + { text: '我的人生方向是什么?' }, + { text: '如何突破当前困境?' }, + { text: '我的优势是什么?' }, + { text: '什么在阻碍我?' }, + { text: '我该如何成长?' } + ], + '深度': [ + { text: '我的灵性课题是什么?' }, + { text: '我的人生使命是什么?' }, + { text: '如何找到内心的平静?' }, + { text: '我需要学习什么?' }, + { text: '我的潜能在哪里?' }, + { text: '如何实现灵性成长?' }, + { text: '我的生命意义是什么?' }, + { text: '宇宙想告诉我什么?' } + ] + }, + tarotWhispers: [ + { text: '我们的关系会如何发展?' }, + { text: '这段感情值得继续吗?' }, + { text: '我是否应该换工作?' }, + { text: '这个合作值得继续吗?' }, + { text: '我应该选择A还是B?' }, + { text: '现在是做这个决定的好时机吗?' }, + { text: '我现在的状态如何?' }, + { text: '我需要关注什么?' } + ], + selectedWhisperIndex: -1 }, onLoad: function () { @@ -506,23 +1020,46 @@ Page({ const id = e.currentTarget.dataset.id; const spread = this.data.spreads.find(s => s.id === id); - // 检查积分是否足够 - if (!hasEnough(spread.cost)) { + // 检查积分是否足够 (可通过ENABLE_POINTS开关控制) + if (ENABLE_POINTS && !hasEnough(spread.cost)) { wx.showModal({ title: '积分不足', - content: `当前牌阵需要 ${spread.cost} 积分,您的积分不足,请稍后再来`, + content: `当前牌阵需要 ${spread.cost} 积分,您的积分不足,请稍后再来`, showCancel: false, confirmText: '知道了' }); return; } + // 根据牌阵标签更新塔罗低语 + const primaryTag = spread.tags[0]; // 使用第一个标签作为主分类 + const whispers = this.data.tarotWhispersBank[primaryTag] || this.data.tarotWhispersBank['综合']; + this.setData({ selectedSpread: spread, + tarotWhispers: whispers, + selectedWhisperIndex: -1, // 重置选中状态 state: 'asking' // 先进入提问状态 }); }, + // --- 牌阵标签筛选 --- + filterSpreads: function (e) { + const tag = e.currentTarget.dataset.tag; + let filtered = SPREADS; + + if (tag !== '全部') { + filtered = SPREADS.filter(spread => + spread.tags && spread.tags.includes(tag) + ); + } + + this.setData({ + activeTag: tag, + filteredSpreads: filtered + }); + }, + // --- 1.5 确认问题并开始洗牌 --- confirmQuestion: function () { const question = this.data.question.trim(); @@ -606,6 +1143,24 @@ Page({ }); }, + // 选择塔罗低语 + selectWhisper: function (e) { + const index = e.currentTarget.dataset.index; + const question = e.currentTarget.dataset.question; + const quality = scoreQuestion(question); + + // 震动反馈 + wx.vibrateShort({ + type: 'light' + }); + + this.setData({ + question: question, + questionQuality: quality, + selectedWhisperIndex: index + }); + }, + // --- 2. 抽牌逻辑 --- onCardTap: function (e) { const index = e.currentTarget.dataset.index; @@ -634,9 +1189,13 @@ Page({ return card; }); - // 扣除积分(只扣一次) - deductPoints(selectedSpread.cost); - console.log(`[积分系统] 占卜消耗 ${selectedSpread.cost} 积分`); + // 扣除积分(只扣一次,可通过ENABLE_POINTS开关控制) + if (ENABLE_POINTS) { + deductPoints(selectedSpread.cost); + console.log(`[积分系统] 占卜消耗 ${selectedSpread.cost} 积分`); + } else { + console.log(`[积分系统] 测试模式,跳过积分扣除`); + } this.setData({ drawnCards, @@ -806,8 +1365,47 @@ ${cardMeanings} // --- 导航优化:统一返回逻辑 --- handleBack: function () { - wx.navigateBack({ - delta: 1 - }); + // 根据当前状态返回到上一个状态 + const currentState = this.data.state; + + if (currentState === 'asking') { + // 从提问页返回到牌阵选择页 + this.setData({ + state: 'spread_select', + question: '', + questionQuality: null, + selectedWhisperIndex: -1 + }); + } else if (currentState === 'shuffling' || currentState === 'drawing' || currentState === 'flipping') { + // 从洗牌/选牌/翻牌页返回到提问页 + this.setData({ + state: 'asking', + drawnCardIndices: [], + drawnCards: [], + revealedCount: 0 + }); + } else if (currentState === 'revealed') { + // 从解读页返回到牌阵选择页(重新开始) + this.setData({ + state: 'spread_select', + question: '', + questionQuality: null, + selectedWhisperIndex: -1, + drawnCardIndices: [], + drawnCards: [], + revealedCount: 0, + aiResult: null + }); + } else if (currentState === 'spread_select') { + // 从牌阵选择页返回到主页 + wx.navigateBack({ + delta: 1 + }); + } else { + // 其他状态直接返回主页 + wx.navigateBack({ + delta: 1 + }); + } } }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index d1d90f5..ed73751 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -4,27 +4,63 @@ 返回 - + - - 选择你的牌阵 - 请根据你的困惑选择一个适合的牌阵 + + + 选择适合你的牌阵 + 不同的问题,需要不同的展开方式 - - - {{item.name}} - {{item.description}} + + + + + + {{item}} + + + + + + + + + + + {{item.tags[0]}} + + + + {{item.name}} + + + {{item.description}} + + + + {{item.cardCount}} 张牌 + 消耗 {{item.cost}} 积分 + - + 请输入你想询问的问题 心中默念问题,塔罗牌将为你指引方向 - + +