核心功能稳定版 v1 - 完成12个主流牌阵,优化卡牌布局和动画
This commit is contained in:
parent
a9b583fd37
commit
d9edbf0562
|
|
@ -99,14 +99,6 @@ const SPREADS = [
|
|||
"description": "聚焦关键问题,找出当下最可行的应对方式。",
|
||||
"aiSchema": ["core_theme", "current_state", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "five_situation_analysis",
|
||||
"name": "现状分析",
|
||||
"cardCount": 5,
|
||||
"positions": ["现状", "内在因素", "外在影响", "行动方向", "可能结果"],
|
||||
"description": "从内外层面拆解局势,明确下一步行动。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "two_choice_decision",
|
||||
"name": "二选一抉择",
|
||||
|
|
@ -115,6 +107,14 @@ const SPREADS = [
|
|||
"description": "对比两种选择的潜在走向,辅助理性决策。",
|
||||
"aiSchema": ["core_theme", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "five_situation_analysis",
|
||||
"name": "现状分析",
|
||||
"cardCount": 5,
|
||||
"positions": ["现状", "内在因素", "外在影响", "行动方向", "可能结果"],
|
||||
"description": "从内外层面拆解局势,明确下一步行动。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "relationship_spread",
|
||||
"name": "关系洞察",
|
||||
|
|
@ -122,6 +122,54 @@ const SPREADS = [
|
|||
"positions": ["你的位置", "对方的位置", "关系现状", "隐藏影响", "未来趋势"],
|
||||
"description": "理解一段关系中的互动模式与发展方向。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "timeline_spread",
|
||||
"name": "时间之流",
|
||||
"cardCount": 5,
|
||||
"positions": ["远古根源", "过去影响", "当下状态", "近期发展", "未来趋势"],
|
||||
"description": "追溯事件的时间线,看清发展脉络。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "diamond_spread",
|
||||
"name": "钻石牌阵",
|
||||
"cardCount": 5,
|
||||
"positions": ["问题本质", "过去原因", "未来发展", "外部资源", "最佳行动"],
|
||||
"description": "多角度剖析问题,找到解决之道。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "spiritual_guidance",
|
||||
"name": "灵性指引",
|
||||
"cardCount": 7,
|
||||
"positions": ["当前能量", "内在阻碍", "潜在天赋", "灵性课题", "指导建议", "未来机遇", "最高指引"],
|
||||
"description": "深入探索内在世界,获得灵性层面的启发。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "horseshoe_spread",
|
||||
"name": "马蹄铁牌阵",
|
||||
"cardCount": 7,
|
||||
"positions": ["过去", "现在", "未来", "你的态度", "他人影响", "障碍", "最终结果"],
|
||||
"description": "全面了解情况的来龙去脉与未来走向。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "celtic_cross",
|
||||
"name": "凯尔特十字",
|
||||
"cardCount": 10,
|
||||
"positions": ["现状", "挑战", "根基", "过去", "可能性", "近期未来", "你的态度", "外部影响", "希望与恐惧", "最终结果"],
|
||||
"description": "最经典的综合牌阵,深度解析生命议题。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
},
|
||||
{
|
||||
"id": "tree_of_life",
|
||||
"name": "生命之树",
|
||||
"cardCount": 10,
|
||||
"positions": ["王冠", "智慧", "理解", "慈悲", "严厉", "美丽", "胜利", "荣耀", "基础", "王国"],
|
||||
"description": "基于卡巴拉生命之树的深度灵性探索。",
|
||||
"aiSchema": ["core_theme", "current_state", "potential_influence", "action_advice"]
|
||||
}
|
||||
];
|
||||
|
||||
|
|
@ -526,21 +574,8 @@ Page({
|
|||
|
||||
// --- 导航优化:统一返回逻辑 ---
|
||||
handleBack: function () {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
} else {
|
||||
// 兜底逻辑:如果是在第一层,则跳转回首页
|
||||
wx.switchTab({
|
||||
url: '/pages/home/home'
|
||||
}).catch(() => {
|
||||
// 如果不是 tabBar,则使用 reLaunch
|
||||
wx.reLaunch({
|
||||
url: '/pages/home/home'
|
||||
});
|
||||
});
|
||||
}
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -64,10 +64,31 @@
|
|||
module.exports.getTransform = function(indices, currentIdx, count) {
|
||||
var pos = indices.indexOf(currentIdx);
|
||||
if (pos !== -1) {
|
||||
var itemWidth = 140 + 20;
|
||||
var centerOffset = (pos - (count - 1) / 2) * itemWidth;
|
||||
// 位移到上方槽位 (向上位移以对准 slots-container)
|
||||
return 'translate(' + centerOffset + 'rpx, -450rpx) rotate(0deg)';
|
||||
// 每排最多5张牌
|
||||
var maxPerRow = 5;
|
||||
var row = Math.floor(pos / maxPerRow); // 第几排(0或1)
|
||||
var col = pos % maxPerRow; // 该排的第几个
|
||||
var cardsInRow = (row === 0) ? Math.min(count, maxPerRow) : (count - maxPerRow);
|
||||
|
||||
// 槽位:宽100rpx + gap 20rpx = 120rpx 间距
|
||||
var slotWidth = 100;
|
||||
var gap = 20;
|
||||
var slotSpacing = slotWidth + gap;
|
||||
|
||||
// 计算该排槽位的水平居中偏移
|
||||
// 从该排中间位置开始计算
|
||||
var centerOffset = (col - (cardsInRow - 1) / 2) * slotSpacing;
|
||||
|
||||
// 垂直偏移计算
|
||||
// 第一排槽位:向上 -520rpx(已验证接近正确)
|
||||
// 第二排:需要减少向上的距离
|
||||
// 槽位高度160 + gap 20 = 180,但实际可能需要微调
|
||||
var firstRowY = -520;
|
||||
var secondRowOffset = 200; // 增加偏移量,让第二排更接近fan-deck
|
||||
var yOffset = firstRowY + (row * secondRowOffset); // row=0: -520, row=1: -320
|
||||
|
||||
// 位移并缩小到0.65
|
||||
return 'translate(' + centerOffset + 'rpx, ' + yOffset + 'rpx) scale(0.65) rotate(0deg)';
|
||||
} else {
|
||||
// 保持在牌堆中的放射状
|
||||
return 'rotate(' + ((currentIdx - 10) * 8) + 'deg)';
|
||||
|
|
|
|||
|
|
@ -151,17 +151,21 @@ page {
|
|||
|
||||
.slots-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap; /* 允许换行 */
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
height: 240rpx;
|
||||
gap: 20rpx; /* 保持20rpx间距,与计算一致 */
|
||||
min-height: 240rpx; /* 改为最小高度 */
|
||||
max-height: 480rpx; /* 最多两排的高度 */
|
||||
margin-bottom: 60rpx;
|
||||
width: 100%;
|
||||
padding: 0 30rpx; /* 增加左右padding确保居中 */
|
||||
}
|
||||
|
||||
.slot-item {
|
||||
width: 140rpx;
|
||||
height: 220rpx;
|
||||
width: 100rpx; /* 与WXS计算的宽度一致 */
|
||||
height: 160rpx; /* 与WXS计算的高度一致 */
|
||||
position: relative;
|
||||
flex-shrink: 0; /* 防止收缩 */
|
||||
}
|
||||
|
||||
.slot-placeholder {
|
||||
|
|
|
|||
Loading…
Reference in New Issue