Files
hello-dd-code ec87a9fc55 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
2026-04-11 01:49:19 +08:00

56 lines
1.9 KiB
Markdown

# NSTI 戒烟人格测试
## 概览
`NSTI` 是为 `smt` 小程序新增的一组轻量娱乐化测试页面,用 10 道题和 16 种抽象人格帮助用户以更低心理压力进入戒烟主题。
当前实现为纯前端方案,不依赖后端接口:
- 题库和人格画像:`src/utils/nsti-data.js`
- 结果算法与本地存储:`src/utils/nsti.js`
- 测试首页:`src/pages/nsti/index.vue`
- 答题页:`src/pages/nsti/test.vue`
- 结果页:`src/pages/nsti/result.vue`
- 入口位置:`src/pages/profile/index.vue`
## 页面流转
1. 用户从“我的”页进入 `NSTI 戒烟人格测试`
2.`pages/nsti/index` 查看测试说明和最近结果
3. 进入 `pages/nsti/test` 完成 10 道题
4. 本地计算结果后跳转 `pages/nsti/result`
5. 结果页可重新测试、分享文案、进入戒烟主流程
## 数据与存储
使用本地缓存保存测试结果和草稿:
- `nsti_latest_result`:最近一次结果
- `nsti_history`:历史结果列表,最多保留 12 条
- `nsti_draft`:中途退出后的答题草稿
对应常量定义在 `src/utils/storage.js`
## 结果算法
当前算法采用“维度计数 + 人格权重”的混合方案:
1. 每道题的 A/B/C/D 选项分别代表一种行为维度
2. 每个选项同时会给 1-2 个具体人格加权
3. 提交后先统计维度分布,再统计人格得分
4. 根据前两高维度组合给对应人格一个额外加权
5. 取最终得分最高的人格作为结果,若分数相同则优先更抽象的人格
这种做法兼顾了:
- 题目抽象风格和直觉作答体验
- 16 型人格的差异化结果
- 后续扩展为后台配置时的可维护性
## 后续可扩展方向
- 把题库和人格画像迁移到后台配置
- 记录测试完成率、分享率、人格分布
- 把人格结果与首页激励文案、AI 建议、戒烟计划联动
- 增加人格历史对比和“再次测试看变化”