|
@@ -30,39 +30,15 @@ module.exports = Behavior({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 大佬,我又来了,wx.miniapp.shareMiniProgramMessage支持fail打印报错,但是不支持promise,onShareAppMessage支持promise,但是不抛出报错,不好调试
|
|
|
- //
|
|
|
// #elif ANDROID
|
|
|
onShareAppMessage({
|
|
|
from,
|
|
|
target
|
|
|
}) {
|
|
|
- /* wx.miniapp.shareMiniProgramMessage({
|
|
|
- title: '这个小程序太赞了!孩子朗读能力蹭蹭上涨,推荐你试试!',
|
|
|
- userName: 'gh_50f61361ad1d',
|
|
|
- path: 'pages/index/index',
|
|
|
- imagePath: '/static/uploadTips.png',
|
|
|
- webpageUrl: 'http://www.efunbox.cn',
|
|
|
- withShareTicket: true,
|
|
|
- miniprogramType: 1,
|
|
|
- scene: 0,
|
|
|
- success(res) {
|
|
|
- wx.showToast({
|
|
|
- title: '成功:分享小程序',
|
|
|
- })
|
|
|
- console.log(res)
|
|
|
- },
|
|
|
- fail() {
|
|
|
- wx.showToast({
|
|
|
- title: '失败:分享小程序',
|
|
|
- })
|
|
|
- }
|
|
|
- }) */
|
|
|
if (from == 'button') {
|
|
|
let video = target.dataset.info
|
|
|
const promise = new Promise(resolve => {
|
|
|
this.creatShare(video).then(res => {
|
|
|
- console.log(res, 'rrr');
|
|
|
resolve(res)
|
|
|
})
|
|
|
})
|
|
@@ -94,24 +70,25 @@ module.exports = Behavior({
|
|
|
}).exec((res) => {
|
|
|
const canvas = res[0].node;
|
|
|
const ctx = canvas.getContext('2d');
|
|
|
- // const dpr = wx.getSystemInfoSync().pixelRatio;
|
|
|
- canvas.width = 300;
|
|
|
- canvas.height = 240;
|
|
|
+ const dpr = 0.84
|
|
|
+ canvas.width = res[0].width * dpr;
|
|
|
+ canvas.height = res[0].height * dpr;
|
|
|
+ ctx.scale(dpr, dpr);
|
|
|
ctx.font = '14px PingFang';
|
|
|
let pic = canvas.createImage();
|
|
|
pic.src = video.userReadExtend && video.userReadExtend.resourcesType == 1 ? video.userReadExtend.backgroundVirtualImg : video.userRead.coverImg;
|
|
|
pic.onload = () => {
|
|
|
- ctx.drawImage(pic, 0, 0, 300, 169);
|
|
|
+ ctx.drawImage(pic, 0, 0, 375, 211);
|
|
|
let peiyin = canvas.createImage();
|
|
|
peiyin.src = '/static/peiyin.jpg';
|
|
|
peiyin.onload = () => {
|
|
|
- ctx.drawImage(peiyin, 0, 169, 300, 71.2);
|
|
|
+ ctx.drawImage(peiyin, 0, 211, 375, 89);
|
|
|
//分享
|
|
|
let fx = canvas.createImage();
|
|
|
fx.src = '/static/share.png'
|
|
|
fx.onload = () => {
|
|
|
- ctx.drawImage(fx, 9.6, 176, 16, 16)
|
|
|
- ctx.fillText('分享', 28.8, 190)
|
|
|
+ ctx.drawImage(fx, 12, 220, 20, 20)
|
|
|
+ ctx.fillText('分享', 36, 238)
|
|
|
// 收藏,一个一个渲染
|
|
|
let sc = canvas.createImage();
|
|
|
sc.src = '/static/no_collect.png'
|
|
@@ -172,15 +149,6 @@ module.exports = Behavior({
|
|
|
imageUrl: res.tempFilePath
|
|
|
})
|
|
|
// #elif ANDROID
|
|
|
- wx.saveImageToPhotosAlbum({
|
|
|
- filePath: res.tempFilePath,
|
|
|
- success() {
|
|
|
- wx.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
resolve({
|
|
|
title,
|
|
|
userName: 'gh_50f61361ad1d',
|