Commit 71e49817 by linjinhong

fix:修改图片位置

parent 433632d1
...@@ -57,7 +57,6 @@ function getLatestOrderByPrefixNewId(targetNewId, type) { ...@@ -57,7 +57,6 @@ function getLatestOrderByPrefixNewId(targetNewId, type) {
// 正则匹配:以targetNewId开头,后跟-数字结尾(严格匹配cacheKey格式) // 正则匹配:以targetNewId开头,后跟-数字结尾(严格匹配cacheKey格式)
const prefixReg = new RegExp(`^${targetNewId}-(\\d+)$`); const prefixReg = new RegExp(`^${targetNewId}-(\\d+)$`);
let matchedKeyWithSuffix = []; let matchedKeyWithSuffix = [];
console.log(60, orderCacheMap);
// 遍历缓存,筛选匹配前缀的订单 // 遍历缓存,筛选匹配前缀的订单
orderCacheMap.forEach((order, cacheKey) => { orderCacheMap.forEach((order, cacheKey) => {
...@@ -139,7 +138,7 @@ function refreshOrderCache() { ...@@ -139,7 +138,7 @@ function refreshOrderCache() {
samePrefixItems.forEach((sameItem, index) => { samePrefixItems.forEach((sameItem, index) => {
const cacheKey = `${itemPrefix}-${index + 1}`; const cacheKey = `${itemPrefix}-${index + 1}`;
newCacheMap.set(cacheKey, sameItem); newCacheMap.set(cacheKey, sameItem);
console.log("cacheKey", cacheKey); // console.log("cacheKey", cacheKey);
}); });
} }
}); });
......
...@@ -73,6 +73,15 @@ export default new Vuex.Store({ ...@@ -73,6 +73,15 @@ export default new Vuex.Store({
h: 0, h: 0,
w: 0, w: 0,
}, },
{
label: "40×50",
value: 99,
row: 40,
col: 50,
h: 0,
w: 0,
disabled: true,
},
], ],
grid: [], grid: [],
}, },
...@@ -113,7 +122,10 @@ export default new Vuex.Store({ ...@@ -113,7 +122,10 @@ export default new Vuex.Store({
setOrderType(state, value) { setOrderType(state, value) {
state.orderType = value; state.orderType = value;
}, },
setGrid(state) { setGrid(state, arr) {
if (arr) {
return (state.grid = [arr]);
}
state.grid.forEach((el) => { state.grid.forEach((el) => {
if (el.value == 0) { if (el.value == 0) {
let proportion = state.WHproportion; let proportion = state.WHproportion;
...@@ -142,6 +154,9 @@ export default new Vuex.Store({ ...@@ -142,6 +154,9 @@ export default new Vuex.Store({
} else if (el.value == 6) { } else if (el.value == 6) {
el.h = 660 * 1.4; el.h = 660 * 1.4;
el.w = 540 * 1.4; el.w = 540 * 1.4;
} else if (el.value == 99) {
el.h = 900;
el.w = 720;
} }
}); });
}, },
......
...@@ -124,8 +124,13 @@ export default { ...@@ -124,8 +124,13 @@ export default {
// console.log(pkg, "pkg"); // console.log(pkg, "pkg");
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.searchRef?.focus(); this.$refs.searchRef?.focus();
this.selectGridIndex = 0; if (this.desktopDevice !== 3) {
this.setting.gridValue = 0; this.selectGridIndex = 0;
this.setting.gridValue = 0;
} else {
this.selectGridIndex = 5;
this.setting.gridValue = 5;
}
}); });
this.$store.commit("changeDesktopDevice", getDesktopDevice()); this.$store.commit("changeDesktopDevice", getDesktopDevice());
}, },
...@@ -149,7 +154,6 @@ export default { ...@@ -149,7 +154,6 @@ export default {
}, },
config: { config: {
handler(val) { handler(val) {
// console.log(99999999, val);\
this.newApiApiHost = this.getDomainFromUrl(val.apiApiHost); this.newApiApiHost = this.getDomainFromUrl(val.apiApiHost);
}, },
immediate: true, immediate: true,
...@@ -520,7 +524,7 @@ export default { ...@@ -520,7 +524,7 @@ export default {
}); });
} }
//如果该数据的图片第一次出现且素材图大于1张则把该数据储存到本地 //如果该数据的图片第一次出现且素材图大于1张则把该数据储存到本地
if (newImgList.length > 1 && !bool) { if (newImgList.length > 1 && !bool && this.desktopDevice == 3) {
addToOrderInfo(this.detail); addToOrderInfo(this.detail);
console.log("本地数据addToOrderInfo", getOrderInfoMap()); console.log("本地数据addToOrderInfo", getOrderInfoMap());
} }
...@@ -737,7 +741,13 @@ export default { ...@@ -737,7 +741,13 @@ export default {
this.selectedOption = command; // 根据选中的项来更新 selectedOption this.selectedOption = command; // 根据选中的项来更新 selectedOption
}, },
changeDesktopDeviceFn(value) { changeDesktopDeviceFn(value) {
console.log("changeDesktopDeviceFn", value); if (value === 3) {
this.setting.gridValue == 5;
this.selectGridIndex = 5;
} else {
this.selectGridIndex = 0;
this.setting.gridValue = 0;
}
setDesktopDevice(value); setDesktopDevice(value);
this.$store.commit("changeDesktopDevice", value); this.$store.commit("changeDesktopDevice", value);
this.$store.commit("changeImgList", []); this.$store.commit("changeImgList", []);
...@@ -889,8 +899,8 @@ export default { ...@@ -889,8 +899,8 @@ export default {
<el-option label="惠立彩" :value="3"></el-option> <el-option label="惠立彩" :value="3"></el-option>
</el-select> </el-select>
</div> </div>
<div style="display: flex;" v-if="desktopDevice != 3"> <div style="display: flex;">
<div class="selectInput"> <div class="selectInput" v-if="desktopDevice != 3">
<div>驱动版本:</div> <div>驱动版本:</div>
<el-select <el-select
...@@ -908,18 +918,24 @@ export default { ...@@ -908,18 +918,24 @@ export default {
trigger="click" trigger="click"
@command="command" @command="command"
:hide-on-click="false" :hide-on-click="false"
:disabled="desktopDevice == 3"
> >
<el-button style="height: 100%;margin-right: 0" size="small" <el-button style="height: 100%;margin-right: 0" size="small"
>{{ grid[selectGridIndex]?.label }} >{{ grid[selectGridIndex]?.label }}
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="i" v-for="(it, i) in grid" :key="i"> <el-dropdown-item
:command="i"
v-for="(it, i) in grid"
:key="i"
:disabled="it.disabled"
>
{{ it.label }} {{ it.label }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-tooltip content="图片"> <el-tooltip content="图片" v-if="desktopDevice != 3">
<el-upload <el-upload
accept=".png" accept=".png"
action="" action=""
...@@ -934,7 +950,7 @@ export default { ...@@ -934,7 +950,7 @@ export default {
</el-upload> </el-upload>
</el-tooltip> </el-tooltip>
<el-tooltip content="背景色"> <el-tooltip content="背景色" v-if="desktopDevice != 3">
<el-color-picker <el-color-picker
style="margin-right: 3px" style="margin-right: 3px"
v-model="selectBgColor" v-model="selectBgColor"
...@@ -1031,7 +1047,7 @@ export default { ...@@ -1031,7 +1047,7 @@ export default {
</el-form> </el-form>
</div> </div>
<el-tooltip slot="reference" content="设置"> <el-tooltip slot="reference" content="设置">
<el-button style="margin-right: 8px" size="small"> <el-button style="margin:0 8px" size="small">
<img <img
style="width: 18px;height: 18px" style="width: 18px;height: 18px"
src="@/static/icon/shezhi.png" src="@/static/icon/shezhi.png"
...@@ -1041,7 +1057,7 @@ export default { ...@@ -1041,7 +1057,7 @@ export default {
</el-tooltip> </el-tooltip>
</el-popover> </el-popover>
</div> </div>
<div v-else> <div v-if="desktopDevice == 3">
<div class="selectInput"> <div class="selectInput">
<div>当前打印:</div> <div>当前打印:</div>
......
...@@ -47,9 +47,12 @@ export default { ...@@ -47,9 +47,12 @@ export default {
immediate: true, immediate: true,
}, },
item: { item: {
handler() { handler(val) {
// console.log(789, this.item); console.log("item11", this.item);
if (val && this.newDesktopDevice == 3) {
return;
}
if (this.item) { if (this.item) {
this.getCurrentItem(this.item); this.getCurrentItem(this.item);
} else { } else {
...@@ -67,6 +70,7 @@ export default { ...@@ -67,6 +70,7 @@ export default {
r: 0, r: 0,
}; };
} }
console.log("item", this.item);
}, },
immediate: true, immediate: true,
deep: true, deep: true,
...@@ -77,13 +81,8 @@ export default { ...@@ -77,13 +81,8 @@ export default {
unitToPx, unitToPx,
getCurrentItem(item) { getCurrentItem(item) {
// let setting = this.$dataStore.get("setting"); // let setting = this.$dataStore.get("setting");
if (item.y != 0) {
this.item.y = item.y - item.h / 2;
console.log(93, item);
} else {
item.y == 0;
}
this.item.y = item.y - item.h / 2;
this.item.x = item.x - item.w / 2; this.item.x = item.x - item.w / 2;
this.$dataStore.set( this.$dataStore.set(
"position_before_px", "position_before_px",
......
...@@ -58,6 +58,9 @@ export default { ...@@ -58,6 +58,9 @@ export default {
}, },
computed: { computed: {
gridWH() { gridWH() {
// console.log("systemSetting", this.systemSetting);
// console.log("gridValue", this.systemSetting.gridValue);
if ( if (
!this.systemSetting || !this.systemSetting ||
!this.grid || !this.grid ||
...@@ -123,7 +126,7 @@ export default { ...@@ -123,7 +126,7 @@ export default {
}, },
returnItem() { returnItem() {
console.log("returnItem", this.imgList[this.selectIndex]); // console.log("returnItem", this.imgList[this.selectIndex]);
if (this.selectIndex < 0 && this.imgList.length) { if (this.selectIndex < 0 && this.imgList.length) {
// this.showImgSetting = false; // this.showImgSetting = false;
...@@ -221,8 +224,8 @@ export default { ...@@ -221,8 +224,8 @@ export default {
watch: { watch: {
imgList: { imgList: {
async handler(newValue) { async handler(newValue) {
console.log(223, newValue); // console.log(223, newValue);
console.log(223, this.returnItem); // console.log(223, this.returnItem);
const image = document.getElementById("imgBox"); const image = document.getElementById("imgBox");
...@@ -414,6 +417,18 @@ export default { ...@@ -414,6 +417,18 @@ export default {
}, },
deep: true, deep: true,
}, },
newDesktopDevice: {
handler(val) {
// console.log(122, val);
if (val == 3) {
this.systemSetting.gridValue = 5;
} else {
this.systemSetting.gridValue = 1;
}
},
immediate: true,
},
}, },
methods: { methods: {
// 重构为可手动触发的方法 // 重构为可手动触发的方法
...@@ -714,7 +729,7 @@ export default { ...@@ -714,7 +729,7 @@ export default {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
outsideClick(e) { outsideClick(e) {
if (this.newDesktopDevice == 3) return; console.log(e);
if ( if (
!( !(
...@@ -800,17 +815,25 @@ export default { ...@@ -800,17 +815,25 @@ export default {
let h = bh / 2; let h = bh / 2;
let width_px, height_px, rate, x, y; let width_px, height_px, rate, x, y;
let data = await that.getImageSize(files[i].url); let data = await that.getImageSize(files[i].url);
console.log("w", w); console.log("data", data);
console.log("h", h); // console.log("h", h);
if (size && !files[i].isCut) { if (size && !files[i].isCut) {
console.log("size", size); console.log("size", size);
if (this.newDesktopDevice == 3) {
width_px = that.WHproportion * mmToPx(size.width); const scale = bh / data.height;
height_px = that.WHproportion * mmToPx(size.height); width_px = data.width * scale;
x = w * that.WHproportion; height_px = data.height * scale;
y = h * that.WHproportion; x = (bw - data.w) / 2;
rate = height_px / width_px; y = h;
rate = height_px / width_px;
} else {
width_px = that.WHproportion * mmToPx(size.width);
height_px = that.WHproportion * mmToPx(size.height);
x = w;
y = h;
rate = height_px / width_px;
}
} else { } else {
console.log("data", data); console.log("data", data);
rate = data.height / data.width; rate = data.height / data.width;
...@@ -843,11 +866,15 @@ export default { ...@@ -843,11 +866,15 @@ export default {
r: 0, r: 0,
}); });
console.log(that.imgList);
that.selectIndex = that.imgList.length - 1; that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true; that.showImgSetting = true;
// that.$nextTick(() => { // if (this.newDesktopDevice != 3) {
// that.ev("x_center"); // that.$nextTick(() => {
// }); // that.ev("center");
// });
// }
// setTimeout(() => { // setTimeout(() => {
// that.ev("center"); // that.ev("center");
...@@ -1274,6 +1301,7 @@ export default { ...@@ -1274,6 +1301,7 @@ export default {
mounted() { mounted() {
this.imgHeight = window.screen.height + "px"; this.imgHeight = window.screen.height + "px";
this.systemSetting = this.$dataStore.get("setting"); this.systemSetting = this.$dataStore.get("setting");
// console.log(1297, this.newDesktopDevice);
bus.$on("busEmit", (v) => { bus.$on("busEmit", (v) => {
let { type, value, size } = v; let { type, value, size } = v;
...@@ -1433,6 +1461,7 @@ export default { ...@@ -1433,6 +1461,7 @@ export default {
v-for="(img, i) in selectImgList" v-for="(img, i) in selectImgList"
:key="i" :key="i"
class="img-item" class="img-item"
:class="{ borderStyle: i == selectIndex }"
@click.stop.prevent=" @click.stop.prevent="
newDesktopDevice !== 3 && selectImg(img, i) newDesktopDevice !== 3 && selectImg(img, i)
" "
...@@ -1625,7 +1654,7 @@ export default { ...@@ -1625,7 +1654,7 @@ export default {
</template> </template>
</img-setting> </img-setting>
<div <div
@click="outsideClick" @click="newDesktopDevice != 3 && outsideClick"
class="main-bg" class="main-bg"
:style="{ 'background-color': !isView ? '#77797a' : '#fff' }" :style="{ 'background-color': !isView ? '#77797a' : '#fff' }"
> >
...@@ -1679,8 +1708,14 @@ export default { ...@@ -1679,8 +1708,14 @@ export default {
<div <div
:class="{ 'no-border-grid': systemSetting.gridShow !== 1 }" :class="{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:style="{ :style="{
width: gridWH.row * 30 + 'px', width:
height: gridWH.col * 30 + 'px', newDesktopDevice == 3
? grid.row * 20 + 'px'
: gridWH.row * 30 + 'px',
height:
newDesktopDevice == 3
? grid.col * 20 + 'px'
: gridWH.col * 30 + 'px',
}" }"
class="grid" class="grid"
style="border-style:dashed" style="border-style:dashed"
...@@ -1929,7 +1964,7 @@ export default { ...@@ -1929,7 +1964,7 @@ export default {
} }
.grid { .grid {
border: 1px solid gray; // border: 1px solid gray;
overflow: hidden; overflow: hidden;
.grid-row { .grid-row {
...@@ -2463,4 +2498,7 @@ img { ...@@ -2463,4 +2498,7 @@ img {
} }
} }
} }
.borderStyle {
border: 3px solid #409eff;
}
</style> </style>
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