From 51650db04ee89bcf962db369830845852ad9814b Mon Sep 17 00:00:00 2001 From: R524809 Date: Wed, 20 May 2026 16:51:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=8B=E8=BD=BD=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E9=99=90=E5=88=B6=EF=BC=8C=E5=85=8D=E8=B4=B9=E9=A2=9D=E5=BA=A6?= =?UTF-8?q?=E7=94=A8=E5=AE=8C=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=88=86=E4=BA=AB=EF=BC=8C=E4=B9=8B=E5=90=8E=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E7=9C=8B=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/base/pageMixin.ts | 27 ++- .../handwritingSheet/handwritingSheet.ts | 16 -- .../share-guide-popup/share-guide-popup.less | 5 + .../share-guide-popup/share-guide-popup.ts | 14 +- .../share-guide-popup/share-guide-popup.wxml | 8 +- miniprogram/config/config.ts | 14 ++ miniprogram/focusPages/shape/shape.ts | 27 ++- miniprogram/utils/downloadPrint.ts | 225 ++++++------------ miniprogram/utils/shareGuide.ts | 171 ++++++++++--- 9 files changed, 282 insertions(+), 225 deletions(-) diff --git a/miniprogram/base/pageMixin.ts b/miniprogram/base/pageMixin.ts index 90007b2..a7b1785 100644 --- a/miniprogram/base/pageMixin.ts +++ b/miniprogram/base/pageMixin.ts @@ -1,5 +1,9 @@ import { PAPER_SIZE } from '../constants/colors'; -import { downloadPrint } from '../utils/downloadPrint'; +import { downloadPrint, tryUnlockWithRewardedAd } from '../utils/downloadPrint'; +import { + shouldShowShareGuide, + shouldUnlockWithAd, +} from '../utils/shareGuide'; import { BaseDrawService } from '../core/draw/baseDraw'; import tracker from '../utils/tracker'; import { defaultShareConfig } from '../config/config'; @@ -230,12 +234,28 @@ export function getPageCommonMethods(config: PageCommonMethodsConfig = {}) { typeof this.getWorksheetStatsId === 'function' ? this.getWorksheetStatsId() : this.data.functionId; - await downloadPrint(this.canvas, { + const downloadOptions = { errorToast: '请先生成内容', trackerName: this.data.pageTitle, trackerMode: this.data.currentMode, worksheetId, - }); + }; + + // 第 2 次及以后满批:直接拉激励广告 + if (shouldUnlockWithAd()) { + const unlocked = await tryUnlockWithRewardedAd(); + if (!unlocked) { + return; + } + } + + // 当日首次满批:仅分享解锁,弹窗引导 + if (shouldShowShareGuide()) { + this.setData({ showShareDialog: true }); + return; + } + + await downloadPrint(this.canvas, downloadOptions); }, getShareOptions(this: PageCanvasInstance): ShareOptions { @@ -288,7 +308,6 @@ export function getPageCommonMethods(config: PageCommonMethodsConfig = {}) { typeof this.getWorksheetStatsId === 'function' ? this.getWorksheetStatsId() : this.data.functionId; - // 分享成功后下载(不限制次数) await downloadPrint(this.canvas, { errorToast: '请先生成内容', trackerName: this.data.pageTitle, diff --git a/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts b/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts index 4563220..93d16f9 100644 --- a/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts +++ b/miniprogram/chinesePages/handwritingSheet/handwritingSheet.ts @@ -1,5 +1,4 @@ import WordDrawService from './draw/wordDrawService'; -import { downloadPrint } from '../../utils/downloadPrint'; import { getWordsSvgData } from '../../utils/getWordsSvgJson'; import { WORDS } from '../../core/data/words'; import { CharacterItem } from '../../types/characterType'; @@ -396,13 +395,6 @@ createPage( return characterData; }, - async exportToPrint() { - await downloadPrint(this.canvas, { - errorToast: '请先生成练字贴', - trackerName: '练字贴', - }); - }, - onShare() {}, onShareAppMessage() { @@ -421,14 +413,6 @@ createPage( }; }, - onCloseShareDialog() { - this.setData({ showShareDialog: false }); - }, - - onShareSuccess() { - this.setData({ showShareDialog: false }); - }, - getPublishMeta(): DebugPublishMeta { const meta = getPublishMetaByMode(HANDWRITING_SHEET_WORKSHEET_ID); if (!meta) { diff --git a/miniprogram/components/share-guide-popup/share-guide-popup.less b/miniprogram/components/share-guide-popup/share-guide-popup.less index a5b2c3c..d07013e 100644 --- a/miniprogram/components/share-guide-popup/share-guide-popup.less +++ b/miniprogram/components/share-guide-popup/share-guide-popup.less @@ -55,5 +55,10 @@ background: linear-gradient(135deg, #07c160 0%, #06ad56 100%); color: #ffffff; } + + &--secondary { + background: #f5f5f5; + color: #323233; + } } } \ No newline at end of file diff --git a/miniprogram/components/share-guide-popup/share-guide-popup.ts b/miniprogram/components/share-guide-popup/share-guide-popup.ts index 934bb76..35bbe01 100644 --- a/miniprogram/components/share-guide-popup/share-guide-popup.ts +++ b/miniprogram/components/share-guide-popup/share-guide-popup.ts @@ -1,4 +1,9 @@ -import { recordShareSuccess } from '../../utils/shareGuide'; +import { + getShareGuidePopupCopy, + recordShareSuccess, +} from '../../utils/shareGuide'; + +const popupCopy = getShareGuidePopupCopy(); Component({ options: {}, @@ -14,7 +19,10 @@ Component({ /** * 组件的初始数据 */ - data: {}, + data: { + unlockMessage: popupCopy.message, + unlockHint: popupCopy.hint, + }, /** * 组件的方法列表 */ @@ -31,9 +39,7 @@ Component({ /** 点击分享按钮 */ onShare() { - // 记录分享成功(用户点击了分享按钮,视为已分享) recordShareSuccess(); - // 关闭弹窗并通知父组件分享成功(不触发下载,用户需要重新点击下载按钮) this.triggerEvent('onShareSuccess'); }, }, diff --git a/miniprogram/components/share-guide-popup/share-guide-popup.wxml b/miniprogram/components/share-guide-popup/share-guide-popup.wxml index 004a1cd..2b3a7d9 100644 --- a/miniprogram/components/share-guide-popup/share-guide-popup.wxml +++ b/miniprogram/components/share-guide-popup/share-guide-popup.wxml @@ -8,11 +8,9 @@ bind:click-overlay="onOverlayClick" custom-class="share-guide-popup"> - - - + + +