diff --git a/src/assets/icons/iconfont.css b/src/assets/icons/iconfont.css
index aa6e67cd..49f8d140 100644
--- a/src/assets/icons/iconfont.css
+++ b/src/assets/icons/iconfont.css
@@ -1,9 +1,9 @@
@font-face {
font-family: "iconfont"; /* Project id 4227145 */
- src: url('iconfont.woff2?t=1728892263234') format('woff2'),
- url('iconfont.woff?t=1728892263234') format('woff'),
- url('iconfont.ttf?t=1728892263234') format('truetype'),
- url('iconfont.svg?t=1728892263234#iconfont') format('svg');
+ src: url('iconfont.woff2?t=1728898698610') format('woff2'),
+ url('iconfont.woff?t=1728898698610') format('woff'),
+ url('iconfont.ttf?t=1728898698610') format('truetype'),
+ url('iconfont.svg?t=1728898698610#iconfont') format('svg');
}
.iconfont {
@@ -14,8 +14,8 @@
-moz-osx-font-smoothing: grayscale;
}
-.icon-cancel-bottom-placement:before {
- content: "\e79f";
+.icon-top-up:before {
+ content: "\e7a1";
}
.icon-bottom-up:before {
diff --git a/src/assets/icons/iconfont.js b/src/assets/icons/iconfont.js
index 34e9fd78..d76924b0 100644
--- a/src/assets/icons/iconfont.js
+++ b/src/assets/icons/iconfont.js
@@ -1 +1 @@
-window._iconfont_svg_string_4227145='',(h=>{var a=(l=(l=document.getElementsByTagName("script"))[l.length-1]).getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var c,o,i,m,v,t=function(a,l){l.parentNode.insertBefore(a,l)};if(a&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}c=function(){var a,l=document.createElement("div");l.innerHTML=h._iconfont_svg_string_4227145,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?t(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(c,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),c()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(i=c,m=h.document,v=!1,d(),m.onreadystatechange=function(){"complete"==m.readyState&&(m.onreadystatechange=null,z())})}function z(){v||(v=!0,i())}function d(){try{m.documentElement.doScroll("left")}catch(a){return void setTimeout(d,50)}z()}})(window);
\ No newline at end of file
+window._iconfont_svg_string_4227145='',(h=>{var a=(l=(l=document.getElementsByTagName("script"))[l.length-1]).getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var c,o,i,m,v,t=function(a,l){l.parentNode.insertBefore(a,l)};if(a&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}c=function(){var a,l=document.createElement("div");l.innerHTML=h._iconfont_svg_string_4227145,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?t(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(c,0):(o=function(){document.removeEventListener("DOMContentLoaded",o,!1),c()},document.addEventListener("DOMContentLoaded",o,!1)):document.attachEvent&&(i=c,m=h.document,v=!1,d(),m.onreadystatechange=function(){"complete"==m.readyState&&(m.onreadystatechange=null,z())})}function z(){v||(v=!0,i())}function d(){try{m.documentElement.doScroll("left")}catch(a){return void setTimeout(d,50)}z()}})(window);
\ No newline at end of file
diff --git a/src/assets/icons/iconfont.json b/src/assets/icons/iconfont.json
index 27e16ee6..11cfd41c 100644
--- a/src/assets/icons/iconfont.json
+++ b/src/assets/icons/iconfont.json
@@ -6,11 +6,11 @@
"description": "",
"glyphs": [
{
- "icon_id": "42097664",
- "name": "取消置底",
- "font_class": "cancel-bottom-placement",
- "unicode": "e79f",
- "unicode_decimal": 59295
+ "icon_id": "42105733",
+ "name": "置顶",
+ "font_class": "top-up",
+ "unicode": "e7a1",
+ "unicode_decimal": 59297
},
{
"icon_id": "42097665",
diff --git a/src/assets/icons/iconfont.svg b/src/assets/icons/iconfont.svg
index dc9b5c8e..60c0e3ee 100644
--- a/src/assets/icons/iconfont.svg
+++ b/src/assets/icons/iconfont.svg
@@ -14,7 +14,7 @@
/>
-
+
diff --git a/src/assets/icons/iconfont.ttf b/src/assets/icons/iconfont.ttf
index 58a4531e..25c07d2d 100644
Binary files a/src/assets/icons/iconfont.ttf and b/src/assets/icons/iconfont.ttf differ
diff --git a/src/assets/icons/iconfont.woff b/src/assets/icons/iconfont.woff
index 97fd3d39..b3e3814b 100644
Binary files a/src/assets/icons/iconfont.woff and b/src/assets/icons/iconfont.woff differ
diff --git a/src/assets/icons/iconfont.woff2 b/src/assets/icons/iconfont.woff2
index def9123e..ba9d6da1 100644
Binary files a/src/assets/icons/iconfont.woff2 and b/src/assets/icons/iconfont.woff2 differ
diff --git a/src/components/model-custom/components/index.scss b/src/components/model-custom/components/index.scss
index f33b97cc..f389730e 100644
--- a/src/components/model-custom/components/index.scss
+++ b/src/components/model-custom/components/index.scss
@@ -134,30 +134,6 @@
box-shadow: 0rem 0 0rem 0.1rem $cr-main;
border: 0;
}
- .plug-in-right {
- cursor: default;
- background: $cr-main;
- // position: absolute;
- // right: -5rem;
- display: flex;
- flex-direction: column;
- gap: 2rem;
- padding: 2rem 1.2rem;
- color: #fff;
- border-radius: 0.4rem;
- z-index: 2;
- & > i {
- cursor: pointer;
- }
- & > i.disabled {
- color: #5db2ff;
- cursor: not-allowed;
- }
- & .icon-arrow-top,
- & .icon-arrow-bottom {
- height: 0.9rem;
- }
- }
.area-box {
position: absolute;
background: rgba(42, 148, 255, 0.25);
@@ -295,17 +271,6 @@
cursor: pointer;
color: $cr-main;
}
-.acticons {
- position: absolute;
- left: 50%;
- margin-left: 23rem;
- top: 50%;
- display: flex;
- flex-direction: column;
- gap: 2rem;
- z-index: 1;
- transform: translate(-50%, -50%);
-}
.drawer-container {
position: relative;
diff --git a/src/components/model-custom/components/index.vue b/src/components/model-custom/components/index.vue
index 3c9bb06f..d3913144 100644
--- a/src/components/model-custom/components/index.vue
+++ b/src/components/model-custom/components/index.vue
@@ -59,22 +59,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -296,24 +281,64 @@ const del = (index: null | number) => {
});
}
};
-const bottom_up = (index: number) => {
- console.log('bottom_up', index);
- if (typeof index === 'number' && !isNaN(index)) {
- if (!isEmpty(diy_data.value[index])) {
- const new_z_index = z_index.value - 1;
- diy_data.value[index].com_data.z_index = new_z_index;
- z_index.value = new_z_index;
+//前置一层 + 1
+const previous_layer = (index: number) => {
+ if (diy_data.value.length > 0) {
+ const old_z_index = cloneDeep(diy_data.value[index].com_data.z_index);
+ // 数据排序
+ const list = cloneDeep(diy_data.value).sort((a, b) => a.com_data.z_index - b.com_data.z_index);
+ // 找到当前元素的索引
+ const regular_index = list.findIndex(item => item.com_data.z_index == old_z_index);
+ if (regular_index + 1 <= diy_data.value.length - 1) {
+ // 取出上一个的值
+ const new_z_index = list[regular_index + 1].com_data.z_index;
+ // 替换原始数组中的值
+ const new_regular_index_1 = diy_data.value.findIndex(item => item.com_data.z_index == old_z_index);
+ const new_regular_index_2 = diy_data.value.findIndex(item => item.com_data.z_index == new_z_index);
+ // 数据互换
+ diy_data.value[new_regular_index_1].com_data.z_index = new_z_index;
+ diy_data.value[new_regular_index_2].com_data.z_index = old_z_index;
}
}
-};
+}
-const cancel_bottom_up = (index: number) => {
- if (typeof index === 'number' && !isNaN(index)) {
- if (!isEmpty(diy_data.value[index])) {
- diy_data.value[index].com_data.z_index = 0;
+//后置一层 - 1
+const underlying_layer = (index: number) => {
+ if (diy_data.value.length > 0) {
+ const old_z_index = cloneDeep(diy_data.value[index].com_data.z_index);
+ // 数据排序
+ const list = cloneDeep(diy_data.value).sort((a, b) => a.com_data.z_index - b.com_data.z_index);
+ // 找到当前元素的索引
+ const regular_index = list.findIndex(item => item.com_data.z_index == old_z_index);
+ if (regular_index - 1 >= 0) {
+ // 取出上一个的值
+ const new_z_index = list[regular_index - 1].com_data.z_index;
+ // 替换原始数组中的值
+ const new_regular_index_1 = diy_data.value.findIndex(item => item.com_data.z_index == old_z_index);
+ const new_regular_index_2 = diy_data.value.findIndex(item => item.com_data.z_index == new_z_index);
+ // 数据互换
+ diy_data.value[new_regular_index_1].com_data.z_index = new_z_index;
+ diy_data.value[new_regular_index_2].com_data.z_index = old_z_index;
}
}
-};
+}
+//组件置顶
+const top_up = (index: number) => {
+ if (!isEmpty(diy_data.value[index])) {
+ const new_z_index = top_z_index.value + 1;
+ diy_data.value[index].com_data.z_index = new_z_index;
+ top_z_index.value = new_z_index;
+ }
+}
+
+//组件置底
+const bottom_up = (index: number) => {
+ if (!isEmpty(diy_data.value[index])) {
+ const new_z_index = z_index.value - 1;
+ diy_data.value[index].com_data.z_index = new_z_index;
+ z_index.value = new_z_index;
+ }
+}
// 获取当前传递过来的index对应的diy_data中的数据
const get_diy_index_data = (index: number) => {
@@ -373,14 +398,17 @@ const center_height = defineModel('height', { type: Number, default: 0 });
const drag_area_height = computed(() => center_height.value + 'px');
const draggable_container = ref(true);
let data = reactive
([]);
+// 最低的层级
const z_index = ref(0);
+// 最高的层级
+const top_z_index = ref(0);
watch(() => center_height.value, () => {
data = diy_data.value;
// 从 DOM 中删除组件
draggable_container.value = false;
nextTick(() => {
// 在 DOM 中添加组件
- diy_data.value = data.map((item) => ({
+ diy_data.value = data.map((item, index) => ({
...item,
show_tabs: '0',
location: {
@@ -392,12 +420,26 @@ watch(() => center_height.value, () => {
},
com_data: {
...item.com_data,
+ z_index: typeof item.com_data.z_index === 'number' && !isNaN(item.com_data.z_index) ? item.com_data.z_index : 0,
com_height: item.com_data.staging_height,
},
}));
if (diy_data.value.length > 0) {
const list = diy_data.value.sort((a, b) => a.com_data.z_index - b.com_data.z_index);
- z_index.value = list[list.length - 1].com_data.z_index || 0;
+ // 将z-index重置为初始效果
+ let list_z_index = -1;
+ // 设置默认值
+ list.forEach((item) => {
+ if (item.com_data.z_index == 0) {
+ const new_z_index = list_z_index + 1;
+ item.com_data.z_index = new_z_index;
+ list_z_index = new_z_index;
+ }
+ });
+ // 获取更新后的数据
+ const new_list = list.sort((a, b) => a.com_data.z_index - b.com_data.z_index);
+ z_index.value = new_list[0].com_data.z_index || 0;
+ top_z_index.value = new_list[new_list.length - 1].com_data.z_index || 0;
}
// 容器高度变化时,组件不绑定右侧数据
emits('rightUpdate', {});
@@ -408,6 +450,7 @@ watch(() => center_height.value, () => {
//#region 左侧拖拽过来的处理
let draggedItem = ref({});
const dragStart = (item: any, event: any) => {
+ const new_z_index = top_z_index.value + 1;
// 初始化拖拽的数据
draggedItem.value = {
name: item.name,
@@ -418,8 +461,12 @@ const dragStart = (item: any, event: any) => {
id: get_math(),
key: item.key,
is_hot: '0',
- com_data: cloneDeep(item.com_data),
+ com_data: {
+ ...cloneDeep(item.com_data),
+ z_index: new_z_index,
+ },
};
+ top_z_index.value = new_z_index;
// 拖拽的时候清空热区
hot_list.data = [];
};
diff --git a/src/components/model-custom/components/right-side-operation/index.vue b/src/components/model-custom/components/right-side-operation/index.vue
new file mode 100644
index 00000000..03bbd88f
--- /dev/null
+++ b/src/components/model-custom/components/right-side-operation/index.vue
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/model-custom/model-custom-content.vue b/src/components/model-custom/model-custom-content.vue
index 1930bf73..b563f5c7 100644
--- a/src/components/model-custom/model-custom-content.vue
+++ b/src/components/model-custom/model-custom-content.vue
@@ -159,7 +159,9 @@ const accomplish = () => {
if (!draglist.value) {
return;
} else {
+ // 规整数据逻辑
const list = draglist.value.diy_data.sort((a, b) => a.com_data.z_index - b.com_data.z_index);
+ // 将z-index重置为初始效果
let z_index = 0;
if (list.length > 0) {
list.forEach((item) => {
@@ -170,7 +172,6 @@ const accomplish = () => {
}
});
}
- console.log(draglist.value.diy_data);
form.custom_list = draglist.value.diy_data;
}
form.height = center_height.value;