Commit 54b08c25 by zhuzhequan

代码整理,方法封装,提交时重新计算坐标宽高

parent 686120f5
{
"apiApiHost":"https://factory.jomalls.com/api",
"fileApiUrl":"https://factory.jomalls.com/upload/factory",
"apiApiHost":"http://10.168.31.142:8060/api",
"fileApiUrl":"http://10.168.31.142:80/upload/factory",
"visionUrl":"https://console.jomalls.com"
}
{
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "nodemon --watch src/server --exec vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./src/assets/logo.jpg --output=build --flatten"
},
"main": "background.js",
"dependencies": {
"@minogin/vue-drag-resize-rotate": "^1.0.5",
"@vue/composition-api": "^0.3.4",
"axios": "^0.19.2",
"compressing": "^1.10.1",
"core-js": "^3.6.4",
"electron": "^6.1.1",
"electron-builder": "^24.13.3",
"electron-icon-builder": "^2.0.1",
"electron-log": "^5.1.7",
"electron-store": "^4.0.0",
"electron-updater": "^6.2.1",
"element-ui": "^2.13.0",
"express": "^4.17.1",
"html2canvas": "^1.4.1",
"lodash-id": "^0.14.0",
"log4js": "^6.9.1",
"moment": "^2.30.1",
"morgan": "^1.10.0",
"multiparty": "^4.2.3",
"nodemon": "^3.1.4",
"normalize.css": "^8.0.1",
"vue": "^2.6.11",
"vue-draggable-resizable": "^3.0.0",
"vue-i18n": "^8.16.0",
"vue-moveable": "^2.0.0-beta.75",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-router": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.1.2",
"less": "^3.5.0",
"less-loader": "^7.3.0",
"prettier": "^1.19.1",
"pug": "^2.0.4",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"vue-cli-plugin-electron-builder": "^1.4.6",
"vue-template-compiler": "^2.6.11"
}
}
{
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "nodemon --watch src/server --exec vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./src/assets/logo.jpg --output=build --flatten"
},
"main": "background.js",
"dependencies": {
"@minogin/vue-drag-resize-rotate": "^1.0.5",
"@vue/composition-api": "^0.3.4",
"axios": "^0.19.2",
"compressing": "^1.10.1",
"core-js": "^3.6.4",
"electron": "^6.1.1",
"electron-builder": "^24.13.3",
"electron-icon-builder": "^2.0.1",
"electron-log": "^5.1.7",
"electron-store": "^4.0.0",
"electron-updater": "^6.2.1",
"element-ui": "^2.13.0",
"express": "^4.17.1",
"html2canvas": "^1.4.1",
"lodash-id": "^0.14.0",
"log4js": "^6.9.1",
"moment": "^2.30.1",
"morgan": "^1.10.0",
"multiparty": "^4.2.3",
"nodemon": "^3.1.4",
"normalize.css": "^8.0.1",
"vue": "^2.6.11",
"vue-draggable-resizable": "^3.0.0",
"vue-i18n": "^8.16.0",
"vue-moveable": "^2.0.0-beta.75",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-router": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.1.2",
"less": "^3.5.0",
"less-loader": "^7.3.0",
"prettier": "^1.19.1",
"pug": "^2.0.4",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"vue-cli-plugin-electron-builder": "^1.4.6",
"vue-template-compiler": "^2.6.11"
}
}
......@@ -93,7 +93,7 @@ export default {
const q = req.body;
try {
let { data } = await axios.get(
`${env}/factory/podJomallOrderProduct/getSubOrderBySubOrderNumber`,
`${env}/factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber`,
{
params: q,
headers: { "jwt-token": token }
......
import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const defaultSetting = {
gridShow: 1,
language: "cn",
gridValue: 1,
autoPrint: false,
gridSpacing: "10mm"
};
export default new Vuex.Store({
state: {
actionList: [],
imgList: [],
actionIndex: -1,
systemSetting: {
gridShow: 1,
gridValue: 1,
unit: "mm",
language: "cn",
autoPrint: false,
gridSpacing: 10
}
},
mutations: {
setDefaultSetting(state) {
state.systemSetting = JSON.parse(JSON.stringify(defaultSetting));
},
updateSystemSetting(state, f) {
state.systemSetting[f.field] = f.value;
},
changeActionList(state, value) {
state.actionList = value;
},
changeActionIndex(state, value) {
state.actionIndex = value;
},
changeImgList(state, value) {
state.imgList = value;
}
},
getters: {
systemSetting(state) {
return state.systemSetting;
},
getActionList(state) {
return state.actionList;
},
getActionIndex: (state) => state.actionIndex,
imgList: (state) => state.imgList
},
actions: {},
modules: {}
});
import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const defaultSetting = {
gridShow: 1,
language: "cn",
gridValue: 1,
autoPrint: false,
gridSpacing: "10mm"
};
export default new Vuex.Store({
state: {
actionList: [],
imgList: [],
actionIndex: -1,
systemSetting: {
gridShow: 1,
gridValue: 1,
unit: "mm",
language: "cn",
autoPrint: false,
gridSpacing: 10
}
},
mutations: {
setDefaultSetting(state) {
state.systemSetting = JSON.parse(JSON.stringify(defaultSetting));
},
updateSystemSetting(state, f) {
state.systemSetting[f.field] = f.value;
},
changeActionList(state, value) {
state.actionList = value;
},
changeActionIndex(state, value) {
state.actionIndex = value;
},
changeImgList(state, value) {
state.imgList = value;
}
},
getters: {
systemSetting(state) {
return state.systemSetting;
},
getActionList(state) {
return state.actionList;
},
getActionIndex: (state) => state.actionIndex,
imgList: (state) => state.imgList
},
actions: {},
modules: {}
});
export function pxToUnit(px){
const setting = this.$dataStore.get("setting");
let unit = "mm";
if (setting) {
unit = setting.unit;
}
if (unit === "mm") {
px = Number((px * 0.84183).toFixed(1));
} else if (unit === "inch") {
px = Number((px * 0.84183) / 25.4).toFixed(1);
}
return px;
}
export function unitToPx(px){
const setting = this.$dataStore.get("setting");
let unit = "mm";
if (setting) {
unit = setting.unit;
}
if (unit === "mm") {
px = Number((px / 0.84183).toFixed(1));
} else if (unit === "inch") {
px = (Number((px / 0.84183) * 25.4).toFixed(1));
}
return px;
}
......@@ -209,7 +209,7 @@ export default {
const findByPodProductionNo = await this.$api.post(
"/findByPodProductionNo",
{
factorySubOrderNumber: this.productionNo
thirdSubOrderNumber: this.productionNo
}
);
this.detail = findByPodProductionNo.data;
......@@ -217,7 +217,7 @@ export default {
ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
let res = await this.$api.post("/downloadBySubOrderNumber", {
subOrderNumber: this.productionNo
subOrderNumber: this.detail.factorySubOrderNumber
});
this.imgList = [];
res.data.forEach(el => {
......
......@@ -5,6 +5,7 @@ import axios from "axios";
import html2canvas from "html2canvas";
import moment from "moment";
import pkg from "../../../../package.json";
import { pxToUnit } from "../../../utils/index";
export default {
data() {
return {
......@@ -136,6 +137,7 @@ export default {
this.getPrinter();
},
methods: {
pxToUnit,
delSetting() {
this.$confirm(`确定删除该预设?`, "提示", {
confirmButtonText: "确定",
......@@ -223,7 +225,7 @@ export default {
},
dataURLtoBlob(dataurl) {
var arr = dataurl.split(",");
const arr = dataurl.split(",");
//注意base64的最后面中括号和引号是不转译的
var _arr = arr[1].substring(0, arr[1].length - 2);
var mime = arr[0].match(/:(.*?);/)[1],
......@@ -280,6 +282,46 @@ export default {
// document.querySelector(".down").setAttribute('href', canvas.toDataURL());
});
},
return_data() {
let dom_id = `${this.imgList[0].fileName}_0`;
const image = document.getElementById(dom_id);
const line = document.getElementById("line");
// 使用getBoundingClientRect获取更精确的位置信息
const imageRect = image.getBoundingClientRect();
const lineRect = line.getBoundingClientRect();
// 计算image相对于line的坐标位置
const relativeX = imageRect.left - lineRect.left;
const relativeY = imageRect.top - lineRect.top;
// 获取图片的宽高
let w = image.clientWidth; // 图片宽
let h = image.clientHeight; // 图片高
const x = relativeX;
const y = relativeY;
const r = this.imgList[0].r;
const x_mm = this.pxToUnit(x);
const y_mm = this.pxToUnit(y);
const w_mm = this.pxToUnit(w);
const h_mm = this.pxToUnit(h);
console.log({
x: Number((x_mm - 0.8).toFixed(1)),
y: Number((y_mm - 0.9).toFixed(1)),
w: Number((w_mm - 0.3).toFixed(1)),
h: Number((h_mm - 0.3).toFixed(1)),
r
});
// 返回计算结果
return {
x: Number(x_mm.toFixed(1)),
y: Number(y_mm.toFixed(1)),
w: Number((w_mm - 0.3).toFixed(1)),
h: Number((h_mm - 0.3).toFixed(1)),
r
};
},
async getPrintCmd() {
if (this.imgList.length === 0)
return this.$message.warning("素材不能为空");
......@@ -295,35 +337,24 @@ export default {
return;
}
let { x, y, r, w, h } = this.imgList[0];
y = Number(y) - Number(h) / 2;
x = Number(x) - Number(w) / 2;
let x_mm = Number((x * 0.84183).toFixed(1));
let w_mm = Number((w * 0.84183).toFixed(1));
let h_mm = Number((h * 0.84183).toFixed(1));
let y_mm = Number((y * 0.84183).toFixed(1));
console.log(x_mm, y_mm);
let { x, y, w, h, r } = this.return_data();
r = Number(r).toFixed(0);
const imgFileName = this.imgList[0].fileName;
let position = ""; // 位置
let size = ""; // 图像大小
if (Number(x_mm) < 0 || Number(y_mm) < 0) {
position = `"${this.singleStr(
Number(x_mm).toFixed(1)
)},${this.singleStr(Number(y_mm).toFixed(1))}"`;
console.log(x, y);
if (Number(x) < 0 || Number(y) < 0) {
position = `"${this.singleStr(Number(x).toFixed(1))},${this.singleStr(
Number(y).toFixed(1)
)}"`;
} else {
position = `${this.singleStr(x_mm.toFixed(1))}${this.singleStr(
y_mm.toFixed(1)
position = `${this.singleStr(x.toFixed(1))}${this.singleStr(
y.toFixed(1)
)}`;
}
size = `${this.singleStr(Number(w_mm).toFixed(1))}${this.singleStr(
Number(h_mm).toFixed(1)
size = `${this.singleStr(Number(w).toFixed(1))}${this.singleStr(
Number(h).toFixed(1)
)}`;
const bigNum = "0031131"; // 图像放大倍数 -R
await this.sendCmd(imgFileName, size, position, r);
},
async sendCmd(imgFileName, size, position, r) {
......@@ -332,7 +363,7 @@ export default {
".png",
""
)}.xml`}" -I "${"Input\\" +
imgFileName}" -A "Output\\${imgFileName.replace(
imgFileName}" -A "Output\\${imgFileName.replace(
".png",
""
)}.arxp" -S ${size} -L ${position} -D ${r} -W ${whitePrint}`;
......@@ -357,12 +388,12 @@ export default {
async toWritePrintLog(send_api_data) {
let head_setting = this.$dataStore.get("setting");
let position_before_px = this.$dataStore.get("position_before_px"); // 图片的位置信息 px
let position_after_px = this.$dataStore.get("position_after_px");// 图片根据单位转换后的px
let position_after_px = this.$dataStore.get("position_after_px"); // 图片根据单位转换后的px
let position_unit = this.$dataStore.get("position_unit"); // 图片根据单位转换后的px
let print_time = moment(new Date()).format("YYYY-MM-DD HH:mm:ss"); // 打印的时间
let production_no = this.$dataStore.get("production_no"); // 打印的单号
let print_setting = JSON.parse(JSON.stringify(this.printSetting)); // 打印的设置
let version = this.pkg.version
let version = this.pkg.version;
let data = {
head_setting,
version,
......@@ -439,7 +470,7 @@ export default {
:label="it.label"
></el-option>
</el-select>
<div style="margin-left: 15px;display: flex" class="save-btn">
<div style="margin-left: 15px; display: flex" class="save-btn">
<el-popover
placement="bottom"
width="200"
......@@ -451,7 +482,7 @@ export default {
@click="openPopover"
slot="reference"
type="primary"
>保存预设
>保存预设
</el-button>
<div class="save-setting">
<el-input
......@@ -462,14 +493,14 @@ export default {
></el-input>
<div class="save-footer">
<el-button size="medium" @click="showPopover = false"
>取消
>取消
</el-button>
<el-button
@click="saveSetting"
:disabled="settingName === ''"
size="medium"
type="primary"
>保存
>保存
</el-button>
</div>
</div>
......@@ -479,7 +510,7 @@ export default {
:disabled="printSettingVal === 0"
@click="delSetting"
type="danger"
>删除
>删除
</el-button>
</div>
</div>
......@@ -863,7 +894,7 @@ export default {
</el-tooltip>
</div>
<el-button size="small" @click="setDetailShow"
>{{ detailShow ? "关闭详细设置" : "打开详细设置" }}...
>{{ detailShow ? "关闭详细设置" : "打开详细设置" }}...
</el-button>
</div>
</div>
......@@ -892,7 +923,7 @@ export default {
<div class="btn">
<el-input
size="small"
style="width: 100px;"
style="width: 100px"
oninput="value=value.replace(/[^\-?\d]/g,'')"
v-model="printSetting.printNum"
></el-input>
......@@ -903,8 +934,8 @@ export default {
<el-button
@click="getPrintCmd"
type="primary"
style="width: 98%;height: 50px"
>打印
style="width: 98%; height: 50px"
>打印
</el-button>
</div>
</div>
......@@ -952,7 +983,7 @@ export default {
font-size: 20px;
color: #409eff;
position: relative;
margin :15px 0;
margin: 15px 0;
display: inline-block;
left: -15px;
}
......@@ -1028,7 +1059,6 @@ export default {
display: flex;
width: 430px;
flex-direction: column;
}
}
......@@ -1080,7 +1110,8 @@ export default {
justify-content: center;
}
}
::v-deep .el-form-item{
::v-deep .el-form-item {
margin-bottom: 9px;
}
</style>
......
<script>
import { pxToUnit, unitToPx } from "@/utils";
export default {
data() {
return {
......@@ -26,10 +28,8 @@ export default {
},
item: {
type: Object,
default: () => {
}
default: () => {}
}
},
watch: {
visible: {
......@@ -42,25 +42,20 @@ export default {
handler() {
if (this.item) {
let setting = this.$dataStore.get("setting");
this.item.y = (this.item.y - this.item.h / 2);
this.item.x = (this.item.x - this.item.w / 2);
this.$dataStore.set("position_before_px", JSON.parse(JSON.stringify(this.item)));
console.log(
"setting",
setting
)
this.item.y = this.item.y - this.item.h / 2;
this.item.x = this.item.x - this.item.w / 2;
this.$dataStore.set(
"position_before_px",
JSON.parse(JSON.stringify(this.item))
);
console.log("setting", setting);
let x_mm, w_mm, h_mm, y_mm;
if (setting.unit === "mm") {
x_mm = Number((this.item.x * 0.84183).toFixed(2));
w_mm = Number((this.item.w * 0.84183).toFixed(2));
h_mm = Number((this.item.h * 0.84183).toFixed(2));
y_mm = Number((this.item.y * 0.84183).toFixed(2));
} else if (setting.unit === "inch") {
x_mm = Number((this.item.x * 0.84183) / 25.4).toFixed(2);
w_mm = Number((this.item.w * 0.84183) / 25.4).toFixed(2);
h_mm = Number((this.item.h * 0.84183) / 25.4).toFixed(2);
y_mm = Number((this.item.y * 0.84183) / 25.4).toFixed(2);
}
x_mm = this.pxToUnit(this.item.x);
w_mm = this.pxToUnit(this.item.w);
h_mm = this.pxToUnit(this.item.h);
y_mm = this.pxToUnit(this.item.y);
// return
this.form.x = x_mm;
this.form.rate = this.item.rate;
......@@ -69,7 +64,10 @@ export default {
this.form.h = h_mm;
this.form.zIndex = this.item.zIndex;
this.form.r = this.item.r;
this.$dataStore.set(`position_after_px`, JSON.parse(JSON.stringify(this.form)));
this.$dataStore.set(
`position_after_px`,
JSON.parse(JSON.stringify(this.form))
);
}
},
immediate: true,
......@@ -77,8 +75,9 @@ export default {
}
},
methods: {
pxToUnit,
unitToPx,
formChange(t) {
if (t && t === "w") {
this.form.h = this.form.w * this.form.rate;
}
......@@ -86,22 +85,13 @@ export default {
this.form.w = this.form.h * this.form.rate;
}
let f = JSON.parse(JSON.stringify(this.form));
f.y = (Number(f.y) + Number(f.h) / 2);
f.x = (Number(f.x) + Number(f.w) / 2);
let setting = this.$dataStore.get("setting");
if (setting.unit === "mm") {
f.x = Number((f.x / 0.84183).toFixed(2));
f.y = Number((f.y / 0.84183).toFixed(2));
f.w = Number((f.w / 0.84183).toFixed(2));
f.h = Number((f.h / 0.84183).toFixed(2));
} else if (setting.unit === "inch") {
f.x = (Number((f.x / 0.84183) * 25.4).toFixed(2));
f.y = (Number((f.y / 0.84183) * 25.4).toFixed(2));
f.w = (Number((f.w / 0.84183) * 25.4).toFixed(2));
f.h = (Number((f.h / 0.84183) * 25.4).toFixed(2));
}
f.zIndex = Number((f.zIndex));
f.y = Number(f.y) + Number(f.h) / 2;
f.x = Number(f.x) + Number(f.w) / 2;
f.x = this.unitToPx(f.x);
f.y = this.unitToPx(f.y);
f.w = this.unitToPx(f.w);
f.h = this.unitToPx(f.h);
f.zIndex = Number(f.zIndex);
for (let k in f) {
f[k] = Number(f[k]);
}
......@@ -109,7 +99,6 @@ export default {
this.$dataStore.set("position_unit", JSON.parse(JSON.stringify(f)));
},
addValue(f) {
if (!this.form[f]) this.$set(this.form, f, 0);
let nw = Number(this.form[f]) + 1;
this.$set(this.form, f, nw);
......@@ -138,12 +127,18 @@ export default {
</script>
<template>
<div class="drawer" :style="{animation:`ltr-drawer-in .3s 1ms`}">
<div class="drawer" :style="{ animation: `ltr-drawer-in .3s 1ms` }">
<div class="title">
图片编辑
</div>
<div class="img-form">
<el-form size="small" style="" :model="form" label-position="left" label-width="30px">
<el-form
size="small"
style=""
:model="form"
label-position="left"
label-width="30px"
>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="x:" prop="x">
......@@ -193,7 +188,6 @@ export default {
<el-form-item label="r:">
<div class="form-content">
<el-input maxlength="3" @blur="formChange" v-model="form.r">
</el-input>
<div class="set-value">
<i @click="addValue('r')" class="el-icon-arrow-up"></i>
......@@ -205,40 +199,61 @@ export default {
<el-col :span="12">
<el-form-item label="z:">
<div class="form-content">
<el-input @blur="formChange" v-model="form.zIndex">
</el-input>
<el-input @blur="formChange" v-model="form.zIndex"> </el-input>
<div class="set-value">
<i @click="addValue('zIndex')" class="el-icon-arrow-up"></i>
<i @click="reduceValue('zIndex')" class="el-icon-arrow-down"></i>
<i
@click="reduceValue('zIndex')"
class="el-icon-arrow-down"
></i>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="24">
<el-tooltip content="居中">
<el-button @click="$emit('ev','center')" size="mini">
<img style="width: 13px;height: 13px" src="@/static/icon/juzhong-01.png" alt="">
<el-button @click="$emit('ev', 'center')" size="mini">
<img
style="width: 13px;height: 13px"
src="@/static/icon/juzhong-01.png"
alt=""
/>
</el-button>
</el-tooltip>
<el-tooltip content="垂直居中">
<el-button @click="$emit('ev','y_center')" size="mini">
<img style="width: 13px;height: 13px" src="@/static/icon/vertical.png" alt="">
<el-button @click="$emit('ev', 'y_center')" size="mini">
<img
style="width: 13px;height: 13px"
src="@/static/icon/vertical.png"
alt=""
/>
</el-button>
</el-tooltip>
<el-tooltip content="水平居中">
<el-button @click="$emit('ev','x_center')" size="mini">
<img style="width: 13px;height: 13px" src="@/static/icon/shuipingjuzhong.png" alt="">
<el-button @click="$emit('ev', 'x_center')" size="mini">
<img
style="width: 13px;height: 13px"
src="@/static/icon/shuipingjuzhong.png"
alt=""
/>
</el-button>
</el-tooltip>
<el-tooltip content="上移一层">
<el-button @click="$emit('ev','add_index')" size="mini">
<img style="width: 13px;height: 13px" src="@/static/icon/shangyi.png" alt="">
<el-button @click="$emit('ev', 'add_index')" size="mini">
<img
style="width: 13px;height: 13px"
src="@/static/icon/shangyi.png"
alt=""
/>
</el-button>
</el-tooltip>
<el-tooltip content="下移一层">
<el-button @click="$emit('ev','reduce_index')" size="mini">
<img style="width: 13px;height: 13px" src="@/static/icon/xiayi.png" alt="">
<el-button @click="$emit('ev', 'reduce_index')" size="mini">
<img
style="width: 13px;height: 13px"
src="@/static/icon/xiayi.png"
alt=""
/>
</el-button>
</el-tooltip>
</el-col>
......@@ -247,7 +262,6 @@ export default {
</div>
<slot></slot>
</div>
</template>
<style lang="less" scoped>
......@@ -294,7 +308,8 @@ export default {
padding: 10px;
z-index: 99;
background: white;
box-shadow: 0 8px 10px -5px rgba(0, 0, 0, .2), 0 16px 24px 2px rgba(0, 0, 0, .14), 0 6px 30px 5px rgba(0, 0, 0, .12);
box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2),
0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12);
left: 0;
position: fixed;
border-right: 1px solid #ececec;
......@@ -334,5 +349,4 @@ export default {
transform: translate(-100%);
}
}
</style>
......@@ -259,8 +259,8 @@ export default {
},
selectImg(it, i) {
// this.selectImgIndexList.push(i)
let item = this.imgList.find(img=>img.fileName===it.fileName)
if(item) return
let item = this.imgList.find(img => img.fileName === it.fileName);
if (item) return;
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this.getBackFile([it], file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
......@@ -353,22 +353,13 @@ export default {
},
resizeStop(data, item) {
// if (this.selectIndex === -1) this.selectIndex = 0
console.log("drag", this.selectIndex);
if (this.selectIndex < 0) return;
this.$set(item, "y", data.y);
this.$set(item, "w", data.w);
this.$set(item, "h", data.h);
this.$set(item, "x", data.x);
// console.log(this.selectIndex,'resize',x, y, w, h)
// this.actionList.unshift({
// t: 'resize',
// x,
// y,
// w,
// h
// })
// this.$store.commit('changeActionList', this.actionList)
console.log("resizeStop", data);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
},
resizing(index) {},
......@@ -438,7 +429,6 @@ export default {
console.log(files);
let that = this;
let bw = document.getElementById("line").clientWidth;
let bh = document.getElementById("line").clientHeight;
for (let i = 0; i < files.length; i++) {
files[i].url = files[i].productionFile;
that.$nextTick(() => {
......@@ -454,7 +444,7 @@ export default {
x: w,
y: (bw * (2 / 3) * rate) / 2,
h: bw * (2 / 3) * rate,
r: 0
r: 0,
});
that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true;
......@@ -672,6 +662,7 @@ export default {
<img
crossOrigin="anonymous"
:src="item.url"
:id="item.fileName+'_'+index"
alt=""
class="sucaitu-img"
/>
......@@ -729,7 +720,6 @@ export default {
@change="formChange"
:item="returnItem"
@close="close"
>
<div class="select-img" v-if="selectImgList.length">
<div
......
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