修复导出bug
This commit is contained in:
@@ -277,7 +277,6 @@
|
||||
<div>all</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="SRExport_img">
|
||||
<div class="SRExport_img_item_box" v-for="item in allExportSR" @click="selectImg(item)">
|
||||
<input type="checkbox" v-model="item.checked">
|
||||
@@ -310,6 +309,7 @@ import { exportSele,JSRectUpdata,JSchangeType,JScanvasMouseDown,JScanvasMouseMov
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {isMoible,calculateGradientCoordinate,base64ToFile} from '@/tool/util'
|
||||
import publish from "@/component/WorksPage/publish.vue";
|
||||
import { connect } from "echarts";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -326,7 +326,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
let showUpgradePlan = ref(false);
|
||||
let canvas = reactive({});
|
||||
let canvas = ref({});
|
||||
// let canvasDom = ref()
|
||||
let canvasWH = ref({
|
||||
width: 400,
|
||||
@@ -363,11 +363,11 @@ export default defineComponent({
|
||||
let isLoadCanvas = false//撤回或者反撤回false为撤回
|
||||
let userlikeGroupId = 0
|
||||
let init = (productData) => {
|
||||
showUpgradePlan.value = true;
|
||||
userlikeGroupId = productData.userlikeGroupId
|
||||
canvasWH.value.height = 100
|
||||
normalCanvasState.value = []
|
||||
reverseCanvasState.value = []
|
||||
showUpgradePlan.value = true;
|
||||
allBoardData.value.likeDesignCollectionList =
|
||||
likeDesignCollectionList;
|
||||
allBoardData.value[productData.key] = productData.imgList;
|
||||
@@ -470,6 +470,7 @@ export default defineComponent({
|
||||
//循环渲染顺序
|
||||
|
||||
let imgWidth = setImageWidth(key); //这是设置画布等宽
|
||||
// alert(imgWidth)
|
||||
let sketchGroupingItem = [];
|
||||
if (
|
||||
item == "moodboardFiles" &&
|
||||
@@ -501,6 +502,8 @@ export default defineComponent({
|
||||
allItem.designOutfitUrl;
|
||||
}
|
||||
fabric.Image.fromURL(itemCanvasImg,(img) => {
|
||||
img.on('added', () => {
|
||||
img.set({ crossOrigin: 'anonymous' });
|
||||
let scaleWH = imgWidth / img.width; //计算放到画布上缩小倍率
|
||||
if(key == "sketchboardFiles"){
|
||||
if(allItemIndex == 0){
|
||||
@@ -551,12 +554,14 @@ export default defineComponent({
|
||||
}else{
|
||||
position.x += img.width * scaleWH + margin;
|
||||
}
|
||||
let str = `${img.width} + ${scaleWH}`
|
||||
img.lock_rotation = true;
|
||||
canvas.add(img);
|
||||
oldKey = key;
|
||||
// setTimeout(() => {
|
||||
resolve()
|
||||
// }, 1000);
|
||||
})
|
||||
|
||||
canvas.add(img);
|
||||
|
||||
},{ crossOrigin: "Anonymous" });
|
||||
}
|
||||
});
|
||||
@@ -793,6 +798,7 @@ export default defineComponent({
|
||||
let xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.open("GET", url, true);
|
||||
xmlhttp.responseType = "blob";
|
||||
xmlhttp.withCredentials = false;
|
||||
xmlhttp.onload = function () {
|
||||
if (this.status == 200) {
|
||||
resolve(this.response);
|
||||
@@ -812,15 +818,27 @@ export default defineComponent({
|
||||
// 下载文件, 并存成ArrayBuffer对象(blob)
|
||||
zip.file(item.name, data, { binary: true }); // 逐个添加文件
|
||||
cache[item.title] = data;
|
||||
});
|
||||
})
|
||||
promises.push(promise);
|
||||
}
|
||||
Promise.all(promises)
|
||||
.then(() => {
|
||||
function downloadBlob(blob, filename) {
|
||||
const link = document.createElement('a');
|
||||
const url = URL.createObjectURL(blob);
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then((content) => {
|
||||
// 生成二进制流
|
||||
FileSaver.saveAs(content, "DesignFiles"); // 利用file-saver保存文件 自定义文件名
|
||||
downloadBlob(content,'DesignFiles')
|
||||
// FileSaver.saveAs(content, "DesignFiles"); // 利用file-saver保存文件 自定义文件名
|
||||
isShowMark.value = false;
|
||||
|
||||
});
|
||||
setSubmit()//导出的时候保存
|
||||
initAligningGuidelines(canvas,true)
|
||||
|
||||
Reference in New Issue
Block a user