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