From 05e9ff7360b586e472e457af1526a143679d04ca Mon Sep 17 00:00:00 2001 From: 1549469775 <1549469775@qq.com> Date: Sat, 26 Dec 2020 13:03:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E8=BE=B9=E7=BC=98=E5=B7=A6=E8=BE=B9?= =?UTF-8?q?=E7=BC=98=E5=90=B8=E9=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request/index.js | 6 +----- src/ui/editor/MakeLine.vue | 44 ++++++++++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/api/request/index.js b/src/api/request/index.js index 039d247..d773741 100644 --- a/src/api/request/index.js +++ b/src/api/request/index.js @@ -16,7 +16,7 @@ const checkERR = (err, type) => { }; // 静默执行 -export function request_(type = "GET", url, data = {},contentType=0,sendToken = true) { +export function request_(type = "GET", url, data = {}) { var __data = {}; if (type.toUpperCase() == "GET") { __data.params = data; @@ -34,10 +34,6 @@ export function request_(type = "GET", url, data = {},contentType=0,sendToken = url: realUrl, method: type, ...__data, - headers:{ - $type: contentType, - $token: sendToken, - }, responseType: "json", }) .then((res) => { diff --git a/src/ui/editor/MakeLine.vue b/src/ui/editor/MakeLine.vue index 9526d75..9186a75 100644 --- a/src/ui/editor/MakeLine.vue +++ b/src/ui/editor/MakeLine.vue @@ -46,22 +46,34 @@ export default { }; }, methods: { - removeAll(){ + removeAll() { this.lineLeft = []; this.lineTop = []; }, - listenerChange(list, index,cb) { + listenerChange(list, index, cb) { const activeStyle = list[index].style; + // 上边缘 + if (Math.abs(activeStyle.top) <= value) { + activeStyle.top = 0; + cb && cb(list[index], index); + } + // 左边缘 + if (Math.abs(activeStyle.left) <= value) { + activeStyle.left = 0; + cb && cb(list[index], index); + } + if (list.length==1) { + return + } list.forEach((item, jndex) => { if (jndex !== index) { let curStyle = item.style; - let curBottom = curStyle.top+curStyle.height - let curRight = curStyle.left+curStyle.width - let actRight = activeStyle.left+activeStyle.width - let actBottom = activeStyle.top+activeStyle.height + let curBottom = curStyle.top + curStyle.height; + let curRight = curStyle.left + curStyle.width; + let actRight = activeStyle.left + activeStyle.width; + let actBottom = activeStyle.top + activeStyle.height; - this.removeLine(curStyle.top, curStyle.left); this.removeLine(curBottom, curRight); // TODO 中 中 @@ -69,49 +81,49 @@ export default { if (Math.abs(activeStyle.top - curStyle.top) <= value) { activeStyle.top = curStyle.top; this.makeTop2Bottom(curStyle.top); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 下--上 if (Math.abs(actBottom - curBottom) <= value) { activeStyle.top = curBottom - activeStyle.height; this.makeTop2Bottom(curBottom); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 上--下 if (Math.abs(activeStyle.top - curBottom) <= value) { activeStyle.top = curBottom; this.makeTop2Bottom(curBottom); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 左--左 if (Math.abs(activeStyle.left - curStyle.left) <= value) { activeStyle.left = curStyle.left; this.makeLeft2Right(curStyle.left); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 左--右 if (Math.abs(activeStyle.left - curRight) <= value) { - activeStyle.left = curRight + activeStyle.left = curRight; this.makeLeft2Right(curRight); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 右--右 if (Math.abs(actRight - curRight) <= value) { activeStyle.left = curRight - activeStyle.width; this.makeLeft2Right(curRight); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 下--上 if (Math.abs(actBottom - curStyle.top) <= value) { activeStyle.top = curStyle.top - activeStyle.height; this.makeTop2Bottom(curStyle.top); - cb&&cb(list[index],index) + cb && cb(list[index], index); } // 右--左 if (Math.abs(actRight - curStyle.left) <= value) { activeStyle.left = curStyle.left - activeStyle.width; this.makeLeft2Right(curStyle.left); - cb&&cb(list[index],index) + cb && cb(list[index], index); } } });