app-library.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /**
  2. * 应用库常量清单
  3. *
  4. * 每个应用字段说明:
  5. * key - 在后端配置/URL 中使用的 key,对应 user_shortcut_config.app_key
  6. * name - 显示名称(中文)
  7. * icon - emoji 图标,与现有首页快捷入口一致,零资源成本
  8. * route - 直接进入的页面路径(uni-app navigationTo URL 写法)
  9. * canShortcut - 是否可以放入首页快捷区(true=可配置,false=已在首页有显著入口,不可配入快捷区)
  10. *
  11. * 应用库 = 所有“可直接进入的功能页面”,除已在首页有显著入口者外,其余均可在配置页中选择放入快捷区。
  12. *
  13. * 固定的 6 个快捷入口(默认值,新用户/无配置时):
  14. * task, interaction, tiandi, members, circle, shop
  15. *
  16. * 已在首页显著位置的功能(canShortcut=false,配置页可见但置灰标注"已在首页"):
  17. * report, article
  18. *
  19. * 可在快捷区配置的功能(canShortcut=true):
  20. * diet, ai, growth, wish, medal, game, assess, activity, membership, wealth
  21. */
  22. export const APP_LIBRARY = [
  23. // --- 已在首页有显著入口(不进快捷配置列表,但进应用库,置灰标注) ---
  24. {
  25. key: 'report',
  26. name: '健康报告',
  27. icon: '🩺',
  28. route: '/pages/health/report-upload',
  29. canShortcut: false,
  30. description: '体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡'
  31. },
  32. {
  33. key: 'article',
  34. name: '文章中心',
  35. icon: '📖',
  36. route: '/pages/article-center/index',
  37. canShortcut: false,
  38. description: '免费五维测评 · 个性化成长方案 · 全家共管 · 任务与积分激励'
  39. },
  40. // --- 可在快捷区配置 ---
  41. {
  42. key: 'task',
  43. name: '任务',
  44. icon: '📋',
  45. route: '/pages/tasks/tasks',
  46. canShortcut: true,
  47. description: '创建/下发、执行(含小游戏)、审核'
  48. },
  49. {
  50. key: 'interaction',
  51. name: '互动',
  52. icon: '💬',
  53. route: '/pages/action-detail/interaction-log',
  54. canShortcut: true,
  55. description: '记录家庭互动、查看互动历史'
  56. },
  57. {
  58. key: 'tiandi',
  59. name: '天盘',
  60. icon: '🏠',
  61. route: '/pages/mind-detail/family-dashboard',
  62. canShortcut: true,
  63. description: '家庭天盘、成长计划查看'
  64. },
  65. {
  66. key: 'members',
  67. name: '成员',
  68. icon: '👨‍👩‍👧‍👦',
  69. route: '/pages/profile-extra/family-members',
  70. canShortcut: true,
  71. description: '家庭成员管理、成员角色切换'
  72. },
  73. {
  74. key: 'circle',
  75. name: '圈子',
  76. icon: '🤝',
  77. route: '/pages/discover/circles',
  78. canShortcut: true,
  79. description: '圈子动态、创建/加入圈子'
  80. },
  81. {
  82. key: 'shop',
  83. name: '商城',
  84. icon: '🛒',
  85. route: '/pages/shop/index/index',
  86. canShortcut: true,
  87. description: '商品浏览、购买套餐、服务商品'
  88. },
  89. // --- 可配置的功能 ---
  90. {
  91. key: 'diet',
  92. name: '饮食推荐',
  93. icon: '🥗',
  94. route: '/pages/diet/index',
  95. canShortcut: true,
  96. description: ' personalized 饮食建议、食物/产品推荐'
  97. },
  98. {
  99. key: 'ai',
  100. name: 'AI管家',
  101. icon: '🤖',
  102. route: '/pages/ai/chat',
  103. canShortcut: true,
  104. description: 'AI健康问答、营养分析、挑食改善建议'
  105. },
  106. {
  107. key: 'growth',
  108. name: '成长记录',
  109. icon: '📈',
  110. route: '/pages/growth-main/index',
  111. canShortcut: true,
  112. description: '查看全家成长档案、里程碑、成长轨迹'
  113. },
  114. {
  115. key: 'wish',
  116. name: '心愿',
  117. icon: '⭐',
  118. route: '/pages/wishes/index',
  119. canShortcut: true,
  120. description: '创建心愿、浏览他人心愿、兑换'
  121. },
  122. {
  123. key: 'medal',
  124. name: '勋章',
  125. icon: '🏅',
  126. route: '/pages/rewards/rewards',
  127. canShortcut: true,
  128. description: '查看勋章墙、勋章获取方式'
  129. },
  130. {
  131. key: 'game',
  132. name: '小游戏',
  133. icon: '🎮',
  134. route: '/pages/games/list',
  135. canShortcut: true,
  136. description: '舒尔特方格、猜数字、数独小游戏'
  137. },
  138. {
  139. key: 'assess',
  140. name: '测评',
  141. icon: '🧪',
  142. route: '/pages/assessment/apply',
  143. canShortcut: true,
  144. description: '预约测评、查看报告、历史测评'
  145. },
  146. {
  147. key: 'activity',
  148. name: '活动',
  149. icon: '🎪',
  150. route: '/pages/activity/index',
  151. canShortcut: true,
  152. description: '查看活动、报名参与、活动记录'
  153. },
  154. {
  155. key: 'membership',
  156. name: '会员中心',
  157. icon: '👑',
  158. route: '/pages/membership/index',
  159. canShortcut: true,
  160. description: '查看会员状态、续费/升级、会员权益'
  161. },
  162. {
  163. key: 'wealth',
  164. name: '财富',
  165. icon: '💰',
  166. route: '/pages/wealth/index',
  167. canShortcut: true,
  168. description: '查看财富积分、收益明细、理财套餐'
  169. }
  170. ]
  171. /**
  172. * 获取应用库(所有 key 的只读快照,外部请勿修改原数组)
  173. * 用法:import { APP_LIBRARY } from '@/utils/app-library';或 APP_LIBRARY.slice()
  174. */
  175. export const getAppLibrary = () => APP_LIBRARY.slice()
  176. /**
  177. * 根据 key 在应用库中查找应用信息
  178. * 用法:import { findAppByKey } from '@/utils/app-library'
  179. * const app = findAppByKey('task')
  180. */
  181. export const findAppByKey = (key) => {
  182. return APP_LIBRARY.find(app => app.key === key)
  183. }
  184. /**
  185. * 获取所有可以放入首页快捷区的应用(canShortcut=true)
  186. * 用法:import { getShortcutableApps } from '@/utils/app-library'
  187. * const shortcutable = getShortcutableApps()
  188. */
  189. export const getShortcutableApps = () => APP_LIBRARY.filter(app => app.canShortcut === true)
  190. /**
  191. * 获取所有已在首页有显著入口的应用(canShortcut=false)
  192. * 用法:import { getFixedApps } from '@/utils/app-library'
  193. * const fixed = getFixedApps()
  194. */
  195. export const getFixedApps = () => APP_LIBRARY.filter(app => app.canShortcut === false)