feat:2.6.2 增加数字点连线、数物填写等涂色卡
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"toy-button": "../../ui/button/button",
|
||||
"share-guide-popup": "../../components/share-guide-popup/share-guide-popup",
|
||||
"math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons",
|
||||
"draw-ad": "../../components/draw-ad/draw-ad"
|
||||
"draw-ad": "../../components/draw-ad/draw-ad",
|
||||
"math-type-selector": "../../components/math-type-selector/math-type-selector"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
<template
|
||||
is="canvasPageTemplate"
|
||||
data="{{boxWidth: boxWidth, boxHeight: boxHeight, hasTypeSelector: false, adType: 'mathDraw', disabled: !hasContent, showShareDialog: showShareDialog}}" />
|
||||
data="{{boxWidth: boxWidth, boxHeight: boxHeight, hasTypeSelector: true, currentModeName: currentModeName, typeActions: typeActions, adType: 'mathDraw', disabled: !hasContent, showShareDialog: showShareDialog}}" />
|
||||
|
||||
Reference in New Issue
Block a user