77 lines
1.7 KiB
TypeScript
77 lines
1.7 KiB
TypeScript
/**
|
|
* 专注力页面专用的 Mixin
|
|
* 基于通用 pageMixin,提供专注力模块特定的配置
|
|
*/
|
|
|
|
import { createPage, PageCommonMethodsConfig } from '../../base/pageMixin';
|
|
|
|
/**
|
|
* 专注力模块的函数类型定义
|
|
*/
|
|
export interface FocusFunctionType {
|
|
id: string;
|
|
title: string;
|
|
desc: string;
|
|
}
|
|
|
|
/**
|
|
* 专注力模块的函数列表
|
|
* TODO: 根据实际需求补充完整的功能列表
|
|
*/
|
|
export const FOCUS_FUNCTION_TYPES: FocusFunctionType[] = [
|
|
{
|
|
id: 'grid-drawing',
|
|
title: '格子仿画',
|
|
desc: '在格子中绘制颜色,形成各种形状',
|
|
},
|
|
// 可以在这里添加更多专注力相关的功能
|
|
// {
|
|
// id: 'pattern-memory',
|
|
// title: '图案记忆',
|
|
// desc: '记住并重现图案',
|
|
// },
|
|
];
|
|
|
|
/**
|
|
* 专注力模块的分享配置
|
|
*/
|
|
const focusShareConfig = {
|
|
title: '涂鸦丫-专注力训练',
|
|
imageUrl: 'https://cdn.joeyone.cn/doodle/share-img/focus-share.png',
|
|
};
|
|
|
|
/**
|
|
* 专注力模块的页面信息查找函数
|
|
*/
|
|
function focusPageInfoLookup(functionId: string) {
|
|
const functionItem = FOCUS_FUNCTION_TYPES.find(
|
|
(item) => item.id === functionId,
|
|
);
|
|
|
|
if (functionItem) {
|
|
return {
|
|
title: functionItem.title,
|
|
desc: functionItem.desc,
|
|
};
|
|
}
|
|
|
|
return undefined;
|
|
}
|
|
|
|
/**
|
|
* 专注力模块的配置
|
|
*/
|
|
const focusConfig: PageCommonMethodsConfig = {
|
|
shareConfig: focusShareConfig,
|
|
pageInfoLookup: focusPageInfoLookup,
|
|
};
|
|
|
|
/**
|
|
* 创建专注力页面的便捷函数
|
|
* 自动应用公共方法并注册为页面
|
|
* @param pageOptions 页面选项
|
|
*/
|
|
export function createFocusPage(pageOptions: any) {
|
|
createPage(pageOptions, focusConfig);
|
|
}
|