feat:2.6.2 增加数字点连线、数物填写等涂色卡

This commit is contained in:
R524809
2025-12-24 14:51:17 +08:00
parent 20496c3cc8
commit 58423eb31a
16 changed files with 610 additions and 18 deletions
@@ -18,11 +18,33 @@ createMathPage({
functionId: '',
hasContent: false,
showShareDialog: false,
} as CanvasDataState,
showTypeSelector: true, // 控制是否显示类型选择器
currentMode: 'match', // 'match' 连线 或 'fill' 填写
currentModeName: '连线',
typeActions: [
{ name: '连线', value: 'match' },
{ name: '填写', value: 'fill' },
],
} as CanvasDataState & {
showTypeSelector: boolean;
currentMode: string;
currentModeName: string;
typeActions: Array<{ name: string; value: string }>;
},
onLoad(options: { id?: string }) {
onLoad(options: { id?: string; mode?: string }) {
const functionId = options.id || 'number-object-match';
this.initPageInfo(functionId, '数物对应');
const isFill = functionId === 'number-object-fill';
const currentMode = options.mode || (isFill ? 'fill' : 'match');
this.setData({
currentMode,
currentModeName: currentMode === 'fill' ? '填写' : '连线',
typeActions: [
{ name: '连线', value: 'match' },
{ name: '填写', value: 'fill' },
],
});
},
onReady() {
@@ -51,7 +73,7 @@ createMathPage({
}
try {
await this.drawService.draw(this.matchData);
await this.drawService.draw(this.matchData, this.data.currentMode);
this.setData({ hasContent: true });
} catch (error) {
console.error('绘制失败:', error);
@@ -142,4 +164,15 @@ createMathPage({
this.drawCanvas();
},
/** 选择类型 */
onSelectType(event: any) {
const { name, value } = event.detail;
this.setData({
currentMode: value,
currentModeName: name,
});
// 重新生成数据
this.onRandom();
},
});