Explorar o código

预览图片生成

曹冬冬 %!s(int64=5) %!d(string=hai) anos
pai
achega
c29d3d458f
Modificáronse 1 ficheiros con 24 adicións e 22 borrados
  1. 24 22
      src/views/h5editor/index.vue

+ 24 - 22
src/views/h5editor/index.vue

@@ -739,28 +739,29 @@
                     spinner: "el-icon-loading",
                     background: "rgba(0, 0, 0, 0.7)"
                 });
-                if (!hasSaveFlag) {
-                    $(".animated").css("animation-name", "null");
-                    $(".animated>div").css("animation-name", "null");
-                    $(".animated span").css({
-                        animationDelay: "0s",
-                        animationDuration: "0s"
-                    });
-                    await html2canvas(document.querySelector("#canvasPage"), {
-                        useCORS: true,
-                        scale: 0.5,
-                        height: 1334,
-                        logging: false //日志开关,便于查看html2canvas的内部执行流程
-                    }).then(async canvas => {
-                        var result = await uploadBase64({base64Str: canvas.toDataURL()});
-                        if (result.data.success) {
-                            this.$store.state.editor.editorTheme.cover =
-                                result.data.single.filePath;
-                        } else {
-                            this.$message.error("封面图片上传失败!");
-                        }
-                    });
-                }
+
+                $(".animated").css("animation-name", "null");
+                $(".animated>div").css("animation-name", "null");
+                $(".animated span").css({
+                    animationDelay: "0s",
+                    animationDuration: "0s"
+                });
+                await html2canvas(document.querySelector("#canvasPage"), {
+                    useCORS: true,
+                    scale: 0.5,
+                    height: 1334,
+                    logging: false //日志开关,便于查看html2canvas的内部执行流程
+                }).then(async canvas => {
+                    var result = await uploadBase64({base64Str: canvas.toDataURL()});
+                    if (result.data.success) {
+                        this.$store.state.editor.editorTheme.cover =
+                            result.data.single.filePath;
+                            console.log("封面地址",result.data.single.filePath);
+                    } else {
+                        this.$message.error("封面图片上传失败!");
+                    }
+                });
+
                 this.$store.state.editor.editorTheme.bgc = this.bgc;
                 this.$store.state.editor.editorTheme.btnColor = this.btnColor;
                 this.$store.state.editor.editorTheme.bodyBackgroundColor =
@@ -795,6 +796,7 @@
                 console.log("子组件结果页的值:", chil.resultPageCount);
                 let param = {
                     id: this.itemId,
+                    coverImg: this.$store.state.editor.editorTheme.cover,
                     jsonString: JSON.stringify(this.$store.state.editor.editorTheme),
                     resultPageCount: chil.resultPageCount,
                     updator: "admin"