feat:下载分享检查
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
"word-input": "/components/word-input/word-input",
|
||||
"word-card": "/components/word-card/word-card",
|
||||
"word-picker": "/components/word-picker/word-picker",
|
||||
"empty-state": "/components/empty-state/empty-state"
|
||||
"empty-state": "/components/empty-state/empty-state",
|
||||
"share-guide-popup": "/components/share-guide-popup/share-guide-popup"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import WordDrawService from '../../service/wordDrawService';
|
||||
import { checkAndSaveImage } from '../../utils/saveImage';
|
||||
import {
|
||||
shouldShowShareGuide,
|
||||
recordShareSuccess,
|
||||
} from '../../utils/shareGuide';
|
||||
import { shouldShowShareGuide } from '../../utils/shareGuide';
|
||||
import { PAPER_SIZE } from '../../constants/colors';
|
||||
import { getWordsSvgData } from '../../utils/getWordsSvgJson';
|
||||
import { WORDS } from '../../constants/words';
|
||||
@@ -347,6 +344,9 @@ Page({
|
||||
return characterData;
|
||||
},
|
||||
|
||||
/** 记录待下载状态(当需要分享引导时) */
|
||||
pendingDownload: false,
|
||||
|
||||
// 下载打印练字贴
|
||||
exportToPrint() {
|
||||
if (!this.canvas) {
|
||||
@@ -369,54 +369,27 @@ Page({
|
||||
this.setData({ showShareDialog: false });
|
||||
},
|
||||
|
||||
/** 点击转发按钮 */
|
||||
onShareToFriend() {
|
||||
// 记录分享成功(用户点击了分享按钮,视为已分享)
|
||||
recordShareSuccess();
|
||||
this.setData({ showShareDialog: false });
|
||||
// 允许继续下载
|
||||
if (this.canvas) {
|
||||
checkAndSaveImage(this.canvas);
|
||||
}
|
||||
wx.showToast({
|
||||
title: '分享后即可继续下载',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
});
|
||||
},
|
||||
|
||||
/** 点击分享到朋友圈按钮 */
|
||||
onShareToTimeline() {
|
||||
// 记录分享成功(用户点击了分享按钮,视为已分享)
|
||||
recordShareSuccess();
|
||||
this.setData({ showShareDialog: false });
|
||||
// 允许继续下载
|
||||
if (this.canvas) {
|
||||
checkAndSaveImage(this.canvas);
|
||||
}
|
||||
wx.showToast({
|
||||
title: '分享后即可继续下载',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
});
|
||||
},
|
||||
|
||||
// 分享功能
|
||||
onShareAppMessage() {
|
||||
// 记录分享成功(用户真正分享了)
|
||||
recordShareSuccess();
|
||||
return {
|
||||
title: '涂鸦丫-练字|识字|打印',
|
||||
path: '/pages/copyBook/index',
|
||||
title: '涂鸦丫-涂色|练字|识字|打印',
|
||||
path: '/pages/copyBook/copyBook',
|
||||
imageUrl:
|
||||
'https://cdn.joeyone.cn/doodle/share-img/index-share-v2.png',
|
||||
};
|
||||
},
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '涂鸦丫-涂色|练字|识字|打印',
|
||||
query: '/pages/copyBook/copyBook',
|
||||
imageUrl:
|
||||
'https://cdn.joeyone.cn/doodle/share-img/index-share-v2.png',
|
||||
};
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
// 记录分享成功(用户真正分享了)
|
||||
recordShareSuccess();
|
||||
return {
|
||||
title: '涂鸦丫-练字|识字|打印',
|
||||
query: '/pages/copyBook/index',
|
||||
};
|
||||
/** 分享成功回调(由组件触发) */
|
||||
onShareSuccess() {
|
||||
// 只关闭弹窗,不触发下载
|
||||
this.setData({ showShareDialog: false });
|
||||
},
|
||||
});
|
||||
|
||||
@@ -91,16 +91,10 @@
|
||||
max="11"
|
||||
bind:onClose="closeSelectWordPopup"
|
||||
bind:onChange="onChangeWord" />
|
||||
<van-dialog
|
||||
<share-guide-popup
|
||||
show="{{showShareDialog}}"
|
||||
title="分享解锁下载"
|
||||
message="今日免费下载次数已用完,分享给好友或朋友圈后即可继续免费下载"
|
||||
show-cancel-button
|
||||
confirm-button-text="转发给好友"
|
||||
cancel-button-text="分享到朋友圈"
|
||||
bind:confirm="onShareToFriend"
|
||||
bind:cancel="onShareToTimeline"
|
||||
bind:close="onCloseShareDialog" />
|
||||
bind:onClose="onCloseShareDialog"
|
||||
bind:onShareSuccess="onShareSuccess" />
|
||||
|
||||
<view class="empty"></view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user