feat(nsti): add nicotine personality test flow (#36)
* fix: polish logs filter and stats money display * fix: align floating tabs on logs and stats * feat: enhance user profile and achievement features - Add functionality for users to update their profile picture and nickname - Implement achievement theme selection in onboarding - Update API integration for profile updates and achievement themes - Refine UI elements for better user interaction and experience * feat: 梦想清单页与戒烟相关 API - 梦想清单:系统导航栏、浮动添加、图标来自后台预设 - dream-presets API、pages.json 导航样式 Made-with: Cursor * feat(nsti): add nicotine personality test flow
This commit is contained in:
@@ -0,0 +1,565 @@
|
||||
export const NSTI_DIMENSIONS = {
|
||||
A: {
|
||||
key: 'A',
|
||||
name: '外部驱动',
|
||||
label: '社交/外部归因',
|
||||
description: '容易被场景、人情和外部压力牵着走',
|
||||
color: '#FF5D73'
|
||||
},
|
||||
B: {
|
||||
key: 'B',
|
||||
name: '情绪拉扯',
|
||||
label: '情绪/矛盾',
|
||||
description: '容易在焦虑、愤怒和自我矛盾中反复横跳',
|
||||
color: '#FF9F1C'
|
||||
},
|
||||
C: {
|
||||
key: 'C',
|
||||
name: '习惯黑洞',
|
||||
label: '习惯/逃避',
|
||||
description: '容易被惯性、空虚感和逃避机制拖住',
|
||||
color: '#7A5CFA'
|
||||
},
|
||||
D: {
|
||||
key: 'D',
|
||||
name: '行动模式',
|
||||
label: '行动/自律',
|
||||
description: '更容易靠执行力、计划和目标感推动自己',
|
||||
color: '#00C48C'
|
||||
}
|
||||
}
|
||||
|
||||
export const NSTI_PERSONALITY_TYPES = {
|
||||
N01: {
|
||||
code: 'N01',
|
||||
name: '赛博戒烟菩萨',
|
||||
emoji: '🧘',
|
||||
catchphrase: '施主,这根抽完贫僧就真的戒了',
|
||||
description: '嘴上说着戒烟,手却依然很诚实。每次抽烟都有愧疚感,但下一根总能找到理由。',
|
||||
difficulty: 3,
|
||||
difficultyText: '嘴上戒了,手没戒',
|
||||
peerCount: 12847,
|
||||
color: '#54D2B1',
|
||||
abstractRank: 92,
|
||||
tags: ['嘴硬体软', '赛博自律', '口头戒烟'],
|
||||
suggestions: [
|
||||
'把“我在戒烟”设成手机壁纸,每天看见一次就提醒一次。',
|
||||
'下次想点烟时先延迟 3 分钟,让冲动先过峰值。',
|
||||
'把“最后一根”换成“下一根先不抽”,减少自我欺骗。',
|
||||
'用 App 记录抽烟次数,用数据给自己拆台。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天开始只做一件事:把下一根往后拖 3 分钟。',
|
||||
'把最常抽烟的一个场景换掉,比如先离开工位或阳台。',
|
||||
'今晚回顾一次记录,别评价自己,只看事实。'
|
||||
],
|
||||
shareTemplate: '我是赛博戒烟菩萨🧘,嘴上戒了,手还没戒。'
|
||||
},
|
||||
N02: {
|
||||
code: 'N02',
|
||||
name: '传奇耐戒王',
|
||||
emoji: '👑',
|
||||
catchphrase: '戒了100次,成功率0%,但嘴还是硬的',
|
||||
description: '戒烟次数比大多数人努力的次数还多。总会复吸,但也总会重新开局,是嘴硬也是韧性。',
|
||||
difficulty: 5,
|
||||
difficultyText: '反复戒烟,永不成功',
|
||||
peerCount: 10432,
|
||||
color: '#F59E0B',
|
||||
abstractRank: 88,
|
||||
tags: ['反复横跳', '高韧性', '不服输'],
|
||||
suggestions: [
|
||||
'别只盯连续天数,开始记录“复吸间隔”有没有拉长。',
|
||||
'每次复吸都记一句原因,找出最常见的触发场景。',
|
||||
'把目标改成“比上次多撑半天”,不要一口吃成狠人。',
|
||||
'你不是失败太多,而是尝试次数已经领先大多数人。'
|
||||
],
|
||||
actionPlan: [
|
||||
'回想最近一次复吸,写下当时的地点、情绪和人。',
|
||||
'给自己设一个小目标:这周只比上周少抽 5 根。',
|
||||
'把“又失败了”改成“我找到一个新漏洞”。'
|
||||
],
|
||||
shareTemplate: '我是传奇耐戒王👑,戒了很多次,但我还没打算认输。'
|
||||
},
|
||||
N03: {
|
||||
code: 'N03',
|
||||
name: '小丑皇',
|
||||
emoji: '🃏',
|
||||
catchphrase: '最后一根说了100遍',
|
||||
description: 'flag 立得快,倒得也快。擅长在“就这一根”和“我真要戒了”之间来回表演。',
|
||||
difficulty: 4,
|
||||
difficultyText: '经典 flag 制造机',
|
||||
peerCount: 9271,
|
||||
color: '#FF4D6D',
|
||||
abstractRank: 96,
|
||||
tags: ['经典打脸', 'flag王者', '自我欺骗'],
|
||||
suggestions: [
|
||||
'下次别说“最后一根”,只做“下一根不点”。',
|
||||
'每说一次狠话,就往储蓄罐里放 10 块钱。',
|
||||
'发朋友圈前先把手边那包烟移走,降低秒打脸概率。',
|
||||
'别靠情绪发誓,靠环境设计来帮你。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天取消所有狠话,只执行一个动作:烟别放手边。',
|
||||
'最容易打脸的时间段先准备替代动作,比如喝水或嚼口香糖。',
|
||||
'今晚统计一次你今天没说出口的 flag。'
|
||||
],
|
||||
shareTemplate: '我是小丑皇🃏,最后一根说了100遍,这次想少说一句。'
|
||||
},
|
||||
N04: {
|
||||
code: 'N04',
|
||||
name: '朋友圈影帝',
|
||||
emoji: '🎭',
|
||||
catchphrase: '我的戒烟是演给别人看的',
|
||||
description: '在别人的目光里很能忍,一到没人看时就恢复原形。你其实很会控,只是还没把观众从外部换成自己。',
|
||||
difficulty: 3,
|
||||
difficultyText: '发圈时戒,私下猛抽',
|
||||
peerCount: 8619,
|
||||
color: '#9B5DE5',
|
||||
abstractRank: 84,
|
||||
tags: ['表演型', '外部评价', '在意人设'],
|
||||
suggestions: [
|
||||
'既然在别人面前能忍,就试着把“别人面前”延长到全天。',
|
||||
'把表演冲动转成打卡冲动,让结果替你说话。',
|
||||
'选择一个最信任的人,只向他汇报真实进度。',
|
||||
'这次别为了观众而戒,为了自己的肺演全套。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天只对一个人说实话:你最容易在哪个场景破功。',
|
||||
'给自己建一个低调打卡,记录真实抽烟数量。',
|
||||
'明天试一次“没人看也不抽”的一小时练习。'
|
||||
],
|
||||
shareTemplate: '我是朋友圈影帝🎭,这次想把“演给别人看”改成“为自己认真做”。'
|
||||
},
|
||||
N05: {
|
||||
code: 'N05',
|
||||
name: '社交老烟枪',
|
||||
emoji: '🤝',
|
||||
catchphrase: '递烟必接,面子大于健康',
|
||||
description: '一个人时未必抽,见到熟人烟瘾自动上线。你不是缺意志力,是太难拒绝人情场。',
|
||||
difficulty: 4,
|
||||
difficultyText: '社交驱动型烟民',
|
||||
peerCount: 11903,
|
||||
color: '#FF7A59',
|
||||
abstractRank: 72,
|
||||
tags: ['面子优先', '递烟必接', '人情压力'],
|
||||
suggestions: [
|
||||
'提前准备拒绝话术,比如“戒了,你抽你的”。',
|
||||
'社交时手里拿杯水或口香糖,减少条件反射。',
|
||||
'真正的朋友不会因为你不接烟就跟你翻脸。',
|
||||
'你需要练的不是戒烟,是说“不”。'
|
||||
],
|
||||
actionPlan: [
|
||||
'先挑一个最熟的人练习拒绝,降低心理门槛。',
|
||||
'把下一次饭局定义成“只拒一根烟”的实验。',
|
||||
'结束后复盘:别人真的介意了吗?'
|
||||
],
|
||||
shareTemplate: '我是社交老烟枪🤝,面子很大,肺想先请个假。'
|
||||
},
|
||||
N06: {
|
||||
code: 'N06',
|
||||
name: '焦虑制造者',
|
||||
emoji: '😤',
|
||||
catchphrase: '一焦虑就想抽,越抽越焦虑',
|
||||
description: '烟像情绪止痛片,但药效一过,烦躁和担心又回来。你最难的不是烟,是情绪出口太单一。',
|
||||
difficulty: 5,
|
||||
difficultyText: '情绪驱动型',
|
||||
peerCount: 9984,
|
||||
color: '#FF8C42',
|
||||
abstractRank: 68,
|
||||
tags: ['焦虑循环', '情绪依赖', '高压模式'],
|
||||
suggestions: [
|
||||
'想抽时先做 10 次慢呼吸,让身体从应激里退半步。',
|
||||
'准备一个替代减压动作:快走、捏泡泡纸、写两行字都行。',
|
||||
'把“我想抽烟”翻译成“我现在很烦/很怕/很空”。',
|
||||
'烟不是解药,更像短时麻醉。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天先记下三次最想抽烟的情绪时刻。',
|
||||
'选一个替代动作,只在今天试一次,不要求完美。',
|
||||
'睡前看一遍记录,找出最常见的情绪词。'
|
||||
],
|
||||
shareTemplate: '我是焦虑制造者😤,烟像止痛片,但我想找真正的出口。'
|
||||
},
|
||||
N07: {
|
||||
code: 'N07',
|
||||
name: '丧尸模式',
|
||||
emoji: '💀',
|
||||
catchphrase: '完全无意识,手自己找烟',
|
||||
description: '很多时候不是你决定要抽,是身体直接执行了老程序。抽完才回神,是你最典型的日常。',
|
||||
difficulty: 4,
|
||||
difficultyText: '习惯性烟民',
|
||||
peerCount: 9356,
|
||||
color: '#6B7280',
|
||||
abstractRank: 64,
|
||||
tags: ['无意识', '条件反射', '惯性'],
|
||||
suggestions: [
|
||||
'把烟和打火机挪远,增加获取阻力。',
|
||||
'换掉最习惯抽烟的位置,让身体先卡壳。',
|
||||
'准备口香糖或吸管,让手和嘴都有替代动作。',
|
||||
'你不是没有意志力,只是习惯太自动。'
|
||||
],
|
||||
actionPlan: [
|
||||
'先清掉一个高频抽烟点位的烟具。',
|
||||
'今天设三个整点提醒,问自己“我现在在干嘛”。',
|
||||
'把第一根无意识烟拖延 5 分钟。'
|
||||
],
|
||||
shareTemplate: '我是丧尸模式💀,手比脑子快一步,正在把控制权夺回来。'
|
||||
},
|
||||
N08: {
|
||||
code: 'N08',
|
||||
name: '拖延大师',
|
||||
emoji: '📅',
|
||||
catchphrase: '明天开始戒,永远明天',
|
||||
description: '你不是没准备好,是太擅长用“准备”代替行动。明天很完美,但永远不在今天发生。',
|
||||
difficulty: 3,
|
||||
difficultyText: '日期幻觉症患者',
|
||||
peerCount: 11308,
|
||||
color: '#3A86FF',
|
||||
abstractRank: 70,
|
||||
tags: ['明天再说', '无限准备', '行动延迟'],
|
||||
suggestions: [
|
||||
'别设“明天开始”,直接从下一根不抽开始。',
|
||||
'把目标从“彻底戒掉”缩成“先撑 24 小时”。',
|
||||
'给自己一个立刻可执行的动作,比如先不买下一包。',
|
||||
'你已经准备够了,差的是开机键。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天只做一个动作:别提前补货。',
|
||||
'设一个 24 小时倒计时,看自己能不能撑到明天同一时间。',
|
||||
'把“以后再说”换成“现在先做一格”。'
|
||||
],
|
||||
shareTemplate: '我是拖延大师📅,明天太远,所以这次从今天先动一格。'
|
||||
},
|
||||
N09: {
|
||||
code: 'N09',
|
||||
name: '真正狠人',
|
||||
emoji: '🚀',
|
||||
catchphrase: '说戒就戒,绝不回头',
|
||||
description: '一旦下决心就很能执行,目标感强,耐痛阈值也高。你是最接近“立即行动派”的那一类。',
|
||||
difficulty: 1,
|
||||
difficultyText: '戒烟界传说',
|
||||
peerCount: 4239,
|
||||
color: '#00C48C',
|
||||
abstractRank: 38,
|
||||
tags: ['行动派', '意志力强', '说到做到'],
|
||||
suggestions: [
|
||||
'继续保持,但别在最自信的时候低估复吸风险。',
|
||||
'把经验沉淀成自己的流程,以后更稳。',
|
||||
'可以带一个戒烟搭子,你很适合做榜样。',
|
||||
'狠不只在开始,更在长期维持。'
|
||||
],
|
||||
actionPlan: [
|
||||
'把你的戒烟规则写成 3 条最小原则。',
|
||||
'提前准备一个“高风险场景应对脚本”。',
|
||||
'达成一周目标后,奖励自己一个真正喜欢的东西。'
|
||||
],
|
||||
shareTemplate: '我是正确狠人🚀,这次不靠口号,靠执行。'
|
||||
},
|
||||
N10: {
|
||||
code: 'N10',
|
||||
name: '愤怒的小鸟',
|
||||
emoji: '🔥',
|
||||
catchphrase: '抽完更烦躁,越烦越想抽',
|
||||
description: '情绪像火,烟像汽油。你以为在灭火,其实常常把烦躁烧得更旺。',
|
||||
difficulty: 4,
|
||||
difficultyText: '负面循环型',
|
||||
peerCount: 7812,
|
||||
color: '#FF4E50',
|
||||
abstractRank: 74,
|
||||
tags: ['烦躁升级', '负面循环', '情绪宣泄'],
|
||||
suggestions: [
|
||||
'愤怒时先离开现场,别让烟变成默认出口。',
|
||||
'跑步、拍打枕头、冷水洗脸,都比点烟更像灭火器。',
|
||||
'识别“我烦”和“我想抽”是不是被你绑在一起了。',
|
||||
'烟不是灭火器,更像助燃剂。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天给自己准备一个物理泄压动作。',
|
||||
'下次烦躁时先等 90 秒再决定要不要抽。',
|
||||
'把最常点火的那件事写下来,先处理源头。'
|
||||
],
|
||||
shareTemplate: '我是愤怒的小鸟🔥,不想再拿汽油给自己灭火。'
|
||||
},
|
||||
N11: {
|
||||
code: 'N11',
|
||||
name: '养生矛盾体',
|
||||
emoji: '🍵',
|
||||
catchphrase: '一边抽烟一边喝茶养生',
|
||||
description: '很会给自己找平衡感:抽烟可以,等会儿喝点热茶补回来。你不是不懂,只是太会自我安慰。',
|
||||
difficulty: 3,
|
||||
difficultyText: '自我安慰大师',
|
||||
peerCount: 6537,
|
||||
color: '#7BC96F',
|
||||
abstractRank: 82,
|
||||
tags: ['平衡幻觉', '自我安慰', '矛盾体'],
|
||||
suggestions: [
|
||||
'茶是好东西,但真的不能和烟打平。',
|
||||
'先承认“补一补”只是安慰,不是解法。',
|
||||
'把养生心态变真一点,从少抽一根开始。',
|
||||
'真正的养生,是别再让肺替你背锅。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天保留喝茶,但删掉其中一支烟。',
|
||||
'把“我在平衡”改成“我在找借口”提醒自己一次。',
|
||||
'选一个最想养生的理由,写在便签上。'
|
||||
],
|
||||
shareTemplate: '我是养生矛盾体🍵,枸杞和烟不该再同框了。'
|
||||
},
|
||||
N12: {
|
||||
code: 'N12',
|
||||
name: '表演艺术家',
|
||||
emoji: '🎪',
|
||||
catchphrase: '抽烟姿态优雅,烟是道具',
|
||||
description: '你抽的不只是烟,也是氛围、姿态和一种角色感。很多时候你留恋的是“感觉”,不是尼古丁本身。',
|
||||
difficulty: 2,
|
||||
difficultyText: '形式大于内容',
|
||||
peerCount: 5089,
|
||||
color: '#F15BB5',
|
||||
abstractRank: 86,
|
||||
tags: ['氛围感', '道具流', '文艺烟感'],
|
||||
suggestions: [
|
||||
'把“抽烟仪式”迁移到别的媒介上,比如咖啡、散步或拍照。',
|
||||
'保留氛围感,不必保留那根烟。',
|
||||
'给自己找一个新的“道具”,让角色感脱离香烟。',
|
||||
'真正的酷,不靠烟雾完成。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天挑一个最讲氛围的场景,试着不用烟完成它。',
|
||||
'准备一个替代道具,比如薄荷糖、咖啡杯、纸笔。',
|
||||
'记录一次“没抽也有感觉”的瞬间。'
|
||||
],
|
||||
shareTemplate: '我是表演艺术家🎪,烟只是道具,但我想演一个更酷的自己。'
|
||||
},
|
||||
N13: {
|
||||
code: 'N13',
|
||||
name: '隐形成员',
|
||||
emoji: '👻',
|
||||
catchphrase: '没人知道我抽烟',
|
||||
description: '习惯偷偷抽、躲着抽,抽烟和羞耻感绑定得很深。你承受的不只是烟瘾,还有秘密本身的压力。',
|
||||
difficulty: 3,
|
||||
difficultyText: '偷偷摸摸型',
|
||||
peerCount: 6120,
|
||||
color: '#5C677D',
|
||||
abstractRank: 66,
|
||||
tags: ['隐形烟民', '偷偷摸摸', '双重生活'],
|
||||
suggestions: [
|
||||
'既然别人都不知道,那你其实很适合悄悄开始戒。',
|
||||
'找一个可信的人做搭子,不用一个人扛。',
|
||||
'隐藏带来的压力,本身也会推着你继续抽。',
|
||||
'承认是第一步,不一定要对全世界承认。'
|
||||
],
|
||||
actionPlan: [
|
||||
'先对一个安全的人说出你的真实情况。',
|
||||
'把最常偷抽的地方变得不那么方便。',
|
||||
'今天试一次“想抽但先不躲着去”的停顿。'
|
||||
],
|
||||
shareTemplate: '我是隐形成员👻,这次想把秘密变成一次小小的改变。'
|
||||
},
|
||||
N14: {
|
||||
code: 'N14',
|
||||
name: '卷王型戒烟者',
|
||||
emoji: '💪',
|
||||
catchphrase: '连续打卡,目标必达成',
|
||||
description: '你对目标、数据和进度条很敏感,越看得到进展越来劲。只要方向对,你是最容易持续的人之一。',
|
||||
difficulty: 2,
|
||||
difficultyText: '行动派',
|
||||
peerCount: 7444,
|
||||
color: '#06D6A0',
|
||||
abstractRank: 42,
|
||||
tags: ['数据控', '自律驱动', '目标型'],
|
||||
suggestions: [
|
||||
'把戒烟拆成可量化目标,你会更有状态。',
|
||||
'设置每周里程碑,用奖励巩固正反馈。',
|
||||
'找一个搭子互相卷,效率会更高。',
|
||||
'继续用数据说话,你本来就擅长这个。'
|
||||
],
|
||||
actionPlan: [
|
||||
'给自己定一个这周的可量化指标。',
|
||||
'设立 3 个奖励节点,别只盯终点。',
|
||||
'每天同一时间打一次卡,让行动变自动。'
|
||||
],
|
||||
shareTemplate: '我是卷王型戒烟者💪,进度条一旦开了就不想让它断。'
|
||||
},
|
||||
N15: {
|
||||
code: 'N15',
|
||||
name: '深夜哲学家',
|
||||
emoji: '🌙',
|
||||
catchphrase: '只有深夜才抽烟思考',
|
||||
description: '抽烟和深夜、独处、灵感绑定得很深。你最怕戒掉烟之后,那些自以为重要的思考氛围也一起消失。',
|
||||
difficulty: 3,
|
||||
difficultyText: '烟是灵感来源',
|
||||
peerCount: 5821,
|
||||
color: '#6C63FF',
|
||||
abstractRank: 79,
|
||||
tags: ['深夜档', '灵感型', '仪式依赖'],
|
||||
suggestions: [
|
||||
'把“抽烟时间”替换成“深夜散步”或“写两行字”的时间。',
|
||||
'你依赖的更多是场景感,不一定是烟本身。',
|
||||
'灵感可以配茶、配风、配纸笔,不必配烟。',
|
||||
'保留思考,不必保留烟雾。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今晚先试一次不抽烟的深夜时段。',
|
||||
'准备一本小本子,想到什么先记下来。',
|
||||
'找出一个你最珍惜的深夜 ritual,用别的东西替代烟。'
|
||||
],
|
||||
shareTemplate: '我是深夜哲学家🌙,想把灵感留住,把烟雾删掉。'
|
||||
},
|
||||
N16: {
|
||||
code: 'N16',
|
||||
name: '终极摆烂王',
|
||||
emoji: '🏳️',
|
||||
catchphrase: '反正戒不掉,不如享受',
|
||||
description: '表面看像放弃治疗,底层其实是怕再次失败。你不是不想变好,是不想再失望。',
|
||||
difficulty: 5,
|
||||
difficultyText: '放弃治疗型',
|
||||
peerCount: 8897,
|
||||
color: '#94A3B8',
|
||||
abstractRank: 90,
|
||||
tags: ['摆烂', '防御性悲观', '先投降'],
|
||||
suggestions: [
|
||||
'先别谈全戒,从少抽一根开始也算赢。',
|
||||
'允许自己失败,但把复吸间隔拉长一点点。',
|
||||
'给自己设一个很小的目标,比如这周少抽 5 根。',
|
||||
'摆烂不是唯一选择,你只是还没找到顺手的方法。'
|
||||
],
|
||||
actionPlan: [
|
||||
'今天只争取少抽一根,不要求完美。',
|
||||
'把最近一次“摆烂”的真实原因写下来。',
|
||||
'给下周设一个小到不丢人的目标。'
|
||||
],
|
||||
shareTemplate: '我是终极摆烂王🏳️,但今天想试试不摆烂一小会儿。'
|
||||
}
|
||||
}
|
||||
|
||||
export const NSTI_DIMENSION_PAIR_MAP = {
|
||||
AA: 'N05',
|
||||
AB: 'N01',
|
||||
AC: 'N04',
|
||||
AD: 'N12',
|
||||
BA: 'N03',
|
||||
BB: 'N06',
|
||||
BC: 'N10',
|
||||
BD: 'N02',
|
||||
CA: 'N13',
|
||||
CB: 'N16',
|
||||
CC: 'N07',
|
||||
CD: 'N08',
|
||||
DA: 'N14',
|
||||
DB: 'N11',
|
||||
DC: 'N15',
|
||||
DD: 'N09'
|
||||
}
|
||||
|
||||
export const NSTI_QUESTIONS = [
|
||||
{
|
||||
id: 1,
|
||||
title: '你上次说“戒烟”是什么时候?',
|
||||
subtitle: '测试你的戒烟承诺频率和可信度',
|
||||
options: [
|
||||
{ key: 'A', text: '今天早上刚说过 ⏰', weights: { N01: 3, N03: 1 } },
|
||||
{ key: 'B', text: '昨天,说完就抽了 🔄', weights: { N02: 3, N03: 1 } },
|
||||
{ key: 'C', text: '上周/上月,记不清了 📅', weights: { N08: 3, N07: 1 } },
|
||||
{ key: 'D', text: '说得太多了,当口头禅了 💬', weights: { N01: 2, N02: 2 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: '朋友递烟给你,你会?',
|
||||
subtitle: '测试你的社交压力和自控力',
|
||||
options: [
|
||||
{ key: 'A', text: '直接接,面子第一 🤝', weights: { N05: 3, N12: 1 } },
|
||||
{ key: 'B', text: '嘴上说戒了,手很诚实 ✋', weights: { N01: 3, N03: 1 } },
|
||||
{ key: 'C', text: '拒绝,然后偷偷自己抽一根 🤫', weights: { N13: 3, N04: 1 } },
|
||||
{ key: 'D', text: '坚决不接,然后被孤立 😢', weights: { N09: 2, N14: 2 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: '你戒烟失败的最奇葩理由是?',
|
||||
subtitle: '测试你的借口制造能力和自我欺骗程度',
|
||||
options: [
|
||||
{ key: 'A', text: '“今天压力大”(每天都压力大)😰', weights: { N06: 2, N10: 2 } },
|
||||
{ key: 'B', text: '“明天开始戒”(永远明天)📅', weights: { N08: 3, N16: 1 } },
|
||||
{ key: 'C', text: '“朋友递的,不接不给面子” 🙇', weights: { N05: 3, N04: 1 } },
|
||||
{ key: 'D', text: '“就抽一根,没事的”(经典flag)🚩', weights: { N03: 3, N02: 1 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: '你抽烟时的精神状态是?',
|
||||
subtitle: '测试你抽烟的心理动机',
|
||||
options: [
|
||||
{ key: 'A', text: '🧘 冥想大师,享受每一口', weights: { N15: 2, N12: 2 } },
|
||||
{ key: 'B', text: '😤 愤怒的小鸟,越抽越烦躁', weights: { N10: 3, N06: 1 } },
|
||||
{ key: 'C', text: '🎭 演技派,其实不想抽但停不下来', weights: { N11: 2, N04: 2 } },
|
||||
{ key: 'D', text: '💀 丧尸模式,完全无意识', weights: { N07: 3, N16: 1 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: '你的理想戒烟场景是?',
|
||||
subtitle: '测试你对戒烟的想象和期望',
|
||||
options: [
|
||||
{ key: 'A', text: '赛博空间(数字戒烟)🤖', weights: { N01: 2, N14: 2 } },
|
||||
{ key: 'B', text: '修仙洞府(闭关修炼)🧙', weights: { N15: 2, N13: 2 } },
|
||||
{ key: 'C', text: '监狱(物理强制)🚔', weights: { N16: 2, N07: 2 } },
|
||||
{ key: 'D', text: '外太空(没氧气自然戒)🚀', weights: { N12: 2, N03: 2 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: '你戒烟时最怕什么?',
|
||||
subtitle: '测试你戒烟的最大障碍',
|
||||
options: [
|
||||
{ key: 'A', text: '朋友递烟时张嘴了(物理惯性)😨', weights: { N05: 2, N07: 2 } },
|
||||
{ key: 'B', text: '打火机太好看了不用可惜(颜控)🔥', weights: { N12: 2, N11: 2 } },
|
||||
{ key: 'C', text: '无聊到怀疑人生(精神支柱)😴', weights: { N16: 2, N15: 2 } },
|
||||
{ key: 'D', text: '失去抽烟这个“思考时间”🤔', weights: { N15: 3, N11: 1 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
title: '你发朋友圈说戒烟后发生了什么?',
|
||||
subtitle: '测试你的公开承诺与实际行动的差距',
|
||||
options: [
|
||||
{ key: 'A', text: '打脸了,当天就抽了 🤦', weights: { N03: 3, N02: 1 } },
|
||||
{ key: 'B', text: '没人信,都是看热闹的 👀', weights: { N04: 2, N02: 2 } },
|
||||
{ key: 'C', text: '真戒了一段时间,然后复吸了 📉', weights: { N02: 3, N14: 1 } },
|
||||
{ key: 'D', text: '从来没发过,太丢人了 😶', weights: { N13: 3, N15: 1 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
title: '如果戒烟成功,你最想做什么?',
|
||||
subtitle: '测试你的戒烟动机和动力来源',
|
||||
options: [
|
||||
{ key: 'A', text: '发朋友圈炫耀 📱', weights: { N04: 2, N12: 2 } },
|
||||
{ key: 'B', text: '省下的钱买个大件 💰', weights: { N14: 2, N11: 2 } },
|
||||
{ key: 'C', text: '告诉家人“我做到了” 👨👩👧', weights: { N09: 2, N14: 2 } },
|
||||
{ key: 'D', text: '感觉人生少了点什么 😶🌫️', weights: { N16: 2, N07: 2 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
title: '你觉得戒烟最难的是?',
|
||||
subtitle: '测试你对戒烟难度的认知',
|
||||
options: [
|
||||
{ key: 'A', text: '戒断反应(身体折磨)😰', weights: { N02: 2, N09: 2 } },
|
||||
{ key: 'B', text: '社交场合(递烟必接)🍻', weights: { N05: 3, N04: 1 } },
|
||||
{ key: 'C', text: '无聊时光(手没地方放)👐', weights: { N07: 3, N16: 1 } },
|
||||
{ key: 'D', text: '情绪波动(焦虑就抽)😤', weights: { N06: 2, N10: 2 } }
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
title: '如果用一个词形容你的戒烟史?',
|
||||
subtitle: '综合测试你的戒烟人格画像',
|
||||
options: [
|
||||
{ key: 'A', text: '“反复横跳” 🔄', weights: { N02: 3, N11: 1 } },
|
||||
{ key: 'B', text: '“嘴硬体软” 🗣️', weights: { N01: 3, N03: 1 } },
|
||||
{ key: 'C', text: '“表演艺术” 🎭', weights: { N12: 2, N04: 2 } },
|
||||
{ key: 'D', text: '“明日复明日” 📅', weights: { N08: 3, N16: 1 } }
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,183 @@
|
||||
import { storage, NSTI_RESULT_KEY, NSTI_HISTORY_KEY, NSTI_DRAFT_KEY } from './storage'
|
||||
import { NSTI_DIMENSIONS, NSTI_DIMENSION_PAIR_MAP, NSTI_PERSONALITY_TYPES, NSTI_QUESTIONS } from './nsti-data'
|
||||
|
||||
const HISTORY_LIMIT = 12
|
||||
const DIMENSION_TIE_PRIORITY = { B: 4, A: 3, C: 2, D: 1 }
|
||||
const NSTI_LOGO_BASE_URL = 'https://linghu-wmr.oss-cn-beijing.aliyuncs.com/sbti/Camera%20Roll'
|
||||
|
||||
function clone(data) {
|
||||
return JSON.parse(JSON.stringify(data))
|
||||
}
|
||||
|
||||
export function getNSTIQuestions() {
|
||||
return clone(NSTI_QUESTIONS)
|
||||
}
|
||||
|
||||
export function getNSTIPersonalityTypes() {
|
||||
return clone(NSTI_PERSONALITY_TYPES)
|
||||
}
|
||||
|
||||
export function getNSTILogoUrl(code) {
|
||||
if (!code || !/^N\d{2}$/.test(code)) return ''
|
||||
const index = Number(code.slice(1))
|
||||
if (!index || index < 1 || index > 16) return ''
|
||||
return `${NSTI_LOGO_BASE_URL}/${index}.png`
|
||||
}
|
||||
|
||||
export function getNSTIDimensions() {
|
||||
return clone(NSTI_DIMENSIONS)
|
||||
}
|
||||
|
||||
export function getNSTIResultByCode(code) {
|
||||
return NSTI_PERSONALITY_TYPES[code] ? clone(NSTI_PERSONALITY_TYPES[code]) : null
|
||||
}
|
||||
|
||||
export function getLatestNSTIResult() {
|
||||
return storage.get(NSTI_RESULT_KEY)
|
||||
}
|
||||
|
||||
export function getNSTIHistory() {
|
||||
return storage.get(NSTI_HISTORY_KEY, [])
|
||||
}
|
||||
|
||||
export function getNSTIDraft() {
|
||||
return storage.get(NSTI_DRAFT_KEY)
|
||||
}
|
||||
|
||||
export function saveNSTIDraft(draft) {
|
||||
storage.set(NSTI_DRAFT_KEY, draft)
|
||||
}
|
||||
|
||||
export function clearNSTIDraft() {
|
||||
storage.remove(NSTI_DRAFT_KEY)
|
||||
}
|
||||
|
||||
export function saveNSTIResult(result) {
|
||||
storage.set(NSTI_RESULT_KEY, result)
|
||||
const history = getNSTIHistory().filter((item) => item.id !== result.id)
|
||||
history.unshift(result)
|
||||
storage.set(NSTI_HISTORY_KEY, history.slice(0, HISTORY_LIMIT))
|
||||
clearNSTIDraft()
|
||||
}
|
||||
|
||||
function rankDimensions(dimensionScores) {
|
||||
return Object.entries(dimensionScores).sort((a, b) => {
|
||||
if (b[1] !== a[1]) return b[1] - a[1]
|
||||
return (DIMENSION_TIE_PRIORITY[b[0]] || 0) - (DIMENSION_TIE_PRIORITY[a[0]] || 0)
|
||||
})
|
||||
}
|
||||
|
||||
function resolveTopMatches(typeScores) {
|
||||
return Object.keys(typeScores)
|
||||
.map((code) => ({
|
||||
code,
|
||||
score: typeScores[code],
|
||||
...NSTI_PERSONALITY_TYPES[code]
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
if (b.score !== a.score) return b.score - a.score
|
||||
return (b.abstractRank || 0) - (a.abstractRank || 0)
|
||||
})
|
||||
}
|
||||
|
||||
export function calculateNSTIResult(answerRecords) {
|
||||
if (!Array.isArray(answerRecords) || answerRecords.length !== NSTI_QUESTIONS.length) {
|
||||
throw new Error('answers incomplete')
|
||||
}
|
||||
|
||||
const dimensionScores = { A: 0, B: 0, C: 0, D: 0 }
|
||||
const typeScores = {}
|
||||
Object.keys(NSTI_PERSONALITY_TYPES).forEach((code) => {
|
||||
typeScores[code] = 0
|
||||
})
|
||||
|
||||
answerRecords.forEach((answer) => {
|
||||
if (!answer || !answer.dimension) {
|
||||
throw new Error('invalid answer')
|
||||
}
|
||||
dimensionScores[answer.dimension] += 1
|
||||
Object.entries(answer.weights || {}).forEach(([code, weight]) => {
|
||||
typeScores[code] = (typeScores[code] || 0) + Number(weight || 0)
|
||||
})
|
||||
})
|
||||
|
||||
const rankedDimensions = rankDimensions(dimensionScores)
|
||||
const topPair = `${rankedDimensions[0][0]}${rankedDimensions[1][0]}`
|
||||
const boostedType = NSTI_DIMENSION_PAIR_MAP[topPair]
|
||||
if (boostedType) {
|
||||
typeScores[boostedType] += 1.25
|
||||
}
|
||||
|
||||
if (dimensionScores.D >= 7) {
|
||||
typeScores.N09 += 1.5
|
||||
}
|
||||
if (dimensionScores.B >= 5 && dimensionScores.C >= 3) {
|
||||
typeScores.N10 += 1
|
||||
}
|
||||
if (dimensionScores.A >= 5 && dimensionScores.B >= 3) {
|
||||
typeScores.N05 += 0.75
|
||||
typeScores.N01 += 0.5
|
||||
}
|
||||
if (dimensionScores.C >= 5 && dimensionScores.D <= 1) {
|
||||
typeScores.N16 += 1
|
||||
}
|
||||
|
||||
const topMatches = resolveTopMatches(typeScores)
|
||||
const resultType = topMatches[0]
|
||||
const totalAnswers = answerRecords.length
|
||||
|
||||
const dimensionBreakdown = rankedDimensions.map(([key, score]) => ({
|
||||
key,
|
||||
score,
|
||||
percentage: Math.round((score / totalAnswers) * 100),
|
||||
...NSTI_DIMENSIONS[key]
|
||||
}))
|
||||
|
||||
const completedAt = new Date().toISOString()
|
||||
const result = {
|
||||
id: `${resultType.code}-${Date.now()}`,
|
||||
typeCode: resultType.code,
|
||||
completedAt,
|
||||
totalAnswers,
|
||||
primaryDimension: dimensionBreakdown[0],
|
||||
secondaryDimension: dimensionBreakdown[1],
|
||||
dimensionScores,
|
||||
dimensionBreakdown,
|
||||
topMatches: topMatches.slice(0, 3).map((item) => ({
|
||||
code: item.code,
|
||||
name: item.name,
|
||||
emoji: item.emoji,
|
||||
catchphrase: item.catchphrase,
|
||||
logoUrl: getNSTILogoUrl(item.code),
|
||||
score: item.score,
|
||||
color: item.color,
|
||||
percentage: topMatches[0].score > 0 ? Math.round((item.score / topMatches[0].score) * 100) : 0
|
||||
})),
|
||||
answers: answerRecords,
|
||||
logoUrl: getNSTILogoUrl(resultType.code),
|
||||
...NSTI_PERSONALITY_TYPES[resultType.code]
|
||||
}
|
||||
|
||||
result.shareText = buildNSTIShareText(result)
|
||||
return result
|
||||
}
|
||||
|
||||
export function buildNSTIShareText(result) {
|
||||
if (!result) return '测测你的赛博尼古丁测试结果'
|
||||
return `我是${result.name}${result.emoji}\n“${result.catchphrase}”\n戒烟难度:${renderDifficultyStars(result.difficulty)}\n来测测你的赛博尼古丁测试结果`
|
||||
}
|
||||
|
||||
export function renderDifficultyStars(level = 0) {
|
||||
return '★'.repeat(level) + '☆'.repeat(Math.max(0, 5 - level))
|
||||
}
|
||||
|
||||
export function formatNSTITime(value) {
|
||||
if (!value) return ''
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return ''
|
||||
const month = `${date.getMonth() + 1}`.padStart(2, '0')
|
||||
const day = `${date.getDate()}`.padStart(2, '0')
|
||||
const hour = `${date.getHours()}`.padStart(2, '0')
|
||||
const minute = `${date.getMinutes()}`.padStart(2, '0')
|
||||
return `${month}.${day} ${hour}:${minute}`
|
||||
}
|
||||
@@ -41,3 +41,6 @@ export const USER_KEY = 'user'
|
||||
export const PROFILE_KEY = 'profile'
|
||||
export const USER_MODE_KEY = 'user_mode'
|
||||
export const QUIT_CHECKIN_KEY = 'quit_checkin'
|
||||
export const NSTI_RESULT_KEY = 'nsti_latest_result'
|
||||
export const NSTI_HISTORY_KEY = 'nsti_history'
|
||||
export const NSTI_DRAFT_KEY = 'nsti_draft'
|
||||
|
||||
Reference in New Issue
Block a user