feat:架构代码优化

This commit is contained in:
R524809
2025-12-11 13:02:44 +08:00
parent 2c32235568
commit 3c0e2af10d
89 changed files with 2774 additions and 2816 deletions
+1 -1
View File
@@ -7,6 +7,6 @@
"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": "../shared/components/math-bottom-buttons/math-bottom-buttons"
}
}
+1 -1
View File
@@ -1 +1 @@
@import '../common/mathPage.less';
@import '../shared/common/mathPage.less';
+10 -18
View File
@@ -1,15 +1,12 @@
import CompareDraw from '../service/compareDraw';
import CompareDraw from '../shared/service/compareDraw';
import {
getMathPageCommonMethods,
createMathPage,
CanvasDataState,
} from '../common/mathPageMixin';
} from '../shared/common/mathPageMixin';
// 获取公共方
const commonMethods = getMathPageCommonMethods({
pagePath: 'compare/compare',
});
// 获取公共方
Page({
createMathPage({
canvas: null as Canvas | null,
ctx: null as RenderingContext | null,
boxHeight: 0,
@@ -40,7 +37,11 @@ Page({
onReady() {
this.initCanvas({
createDrawService: (canvas, ctx, options) => {
createDrawService: (
canvas: Canvas,
ctx: RenderingContext,
options?: Record<string, any>,
) => {
return new CompareDraw(canvas, ctx, options);
},
drawServiceOptions: {
@@ -120,13 +121,4 @@ Page({
this.compareData = { problems };
},
// ========== 使用公共方法 ==========
initCanvas: commonMethods.initCanvas,
exportToPrint: commonMethods.exportToPrint,
onShareAppMessage: commonMethods.onShareAppMessage,
onShareTimeline: commonMethods.onShareTimeline,
onCloseShareDialog: commonMethods.onCloseShareDialog,
onShareSuccess: commonMethods.onShareSuccess,
initPageInfo: commonMethods.initPageInfo,
});