|
|
@@ -0,0 +1,202 @@
|
|
|
+/**
|
|
|
+ * 应用库常量清单
|
|
|
+ *
|
|
|
+ * 每个应用字段说明:
|
|
|
+ * key - 在后端配置/URL 中使用的 key,对应 user_shortcut_config.app_key
|
|
|
+ * name - 显示名称(中文)
|
|
|
+ * icon - emoji 图标,与现有首页快捷入口一致,零资源成本
|
|
|
+ * route - 直接进入的页面路径(uni-app navigationTo URL 写法)
|
|
|
+ * canShortcut - 是否可以放入首页快捷区(true=可配置,false=已在首页有显著入口,不可配入快捷区)
|
|
|
+ *
|
|
|
+ * 应用库 = 所有“可直接进入的功能页面”,除已在首页有显著入口者外,其余均可在配置页中选择放入快捷区。
|
|
|
+ *
|
|
|
+ * 固定的 6 个快捷入口(默认值,新用户/无配置时):
|
|
|
+ * task, interaction, tiandi, members, circle, shop
|
|
|
+ *
|
|
|
+ * 已在首页显著位置的功能(canShortcut=false,配置页可见但置灰标注"已在首页"):
|
|
|
+ * report, article
|
|
|
+ *
|
|
|
+ * 可在快捷区配置的功能(canShortcut=true):
|
|
|
+ * diet, ai, growth, wish, medal, game, assess, activity, membership, wealth
|
|
|
+ */
|
|
|
+
|
|
|
+export const APP_LIBRARY = [
|
|
|
+ // --- 已在首页有显著入口(不进快捷配置列表,但进应用库,置灰标注) ---
|
|
|
+ {
|
|
|
+ key: 'report',
|
|
|
+ name: '健康报告',
|
|
|
+ icon: '🩺',
|
|
|
+ route: '/pages/health/report-upload',
|
|
|
+ canShortcut: false,
|
|
|
+ description: '体检报告 · 菌群检测 · 认知测评 · 心理测评 · 情绪打卡'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'article',
|
|
|
+ name: '文章中心',
|
|
|
+ icon: '📖',
|
|
|
+ route: '/pages/article-center/index',
|
|
|
+ canShortcut: false,
|
|
|
+ description: '免费五维测评 · 个性化成长方案 · 全家共管 · 任务与积分激励'
|
|
|
+ },
|
|
|
+
|
|
|
+ // --- 可在快捷区配置 ---
|
|
|
+ {
|
|
|
+ key: 'task',
|
|
|
+ name: '任务',
|
|
|
+ icon: '📋',
|
|
|
+ route: '/pages/tasks/tasks',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '创建/下发、执行(含小游戏)、审核'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'interaction',
|
|
|
+ name: '互动',
|
|
|
+ icon: '💬',
|
|
|
+ route: '/pages/action-detail/interaction-log',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '记录家庭互动、查看互动历史'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'tiandi',
|
|
|
+ name: '天盘',
|
|
|
+ icon: '🏠',
|
|
|
+ route: '/pages/mind-detail/family-dashboard',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '家庭天盘、成长计划查看'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'members',
|
|
|
+ name: '成员',
|
|
|
+ icon: '👨👩👧👦',
|
|
|
+ route: '/pages/profile-extra/family-members',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '家庭成员管理、成员角色切换'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'circle',
|
|
|
+ name: '圈子',
|
|
|
+ icon: '🤝',
|
|
|
+ route: '/pages/discover/circles',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '圈子动态、创建/加入圈子'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'shop',
|
|
|
+ name: '商城',
|
|
|
+ icon: '🛒',
|
|
|
+ route: '/pages/shop/index/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '商品浏览、购买套餐、服务商品'
|
|
|
+ },
|
|
|
+
|
|
|
+ // --- 可配置的功能 ---
|
|
|
+ {
|
|
|
+ key: 'diet',
|
|
|
+ name: '饮食推荐',
|
|
|
+ icon: '🥗',
|
|
|
+ route: '/pages/diet/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: ' personalized 饮食建议、食物/产品推荐'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'ai',
|
|
|
+ name: 'AI管家',
|
|
|
+ icon: '🤖',
|
|
|
+ route: '/pages/ai/chat',
|
|
|
+ canShortcut: true,
|
|
|
+ description: 'AI健康问答、营养分析、挑食改善建议'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'growth',
|
|
|
+ name: '成长记录',
|
|
|
+ icon: '📈',
|
|
|
+ route: '/pages/growth-main/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '查看全家成长档案、里程碑、成长轨迹'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'wish',
|
|
|
+ name: '心愿',
|
|
|
+ icon: '⭐',
|
|
|
+ route: '/pages/wishes/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '创建心愿、浏览他人心愿、兑换'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'medal',
|
|
|
+ name: '勋章',
|
|
|
+ icon: '🏅',
|
|
|
+ route: '/pages/rewards/rewards',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '查看勋章墙、勋章获取方式'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'game',
|
|
|
+ name: '小游戏',
|
|
|
+ icon: '🎮',
|
|
|
+ route: '/pages/games/list',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '舒尔特方格、猜数字、数独小游戏'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'assess',
|
|
|
+ name: '测评',
|
|
|
+ icon: '🧪',
|
|
|
+ route: '/pages/assessment/apply',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '预约测评、查看报告、历史测评'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'activity',
|
|
|
+ name: '活动',
|
|
|
+ icon: '🎪',
|
|
|
+ route: '/pages/activity/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '查看活动、报名参与、活动记录'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'membership',
|
|
|
+ name: '会员中心',
|
|
|
+ icon: '👑',
|
|
|
+ route: '/pages/membership/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '查看会员状态、续费/升级、会员权益'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: 'wealth',
|
|
|
+ name: '财富',
|
|
|
+ icon: '💰',
|
|
|
+ route: '/pages/wealth/index',
|
|
|
+ canShortcut: true,
|
|
|
+ description: '查看财富积分、收益明细、理财套餐'
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取应用库(所有 key 的只读快照,外部请勿修改原数组)
|
|
|
+ * 用法:import { APP_LIBRARY } from '@/utils/app-library';或 APP_LIBRARY.slice()
|
|
|
+ */
|
|
|
+export const getAppLibrary = () => APP_LIBRARY.slice()
|
|
|
+
|
|
|
+/**
|
|
|
+ * 根据 key 在应用库中查找应用信息
|
|
|
+ * 用法:import { findAppByKey } from '@/utils/app-library'
|
|
|
+ * const app = findAppByKey('task')
|
|
|
+ */
|
|
|
+export const findAppByKey = (key) => {
|
|
|
+ return APP_LIBRARY.find(app => app.key === key)
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取所有可以放入首页快捷区的应用(canShortcut=true)
|
|
|
+ * 用法:import { getShortcutableApps } from '@/utils/app-library'
|
|
|
+ * const shortcutable = getShortcutableApps()
|
|
|
+ */
|
|
|
+export const getShortcutableApps = () => APP_LIBRARY.filter(app => app.canShortcut === true)
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取所有已在首页有显著入口的应用(canShortcut=false)
|
|
|
+ * 用法:import { getFixedApps } from '@/utils/app-library'
|
|
|
+ * const fixed = getFixedApps()
|
|
|
+ */
|
|
|
+export const getFixedApps = () => APP_LIBRARY.filter(app => app.canShortcut === false)
|