feat: 优化字帖功能
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { PAPER_SIZE } from '../constants/colors';
|
||||
import { checkAndSaveImage } from '../utils/saveImage';
|
||||
import { shouldShowShareGuide } from '../utils/shareGuide';
|
||||
import { downloadPrint } from '../utils/downloadPrint';
|
||||
import { BaseDrawService } from '../service/baseDraw';
|
||||
import tracker from '../utils/tracker';
|
||||
import { defaultShareConfig } from '../config/config';
|
||||
@@ -172,20 +171,12 @@ export function getPageCommonMethods(config: PageCommonMethodsConfig = {}) {
|
||||
/**
|
||||
* 导出打印
|
||||
*/
|
||||
exportToPrint(this: PageCanvasInstance) {
|
||||
if (!this.canvas || !this.data.hasContent) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shouldShowShareGuide()) {
|
||||
this.setData({ showShareDialog: true });
|
||||
return;
|
||||
}
|
||||
|
||||
// 上报下载埋点
|
||||
tracker.reportDownload(this.data.pageTitle, this.data.currentMode);
|
||||
|
||||
checkAndSaveImage(this.canvas);
|
||||
async exportToPrint(this: PageCanvasInstance) {
|
||||
await downloadPrint(this.canvas, {
|
||||
errorToast: '请先生成内容',
|
||||
trackerName: this.data.pageTitle,
|
||||
trackerMode: this.data.currentMode,
|
||||
});
|
||||
},
|
||||
|
||||
getShareOptions(this: PageCanvasInstance): ShareOptions {
|
||||
@@ -231,12 +222,15 @@ export function getPageCommonMethods(config: PageCommonMethodsConfig = {}) {
|
||||
/**
|
||||
* 分享成功回调
|
||||
*/
|
||||
onShareSuccess(this: PageCanvasInstance) {
|
||||
async onShareSuccess(this: PageCanvasInstance) {
|
||||
this.setData({ showShareDialog: false });
|
||||
if (this.canvas) {
|
||||
// 上报下载埋点(分享成功后下载)
|
||||
tracker.reportDownload(this.data.pageTitle);
|
||||
checkAndSaveImage(this.canvas);
|
||||
// 分享成功后下载(不限制次数)
|
||||
await downloadPrint(this.canvas, {
|
||||
errorToast: '请先生成内容',
|
||||
trackerName: this.data.pageTitle,
|
||||
trackerMode: this.data.currentMode,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user