diff --git a/miniprogram/app.json b/miniprogram/app.json index 413296e..f9b870d 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -32,7 +32,8 @@ "colorPattern/colorPattern", "matchConnect/matchConnect", "lineRecognition/lineRecognition", - "gridReasoning/gridReasoning" + "gridReasoning/gridReasoning", + "codeConnect/codeConnect" ], "independent": false } diff --git a/miniprogram/components/draw-ad/draw-ad.json b/miniprogram/components/draw-ad/draw-ad.json new file mode 100644 index 0000000..59a1db6 --- /dev/null +++ b/miniprogram/components/draw-ad/draw-ad.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/miniprogram/components/draw-ad/draw-ad.ts b/miniprogram/components/draw-ad/draw-ad.ts new file mode 100644 index 0000000..9165d2e --- /dev/null +++ b/miniprogram/components/draw-ad/draw-ad.ts @@ -0,0 +1,9 @@ +Component({ + properties: { + /** 广告类型:focusDraw 或 mathDraw */ + type: { + type: String, + value: 'focusDraw', + }, + }, +}); diff --git a/miniprogram/components/draw-ad/draw-ad.wxml b/miniprogram/components/draw-ad/draw-ad.wxml new file mode 100644 index 0000000..9004e6b --- /dev/null +++ b/miniprogram/components/draw-ad/draw-ad.wxml @@ -0,0 +1,6 @@ + + + + + + diff --git a/miniprogram/components/draw-ad/draw-ad.wxss b/miniprogram/components/draw-ad/draw-ad.wxss new file mode 100644 index 0000000..3b56623 --- /dev/null +++ b/miniprogram/components/draw-ad/draw-ad.wxss @@ -0,0 +1,3 @@ +.draw-ad-container { + margin-top: 20rpx; +} diff --git a/miniprogram/constants/focusFunctions.ts b/miniprogram/constants/focusFunctions.ts index da33173..5a55adb 100644 --- a/miniprogram/constants/focusFunctions.ts +++ b/miniprogram/constants/focusFunctions.ts @@ -64,6 +64,14 @@ export const FOCUS_FUNCTION_TYPES: FocusFunctionType[] = [ desc: '仔细观察,推理出合并方格并连线', icon: '🧩', }, + // 译码连线 + { + id: 'code-connect', + page: 'codeConnect', + title: '译码连线', + desc: '按照数字顺序,将数字对应的颜色连起来', + icon: '🔢', + }, // 格子仿画 { id: 'grid-drawing-3x3', diff --git a/miniprogram/focusPages/codeConnect/codeConnect.json b/miniprogram/focusPages/codeConnect/codeConnect.json new file mode 100644 index 0000000..3b712be --- /dev/null +++ b/miniprogram/focusPages/codeConnect/codeConnect.json @@ -0,0 +1,13 @@ +{ + "navigationBarTitleText": "译码连线", + "navigationBarBackgroundColor": "#FFD719", + "homeButton": true, + "backgroundColor": "#F6F6F6", + "enablePullDownRefresh": false, + "usingComponents": { + "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" + } +} diff --git a/miniprogram/focusPages/codeConnect/codeConnect.ts b/miniprogram/focusPages/codeConnect/codeConnect.ts new file mode 100644 index 0000000..c9c73b8 --- /dev/null +++ b/miniprogram/focusPages/codeConnect/codeConnect.ts @@ -0,0 +1,150 @@ +import CodeConnectDraw from '../shared/service/codeConnectDraw'; +import { createFocusPage } from '../shared/common/focusPageMixin'; +import { CodeConnectData } from '../shared/service/codeConnectDraw'; +import { WATER_COLORS } from '../../constants/colors'; + +createFocusPage({ + canvas: null as Canvas | null, + ctx: null as RenderingContext | null, + boxHeight: 0, + boxWidth: 0, + drawService: null as CodeConnectDraw | null, + codeData: null as CodeConnectData | null, + + data: { + pageTitle: '译码连线', + functionId: '', + hasContent: false, + showShareDialog: false, + }, + + onLoad(options: { id?: string }) { + const functionId = options.id || 'code-connect'; + this.setData({ + functionId, + }); + this.initPageInfo(functionId, '译码连线'); + }, + + onReady() { + this.initCanvas({ + createDrawService: ( + canvas: Canvas, + ctx: RenderingContext, + options?: Record, + ) => { + return new CodeConnectDraw(canvas, ctx, options); + }, + drawServiceOptions: { + title: this.data.pageTitle, + subTitle: '按照数字顺序,将数字对应的颜色连起来', + functionId: this.data.functionId, + }, + onCanvasReady: () => { + // 初始随机生成 + this.onRandom(); + }, + }); + }, + + /** + * 绘制Canvas内容 + */ + async drawCanvas() { + if (!this.ctx || !this.drawService || !this.codeData) { + return; + } + + try { + await this.drawService.draw(this.codeData); + this.setData({ hasContent: true }); + } catch (error) { + console.error('绘制失败:', error); + this.setData({ hasContent: false }); + } + }, + + /** + * 随机生成 + */ + onRandom() { + // 随机选择起始数字:1、2或3 + const startNumberOptions = [1, 2, 3]; + const startNumber = + startNumberOptions[ + Math.floor(Math.random() * startNumberOptions.length) + ]; + + // 生成8个连续的数字(1-8、2-9或3-10) + const numbers: number[] = []; + for (let i = 0; i < 8; i++) { + numbers.push(startNumber + i); + } + + // 从WATER_COLORS.extended24中随机选择8种不重复的颜色 + const colorIndices = Array.from( + { length: WATER_COLORS.extended24.length }, + (_, i) => i, + ); + const shuffledIndices = [...colorIndices].sort( + () => Math.random() - 0.5, + ); + const selectedIndices = shuffledIndices.slice(0, 8); + + // 创建颜色映射 + const colorMap = numbers.map((number, index) => ({ + number, + color: WATER_COLORS.extended24[selectedIndices[index]].hex, + })); + + // 生成4个组的题目 + const groups: Array<{ + sequence: number[]; + dots: Array<{ + number: number; + color: string; + angle: number; + }>; + }> = []; + + for (let i = 0; i < 4; i++) { + // 从当前数字范围中随机选择6个数字(不重复) + const shuffledNumbers = [...numbers].sort( + () => Math.random() - 0.5, + ); + const sequence = shuffledNumbers.slice(0, 5); + + // 生成8个圆点的位置(圆形分布) + const dots: Array<{ + number: number; + color: string; + angle: number; + }> = []; + + // 8个圆点均匀分布在圆周上 + for (let j = 0; j < 8; j++) { + const angle = (j / 8) * Math.PI * 2 - Math.PI / 2; // 从顶部开始,逆时针 + const number = numbers[j]; + const colorInfo = colorMap.find((m) => m.number === number); + dots.push({ + number, + color: colorInfo?.color || '#000', + angle, + }); + } + + groups.push({ + sequence, + dots, + }); + } + + this.codeData = { + colorMap, + startNumber, + groups, + }; + + this.drawCanvas(); + }, +}); diff --git a/miniprogram/focusPages/codeConnect/codeConnect.wxml b/miniprogram/focusPages/codeConnect/codeConnect.wxml new file mode 100644 index 0000000..b475771 --- /dev/null +++ b/miniprogram/focusPages/codeConnect/codeConnect.wxml @@ -0,0 +1,38 @@ + + + 预览打印效果 + + + + + + + + + + 随机生成 + + + + + + + + diff --git a/miniprogram/focusPages/codeConnect/codeConnect.wxss b/miniprogram/focusPages/codeConnect/codeConnect.wxss new file mode 100644 index 0000000..ddc41cc --- /dev/null +++ b/miniprogram/focusPages/codeConnect/codeConnect.wxss @@ -0,0 +1 @@ +@import '../../base/baseDrawPage.wxss'; diff --git a/miniprogram/focusPages/colorPattern/colorPattern.json b/miniprogram/focusPages/colorPattern/colorPattern.json index 7560b48..c6b0149 100644 --- a/miniprogram/focusPages/colorPattern/colorPattern.json +++ b/miniprogram/focusPages/colorPattern/colorPattern.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/colorPattern/colorPattern.wxml b/miniprogram/focusPages/colorPattern/colorPattern.wxml index cbd06f0..b475771 100644 --- a/miniprogram/focusPages/colorPattern/colorPattern.wxml +++ b/miniprogram/focusPages/colorPattern/colorPattern.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/focusPages/gridDrawing/gridDrawing.json b/miniprogram/focusPages/gridDrawing/gridDrawing.json index 57c0785..a8d6988 100644 --- a/miniprogram/focusPages/gridDrawing/gridDrawing.json +++ b/miniprogram/focusPages/gridDrawing/gridDrawing.json @@ -7,6 +7,7 @@ "usingComponents": { "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", "math-type-selector": "../../components/math-type-selector/math-type-selector", - "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/gridDrawing/gridDrawing.wxml b/miniprogram/focusPages/gridDrawing/gridDrawing.wxml index bd1d15c..17d4f8a 100644 --- a/miniprogram/focusPages/gridDrawing/gridDrawing.wxml +++ b/miniprogram/focusPages/gridDrawing/gridDrawing.wxml @@ -17,7 +17,7 @@ type-actions="{{typeActions}}" bind:select="onSelectType" bind:random="onRandom" /> - + diff --git a/miniprogram/focusPages/gridReasoning/gridReasoning.json b/miniprogram/focusPages/gridReasoning/gridReasoning.json index c479e70..e41d4fa 100644 --- a/miniprogram/focusPages/gridReasoning/gridReasoning.json +++ b/miniprogram/focusPages/gridReasoning/gridReasoning.json @@ -7,6 +7,7 @@ "usingComponents": { "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", - "math-type-selector": "../../components/math-type-selector/math-type-selector" + "math-type-selector": "../../components/math-type-selector/math-type-selector", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/gridReasoning/gridReasoning.wxml b/miniprogram/focusPages/gridReasoning/gridReasoning.wxml index f63ead0..092df36 100644 --- a/miniprogram/focusPages/gridReasoning/gridReasoning.wxml +++ b/miniprogram/focusPages/gridReasoning/gridReasoning.wxml @@ -17,7 +17,7 @@ type-actions="{{operatorTypeActions}}" bind:select="onSelectType" bind:random="onRandom" /> - + diff --git a/miniprogram/focusPages/lineRecognition/lineRecognition.json b/miniprogram/focusPages/lineRecognition/lineRecognition.json index 23ca7df..bcbe858 100644 --- a/miniprogram/focusPages/lineRecognition/lineRecognition.json +++ b/miniprogram/focusPages/lineRecognition/lineRecognition.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/lineRecognition/lineRecognition.wxml b/miniprogram/focusPages/lineRecognition/lineRecognition.wxml index cbd06f0..b475771 100644 --- a/miniprogram/focusPages/lineRecognition/lineRecognition.wxml +++ b/miniprogram/focusPages/lineRecognition/lineRecognition.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/focusPages/matchConnect/matchConnect.json b/miniprogram/focusPages/matchConnect/matchConnect.json index 3196d2d..652a7b5 100644 --- a/miniprogram/focusPages/matchConnect/matchConnect.json +++ b/miniprogram/focusPages/matchConnect/matchConnect.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/matchConnect/matchConnect.wxml b/miniprogram/focusPages/matchConnect/matchConnect.wxml index cbd06f0..b475771 100644 --- a/miniprogram/focusPages/matchConnect/matchConnect.wxml +++ b/miniprogram/focusPages/matchConnect/matchConnect.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/focusPages/positionColoring/positionColoring.json b/miniprogram/focusPages/positionColoring/positionColoring.json index 94b8061..da143e0 100644 --- a/miniprogram/focusPages/positionColoring/positionColoring.json +++ b/miniprogram/focusPages/positionColoring/positionColoring.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/positionColoring/positionColoring.wxml b/miniprogram/focusPages/positionColoring/positionColoring.wxml index cbd06f0..b475771 100644 --- a/miniprogram/focusPages/positionColoring/positionColoring.wxml +++ b/miniprogram/focusPages/positionColoring/positionColoring.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/focusPages/shape/shape.json b/miniprogram/focusPages/shape/shape.json index ff5baac..a34a74f 100644 --- a/miniprogram/focusPages/shape/shape.json +++ b/miniprogram/focusPages/shape/shape.json @@ -13,6 +13,7 @@ "shape-card": "../../components/shape-card/shape-card", "shape-picker": "../../components/shape-picker/shape-picker", "color-picker": "../../components/color-picker/color-picker", - "share-guide-popup": "../../components/share-guide-popup/share-guide-popup" + "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/shape/shape.wxml b/miniprogram/focusPages/shape/shape.wxml index 628e4e3..fcf2b00 100644 --- a/miniprogram/focusPages/shape/shape.wxml +++ b/miniprogram/focusPages/shape/shape.wxml @@ -64,7 +64,7 @@ class="canvas-content" style="width:{{boxWidth}}px;height:{{boxHeight}}px" /> - + diff --git a/miniprogram/focusPages/shapeSymbol/shapeSymbol.json b/miniprogram/focusPages/shapeSymbol/shapeSymbol.json index cbaf7e9..29533d4 100644 --- a/miniprogram/focusPages/shapeSymbol/shapeSymbol.json +++ b/miniprogram/focusPages/shapeSymbol/shapeSymbol.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/focusPages/shapeSymbol/shapeSymbol.wxml b/miniprogram/focusPages/shapeSymbol/shapeSymbol.wxml index cbd06f0..b475771 100644 --- a/miniprogram/focusPages/shapeSymbol/shapeSymbol.wxml +++ b/miniprogram/focusPages/shapeSymbol/shapeSymbol.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/focusPages/shared/service/codeConnectDraw.ts b/miniprogram/focusPages/shared/service/codeConnectDraw.ts new file mode 100644 index 0000000..870be13 --- /dev/null +++ b/miniprogram/focusPages/shared/service/codeConnectDraw.ts @@ -0,0 +1,221 @@ +/** + * 译码连线绘制服务 + */ + +import { BaseDrawService } from '../../../service/baseDraw'; + +/** + * 译码连线数据 + */ +export interface CodeConnectData { + /** 参考区域:数字到颜色的映射(8个数字,可能是1-8、2-9、3-10) */ + colorMap: Array<{ + number: number; // 数字(可能是1-8、2-9、3-10) + color: string; + }>; + /** 起始数字(1、2或3) */ + startNumber: number; + /** 内容区域:4个组的题目 */ + groups: Array<{ + /** 数字序列(6个数字,用-连接) */ + sequence: number[]; + /** 圆环内圆点的位置和颜色(8个圆点,圆形分布) */ + dots: Array<{ + number: number; // 对应的数字 + color: string; // 对应的颜色 + angle: number; // 角度(弧度) + }>; + }>; +} + +/** + * 译码连线绘制服务 + */ +class CodeConnectDraw extends BaseDrawService { + codeData: CodeConnectData | null = null; + + constructor( + canvas: Canvas, + ctx: RenderingContext, + options?: Record, + ) { + super(canvas, ctx, options); + } + + /** + * 绘制译码连线内容 + */ + async draw(codeData: CodeConnectData) { + if (!codeData || !codeData.colorMap || !codeData.groups) { + return; + } + + this.setPrintConfig(); + this.codeData = codeData; + this.clear(); + this.setPaper(); + + // 绘制Header + if (this.headerType !== 'minimal') { + await this.drawHeader(); + } else { + this.drawMiniHeader(); + } + + // 绘制内容区域 + this.drawDivider(); + await this.drawContent({ + canvas: this.canvas, + ctx: this.ctx, + codeData: this.codeData, + canvasWidth: this.canvasWidth, + startY: this.currentY, + }); + } + + /** + * 绘制内容区域 + */ + private async drawContent(params: { + canvas: WechatMiniprogram.Canvas; + ctx: RenderingContext; + codeData: CodeConnectData; + canvasWidth: number; + startY: number; + }): Promise { + const { ctx, codeData, canvasWidth } = params; + let { startY } = params; + + startY = startY + 25; + + const margin = 40; // 左右边距 + + // ========== 上部参考区域 ========== + const referenceStartY = startY; + const referenceCellSize = 50; // 每个方格的大小 + const referenceGridWidth = referenceCellSize * 8; // 网格总宽度(8列) + + // 计算参考区域的起始X坐标(居中) + const referenceStartX = + margin + (canvasWidth - margin * 2 - referenceGridWidth) / 2; + + // 使用drawGridLines绘制网格(2行8列,格子之间没有间距) + this.drawGridLines( + referenceStartX, + referenceStartY, + referenceCellSize, + referenceCellSize, + 8, + 2, + ); + + // 绘制第一行:数字 + for (let i = 0; i < 8; i++) { + const cellX = referenceStartX + i * referenceCellSize; + const cellY = referenceStartY; + + // 绘制数字 + const number = codeData.colorMap[i].number; + ctx.fillStyle = '#000'; + ctx.font = 'bold 24px Arial'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.fillText( + number.toString(), + cellX + referenceCellSize / 2, + cellY + referenceCellSize / 2, + ); + } + + // 绘制第二行:圆点 + const dotRowY = referenceStartY + referenceCellSize; + const dotRadius = 15; // 圆点半径 + + for (let i = 0; i < 8; i++) { + const cellX = referenceStartX + i * referenceCellSize; + const cellY = dotRowY; + + // 绘制圆点(有边框) + const dotX = cellX + referenceCellSize / 2; + const dotY = cellY + referenceCellSize / 2; + const color = codeData.colorMap[i].color; + this.drawDot(ctx, dotX, dotY, dotRadius, color, '#000'); + } + + // ========== 虚线分割 ========== + const dividerY = dotRowY + referenceCellSize + 30; + this.drawDashedDivider(dividerY, margin); + + // ========== 下部内容区域 ========== + const contentStartY = dividerY + 40; + const groupSpacingX = 80; // 一行中两组之间的间距 + const groupSpacingY = 45; // 行之间的间距 + const textCircleSpacing = 15; // 数字文本与圆环的间距 + const circleRadius = 90; // 大圆环半径 + const dotPadding = 10; // 圆点距离圆环边线的间距 + const innerRadius = circleRadius - dotPadding - dotRadius; // 圆点分布圆的半径 + const textHeight = 25; // 数字文本的高度 + + // 计算每组的总宽度(包括圆环) + const groupWidth = circleRadius * 2; + const totalGroupsWidth = 2 * groupWidth + groupSpacingX; + const groupsStartX = + margin + (canvasWidth - margin * 2 - totalGroupsWidth) / 2; + + // 绘制4个组(两行两列) + for (let row = 0; row < 2; row++) { + for (let col = 0; col < 2; col++) { + const groupIndex = row * 2 + col; + const group = codeData.groups[groupIndex]; + if (!group) continue; + + const groupX = + groupsStartX + col * (groupWidth + groupSpacingX); + const groupY = + contentStartY + + row * + (circleRadius * 2 + + textHeight + + groupSpacingY + + textCircleSpacing); + + // 绘制大圆环 + const circleCenterX = groupX + groupWidth / 2; + const circleCenterY = + groupY + textHeight + circleRadius + textCircleSpacing; + ctx.strokeStyle = '#888'; + ctx.lineWidth = 1; + ctx.beginPath(); + ctx.arc( + circleCenterX, + circleCenterY, + circleRadius, + 0, + Math.PI * 2, + ); + ctx.stroke(); + + // 绘制数字序列(在圆环正上方) + const sequenceText = group.sequence.join('-'); + ctx.fillStyle = '#000'; + ctx.font = 'bold 20px Arial'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'bottom'; + ctx.fillText(sequenceText, circleCenterX, groupY + textHeight); + + // 绘制圆环内的8个圆点(圆形分布) + for (const dot of group.dots) { + const dotX = + circleCenterX + Math.cos(dot.angle) * innerRadius; + const dotY = + circleCenterY + Math.sin(dot.angle) * innerRadius; + + // 绘制圆点(有边框) + this.drawDot(ctx, dotX, dotY, dotRadius, dot.color, '#000'); + } + } + } + } +} + +export default CodeConnectDraw; diff --git a/miniprogram/mathPages/addition/addition.json b/miniprogram/mathPages/addition/addition.json index 049ced1..e52933d 100644 --- a/miniprogram/mathPages/addition/addition.json +++ b/miniprogram/mathPages/addition/addition.json @@ -7,6 +7,7 @@ "usingComponents": { "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", "math-type-selector": "../../components/math-type-selector/math-type-selector", - "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/addition/addition.wxml b/miniprogram/mathPages/addition/addition.wxml index d60047d..b0feede 100644 --- a/miniprogram/mathPages/addition/addition.wxml +++ b/miniprogram/mathPages/addition/addition.wxml @@ -18,7 +18,7 @@ bind:select="onSelectType" bind:random="onRandom" /> - + diff --git a/miniprogram/mathPages/compare/compare.json b/miniprogram/mathPages/compare/compare.json index 3daa7dd..bc8b4ed 100644 --- a/miniprogram/mathPages/compare/compare.json +++ b/miniprogram/mathPages/compare/compare.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/compare/compare.wxml b/miniprogram/mathPages/compare/compare.wxml index 25c0301..9ee45f2 100644 --- a/miniprogram/mathPages/compare/compare.wxml +++ b/miniprogram/mathPages/compare/compare.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/mathPages/countMatch/countMatch.json b/miniprogram/mathPages/countMatch/countMatch.json index 121f4e1..1b1b002 100644 --- a/miniprogram/mathPages/countMatch/countMatch.json +++ b/miniprogram/mathPages/countMatch/countMatch.json @@ -7,6 +7,7 @@ "usingComponents": { "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", "math-type-selector": "../../components/math-type-selector/math-type-selector", - "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/countMatch/countMatch.wxml b/miniprogram/mathPages/countMatch/countMatch.wxml index 97844da..c68d1d3 100644 --- a/miniprogram/mathPages/countMatch/countMatch.wxml +++ b/miniprogram/mathPages/countMatch/countMatch.wxml @@ -18,7 +18,7 @@ type-actions="{{typeActions}}" bind:select="onSelectType" bind:random="onRandom" /> - + diff --git a/miniprogram/mathPages/countingSelect/countingSelect.json b/miniprogram/mathPages/countingSelect/countingSelect.json index f9ddedb..75297b7 100644 --- a/miniprogram/mathPages/countingSelect/countingSelect.json +++ b/miniprogram/mathPages/countingSelect/countingSelect.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/countingSelect/countingSelect.wxml b/miniprogram/mathPages/countingSelect/countingSelect.wxml index 25c0301..9ee45f2 100644 --- a/miniprogram/mathPages/countingSelect/countingSelect.wxml +++ b/miniprogram/mathPages/countingSelect/countingSelect.wxml @@ -24,7 +24,7 @@ 随机生成 - + diff --git a/miniprogram/mathPages/missingNumber/missingNumber.json b/miniprogram/mathPages/missingNumber/missingNumber.json index caa0eb5..bcd8778 100644 --- a/miniprogram/mathPages/missingNumber/missingNumber.json +++ b/miniprogram/mathPages/missingNumber/missingNumber.json @@ -7,6 +7,7 @@ "usingComponents": { "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", "math-type-selector": "../../components/math-type-selector/math-type-selector", - "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/missingNumber/missingNumber.wxml b/miniprogram/mathPages/missingNumber/missingNumber.wxml index 97844da..c68d1d3 100644 --- a/miniprogram/mathPages/missingNumber/missingNumber.wxml +++ b/miniprogram/mathPages/missingNumber/missingNumber.wxml @@ -18,7 +18,7 @@ type-actions="{{typeActions}}" bind:select="onSelectType" bind:random="onRandom" /> - + diff --git a/miniprogram/mathPages/numberDecompose/numberDecompose.json b/miniprogram/mathPages/numberDecompose/numberDecompose.json index 5f0ae20..dc1fcb1 100644 --- a/miniprogram/mathPages/numberDecompose/numberDecompose.json +++ b/miniprogram/mathPages/numberDecompose/numberDecompose.json @@ -7,6 +7,7 @@ "usingComponents": { "share-guide-popup": "../../components/share-guide-popup/share-guide-popup", "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", - "math-type-selector": "../../components/math-type-selector/math-type-selector" + "math-type-selector": "../../components/math-type-selector/math-type-selector", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/numberDecompose/numberDecompose.wxml b/miniprogram/mathPages/numberDecompose/numberDecompose.wxml index 97844da..c68d1d3 100644 --- a/miniprogram/mathPages/numberDecompose/numberDecompose.wxml +++ b/miniprogram/mathPages/numberDecompose/numberDecompose.wxml @@ -18,7 +18,7 @@ type-actions="{{typeActions}}" bind:select="onSelectType" bind:random="onRandom" /> - + diff --git a/miniprogram/mathPages/numberFind/numberFind.json b/miniprogram/mathPages/numberFind/numberFind.json index 526bbaf..2351e3f 100644 --- a/miniprogram/mathPages/numberFind/numberFind.json +++ b/miniprogram/mathPages/numberFind/numberFind.json @@ -7,6 +7,7 @@ "usingComponents": { "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" + "math-bottom-buttons": "../../components/math-bottom-buttons/math-bottom-buttons", + "draw-ad": "../../components/draw-ad/draw-ad" } } diff --git a/miniprogram/mathPages/numberFind/numberFind.wxml b/miniprogram/mathPages/numberFind/numberFind.wxml index 7fa9bfe..953d3e7 100644 --- a/miniprogram/mathPages/numberFind/numberFind.wxml +++ b/miniprogram/mathPages/numberFind/numberFind.wxml @@ -68,7 +68,7 @@ - + diff --git a/miniprogram/service/baseDraw.ts b/miniprogram/service/baseDraw.ts index 76d4c91..b4867d3 100644 --- a/miniprogram/service/baseDraw.ts +++ b/miniprogram/service/baseDraw.ts @@ -368,6 +368,12 @@ export class BaseDrawService { /** * 绘制圆点 + * @param ctx 绘制上下文 + * @param x 圆点中心X坐标 + * @param y 圆点中心Y坐标 + * @param radius 圆点半径 + * @param fillColor 填充颜色,默认为 '#93D333' + * @param strokeColor 边线颜色,如果传入则绘制边线,宽度为1,默认不绘制 */ drawDot( ctx: RenderingContext, @@ -375,10 +381,20 @@ export class BaseDrawService { y: number, radius: number, fillColor?: string, + strokeColor?: string, ) { - ctx.fillStyle = fillColor ?? '#93D333'; ctx.beginPath(); ctx.arc(x, y, radius, 0, Math.PI * 2); + + // 绘制填充 + ctx.fillStyle = fillColor ?? '#93D333'; ctx.fill(); + + // 绘制边线(如果提供了边线颜色) + if (strokeColor) { + ctx.strokeStyle = strokeColor; + ctx.lineWidth = 1; + ctx.stroke(); + } } } diff --git a/project.private.config.json b/project.private.config.json index a222ea1..c74b149 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -23,12 +23,19 @@ "condition": { "miniprogram": { "list": [ + { + "name": "focusPages/codeConnect/codeConnect", + "pathName": "focusPages/codeConnect/codeConnect", + "query": "id=code-connect", + "scene": null, + "launchMode": "default" + }, { "name": "focusPages/gridReasoning/gridReasoning", "pathName": "focusPages/gridReasoning/gridReasoning", "query": "id=grid-reasoning", - "scene": null, - "launchMode": "default" + "launchMode": "default", + "scene": null }, { "name": "focusPages/lineRecognition/lineRecognition",