dever 4 years ago
parent
commit
7a9e9b8ff8
1 changed files with 23 additions and 20 deletions
  1. 23 20
      pages/dream/func/share.vue

+ 23 - 20
pages/dream/func/share.vue

@@ -339,27 +339,30 @@ export default {
 		drawPoster : function(ctx, resolve, reject) {
 			ctx.draw(true, () => {
 				// canvas画布转成图片并返回图片地址
-				uni.canvasToTempFilePath({
-					canvasId: 'poster',
-					width: 375,
-					height: 673,
-					quality : 1,
-					success: (res) => {
-						/*
-						if (res.tempFilePath.indexOf('base64')) {
-							base64ToPath(res.tempFilePath).then(path => {
-								this.finish(path, resolve);
-							});
-						} else {
+				setTimeout(()=>{
+					uni.canvasToTempFilePath({
+						canvasId: 'poster',
+						destWidth: 375,
+						destHeight: 673,
+						quality : 1,
+						fileType : 'jpg',
+						success: (res) => {
+							/*
+							if (res.tempFilePath.indexOf('base64')) {
+								base64ToPath(res.tempFilePath).then(path => {
+									this.finish(path, resolve);
+								});
+							} else {
+								this.finish(res.tempFilePath, resolve);
+							}*/
 							this.finish(res.tempFilePath, resolve);
-						}*/
-						this.finish(res.tempFilePath, resolve);
-					},
-					fail: () => {
-						uni.hideLoading();
-						reject();
-					}
-				})
+						},
+						fail: () => {
+							uni.hideLoading();
+							reject();
+						}
+					})
+				}, 500);
 			});
 		},