|
@@ -63,50 +63,50 @@ Page({
|
|
|
pic.src = video.coverImg; //可以是本地,也可以是网络图片
|
|
|
pic.onload = () => {
|
|
|
ctx.drawImage(pic, 0, 0, 375, 211);
|
|
|
- }
|
|
|
- let peiyin = canvas.createImage();
|
|
|
- peiyin.src = '/static/peiyin.jpg';
|
|
|
- peiyin.onload = () => {
|
|
|
- ctx.drawImage(peiyin, 0, 211, 375, 89);
|
|
|
- //分享
|
|
|
- let fx = canvas.createImage();
|
|
|
- fx.src = '/static/share.png'
|
|
|
- fx.onload = () => {
|
|
|
- ctx.drawImage(fx, 12, 220, 20, 20)
|
|
|
- ctx.fillText('分享', 36, 238)
|
|
|
- // 收藏,一个一个渲染
|
|
|
- let sc = canvas.createImage();
|
|
|
- sc.src = '/static/no_collect.png'
|
|
|
- sc.onload = () => {
|
|
|
- ctx.drawImage(sc, 110, 220, 19, 19)
|
|
|
- ctx.fillText('收藏', 134, 238)
|
|
|
- //点赞
|
|
|
- let dz = canvas.createImage();
|
|
|
- dz.src = '/static/heart.png'
|
|
|
- dz.onload = () => {
|
|
|
- ctx.drawImage(dz, 228, 222, 22, 22)
|
|
|
- ctx.fillText(0, 254, 238)
|
|
|
- // 评论
|
|
|
- let pl = canvas.createImage();
|
|
|
- pl.src = '/static/comment.png'
|
|
|
- pl.onload = () => {
|
|
|
- ctx.drawImage(pl, 318, 222, 22, 22)
|
|
|
- ctx.fillText( 0, 340, 238)
|
|
|
- setTimeout(() => {
|
|
|
- wx.canvasToTempFilePath({
|
|
|
- canvas: canvas,
|
|
|
- success(res) {
|
|
|
- resolve({
|
|
|
- title: '请欣赏我的课文朗读作品,点赞+评论。',
|
|
|
- path: `/pages/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
|
|
|
- imageUrl: res.tempFilePath
|
|
|
- })
|
|
|
- },
|
|
|
- fail(res) {
|
|
|
- reject()
|
|
|
- }
|
|
|
- }, this)
|
|
|
- }, 500)
|
|
|
+ let peiyin = canvas.createImage();
|
|
|
+ peiyin.src = '/static/peiyin.jpg';
|
|
|
+ peiyin.onload = () => {
|
|
|
+ ctx.drawImage(peiyin, 0, 211, 375, 89);
|
|
|
+ //分享
|
|
|
+ let fx = canvas.createImage();
|
|
|
+ fx.src = '/static/share.png'
|
|
|
+ fx.onload = () => {
|
|
|
+ ctx.drawImage(fx, 12, 220, 20, 20)
|
|
|
+ ctx.fillText('分享', 36, 238)
|
|
|
+ // 收藏,一个一个渲染
|
|
|
+ let sc = canvas.createImage();
|
|
|
+ sc.src = '/static/no_collect.png'
|
|
|
+ sc.onload = () => {
|
|
|
+ ctx.drawImage(sc, 110, 220, 19, 19)
|
|
|
+ ctx.fillText('收藏', 134, 238)
|
|
|
+ //点赞
|
|
|
+ let dz = canvas.createImage();
|
|
|
+ dz.src = '/static/heart.png'
|
|
|
+ dz.onload = () => {
|
|
|
+ ctx.drawImage(dz, 228, 222, 22, 22)
|
|
|
+ ctx.fillText(0, 254, 238)
|
|
|
+ // 评论
|
|
|
+ let pl = canvas.createImage();
|
|
|
+ pl.src = '/static/comment.png'
|
|
|
+ pl.onload = () => {
|
|
|
+ ctx.drawImage(pl, 318, 222, 22, 22)
|
|
|
+ ctx.fillText(0, 340, 238)
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.canvasToTempFilePath({
|
|
|
+ canvas: canvas,
|
|
|
+ success(res) {
|
|
|
+ resolve({
|
|
|
+ title: '请欣赏我的课文朗读作品,点赞+评论。',
|
|
|
+ path: `/pages/index?readId=${video.id}&uid=${wx.getStorageSync('uid')}`,
|
|
|
+ imageUrl: res.tempFilePath
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail(res) {
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ }, this)
|
|
|
+ }, 500)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|