|
@@ -103,12 +103,9 @@ export default {
|
|
|
clearTimeout(this._time)
|
|
|
},
|
|
|
async saveImg() {
|
|
|
- this.$toast.loading({
|
|
|
- message: "图片生成中...",
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
setTimeout(() => {
|
|
|
this.saveLoading = false;
|
|
|
+ this.$toast.clear();
|
|
|
}, 100);
|
|
|
postMessage(
|
|
|
{
|
|
@@ -165,33 +162,33 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.saveLoading = true;
|
|
|
- // 判断是否已经生成图片
|
|
|
- if (this.image) {
|
|
|
- if (type) {
|
|
|
- this.onSaveWe(type);
|
|
|
- } else {
|
|
|
+ if(type){
|
|
|
+ this.onSaveWe(type);
|
|
|
+ }else{
|
|
|
+ this.$toast.loading({
|
|
|
+ forbidClick: true,
|
|
|
+ message: "下载中",
|
|
|
+ duration:0
|
|
|
+ });
|
|
|
+ if (this.image) {
|
|
|
this.saveImg();
|
|
|
- }
|
|
|
- } else {
|
|
|
- const container = document.getElementById("shareContent");
|
|
|
- html2canvas(container, {
|
|
|
- allowTaint: true,
|
|
|
- useCORS: true,
|
|
|
- backgroundColor: null,
|
|
|
- })
|
|
|
- .then(async (canvas) => {
|
|
|
- const url = canvas.toDataURL("image/png");
|
|
|
- this.image = url;
|
|
|
- if (type) {
|
|
|
- this.onSaveWe(type);
|
|
|
- } else {
|
|
|
- this.saveImg();
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ const container = document.getElementById("shareContent");
|
|
|
+ html2canvas(container, {
|
|
|
+ allowTaint: true,
|
|
|
+ useCORS: true,
|
|
|
+ backgroundColor: null,
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- this.toast.clear();
|
|
|
- this.saveLoading = false;
|
|
|
- });
|
|
|
+ .then(async (canvas) => {
|
|
|
+ const url = canvas.toDataURL("image/png");
|
|
|
+ this.image = url;
|
|
|
+ this.saveImg();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$toast.clear();
|
|
|
+ this.saveLoading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
copyText(text) {
|