Commit c9ade2d6 authored by zhijie.xue's avatar zhijie.xue

修复ios15生成海报问题

parent f3238a0a
...@@ -201,9 +201,13 @@ export default { ...@@ -201,9 +201,13 @@ export default {
useCORS: true, useCORS: true,
scale: 1, scale: 1,
allowTaint: false allowTaint: false
}).then(canvas => { })
.then(canvas => {
canvas.name = `${this.randomString()}.jpeg`; canvas.name = `${this.randomString()}.jpeg`;
canvas.toBlob(blob => this.uploadPic(blob), 'image/jpeg', 0.85); canvas.toBlob(blob => this.uploadPic(blob), 'image/jpeg', 0.85);
})
.catch(error => {
this.errorHandler(error);
}); });
}); });
}, },
...@@ -213,13 +217,13 @@ export default { ...@@ -213,13 +217,13 @@ export default {
const [res] = await qiNiuApi.getQiniuToken(); const [res] = await qiNiuApi.getQiniuToken();
const token = (res && res.token) || ''; const token = (res && res.token) || '';
if (!token) { if (!token) {
this.uploadErrorHandler(new Error('七牛token无效')); this.errorHandler(new Error('七牛token无效'));
return; return;
} }
upload(blob, null, token).subscribe({ upload(blob, null, token).subscribe({
complete: this.uploadSuccess, complete: this.uploadSuccess,
error: this.uploadError error: this.errorHandler
}); });
}, },
uploadSuccess({ hash }) { uploadSuccess({ hash }) {
...@@ -228,8 +232,8 @@ export default { ...@@ -228,8 +232,8 @@ export default {
this.$store.dispatch('change_loading_pic', false); this.$store.dispatch('change_loading_pic', false);
this.$emit('outputPicUrl', fileLink); this.$emit('outputPicUrl', fileLink);
}, },
uploadError(err) { errorHandler(err) {
console.error('海报上传失败', err); console.error('海报创建失败', err);
this.$store.dispatch('change_loading_pic', false); this.$store.dispatch('change_loading_pic', false);
} }
} }
...@@ -258,6 +262,9 @@ body { ...@@ -258,6 +262,9 @@ body {
top: -9999px; top: -9999px;
left: -9999px; left: -9999px;
color: #333; color: #333;
// ios15字体有bug,需要在根元素覆盖下
font-family: Helvetica, Tahoma, Arial, 'PingFang SC', 'Hiragino Sans GB', 'Heiti SC', STXihei,
'Microsoft YaHei', SimHei;
} }
.groupInfo { .groupInfo {
background: #fff; background: #fff;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment