|
@@ -22,7 +22,7 @@
|
|
|
<span class="item_head_label">重做</span>
|
|
|
</button>
|
|
|
<button class="item_head_btn" :class="!clearFlag ? 'btn_Void' : 'btn_CDK'" :disabled="!clearFlag"
|
|
|
- @click="operationalView('clear')">
|
|
|
+ @click.stop="operationalView('clear')">
|
|
|
<span class="iconfont icon_btn_head icon-qingchu"></span>
|
|
|
<span class="item_head_label">清除</span>
|
|
|
</button>
|
|
@@ -51,10 +51,27 @@
|
|
|
<div class="part">
|
|
|
<!-- 左侧 -->
|
|
|
<div class="panel_left">
|
|
|
+ <div class="left_tabs_switch">
|
|
|
+ <div class="card_tabs_view center_in" :class="tabsType == 'module' ? 'tabs_active' : ''"
|
|
|
+ @click="getTabs('module')">
|
|
|
+ <el-icon size="30" :color="tabsType == 'module' ? '#409EFF' : '#606266'">
|
|
|
+ <Platform />
|
|
|
+ </el-icon>
|
|
|
+ <span>组件</span>
|
|
|
+ </div>
|
|
|
+ <div class="card_tabs_view center_in" :class="tabsType == 'page' ? 'tabs_active' : ''" @click="getTabs('page')">
|
|
|
+ <el-icon size="30" :color="tabsType == 'page' ? '#409EFF' : '#606266'">
|
|
|
+ <Platform />
|
|
|
+ </el-icon>
|
|
|
+ <span>页面</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="left_paneLeft">
|
|
|
<div class="pane_tabs">
|
|
|
<el-tabs v-model="activeName" stretch class="demo-tabs" @tab-click="handleClick">
|
|
|
- <el-tab-pane label="常用推荐" name="stock"></el-tab-pane>
|
|
|
+ <el-tab-pane label="常用推荐" name="stock">
|
|
|
+ <div>214</div>
|
|
|
+ </el-tab-pane>
|
|
|
<el-tab-pane label="组件库" name="bank">
|
|
|
<module-library :current="current" @send-data="handleReceivedData"></module-library>
|
|
|
</el-tab-pane>
|
|
@@ -90,7 +107,7 @@
|
|
|
<template #item="{ element, index }">
|
|
|
<div class="item_module_center move">
|
|
|
<VueDrag :index="index" :dargData="element" @passId="getId" @modifiedItem="modifiedItem"
|
|
|
- @inactivation="inactivation"></VueDrag>
|
|
|
+ @inactivation="inactivation" @clickHandler="clickHandler"></VueDrag>
|
|
|
</div>
|
|
|
</template>
|
|
|
</draggable>
|
|
@@ -117,13 +134,24 @@
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
<div class="line_divider"></div>
|
|
|
- <div class="icon_item_align" :class="activate ? 'active_icon' : 'icon_item_gray'">
|
|
|
- <el-tooltip class="box-item" content="锁定" placement="left" effect="light">
|
|
|
+ <div class="icon_item_align"
|
|
|
+ :class="[activate1 ? 'active_icon' : 'icon_item_gray', activateLock ? 'active_lock' : '']"
|
|
|
+ @click="dragLock">
|
|
|
+ <el-tooltip class="box-item" :content="activateLock ? '取消锁定' : '锁定'" placement="left" effect="light">
|
|
|
<span class="iconfont icon_alignment icon-suoding"></span>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
+ <div class="line_divider"></div>
|
|
|
+ <div class="icon_item_align" :class="activate ? 'active_icon' : 'icon_item_gray'" @click="dragDel">
|
|
|
+ <el-tooltip class="box-item" content="删除" placement="left" effect="light">
|
|
|
+ <el-icon size="24" color="#F56C6C">
|
|
|
+ <DeleteFilled />
|
|
|
+ </el-icon>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="right_forbid" v-if="activateLock"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -152,7 +180,8 @@ import { baseComponent, attributeValue, layout } from '../module/index';
|
|
|
import { ref, computed } from "vue";
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { ElMessageBox } from 'element-plus'
|
|
|
-
|
|
|
+//module、page、切换组件页面
|
|
|
+const tabsType = ref('module')
|
|
|
// 图标弹窗
|
|
|
const drawer = ref(false)
|
|
|
// const tabPosition = ref<string>('style');
|
|
@@ -170,10 +199,45 @@ const extraImgs1: any = ref([]);
|
|
|
const undoStack: any = ref([]);
|
|
|
// 恢复操作的栈
|
|
|
const redoStack: any = ref([]);
|
|
|
-// 对齐方式状态
|
|
|
-const activate: any = ref(true);
|
|
|
// 操作组件
|
|
|
const currentMove: any = ref({})
|
|
|
+// 对齐方式状态
|
|
|
+const activeFlag: any = ref(false)
|
|
|
+const activate = computed(() => {
|
|
|
+ if (currentMove.value.active) {
|
|
|
+ activeFlag.value = true
|
|
|
+ if (currentMove.value.config.lock) {
|
|
|
+ activeFlag.value = false
|
|
|
+ } else {
|
|
|
+ activeFlag.value = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ activeFlag.value = false
|
|
|
+ }
|
|
|
+ return activeFlag.value
|
|
|
+});
|
|
|
+const activeFlag1: any = ref(false)
|
|
|
+const activate1 = computed(() => {
|
|
|
+ if (currentMove.value.active) {
|
|
|
+ activeFlag1.value = true
|
|
|
+ } else {
|
|
|
+ activeFlag1.value = false
|
|
|
+ }
|
|
|
+ return activeFlag1.value
|
|
|
+});
|
|
|
+const lockFlag: any = ref(false)
|
|
|
+const activateLock = computed(() => {
|
|
|
+ if (currentMove.value.config) {
|
|
|
+ if (currentMove.value.config.lock) {
|
|
|
+ lockFlag.value = true
|
|
|
+ } else {
|
|
|
+ lockFlag.value = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ lockFlag.value = false
|
|
|
+ }
|
|
|
+ return lockFlag.value
|
|
|
+});
|
|
|
// 克隆组件
|
|
|
const cloneItem: any = ref({})
|
|
|
// 撤销
|
|
@@ -188,6 +252,9 @@ const canRedo = computed(() => {
|
|
|
const clearFlag = computed(() => {
|
|
|
return extraImgs1.value.length > 0
|
|
|
})
|
|
|
+// 激活项索引
|
|
|
+const currentIndex: any = ref(null)
|
|
|
+const currentSoleId: any = ref(null)
|
|
|
// 切换图标tabs项
|
|
|
const iconName: any = ref('mine')
|
|
|
const iconList: any = [{
|
|
@@ -221,12 +288,18 @@ const onStart = () => {
|
|
|
const onEnd = (value) => {
|
|
|
if (value.originalEvent.cancelable && value.to.className == 'Bzuil') {
|
|
|
const num = (375 / 2) - (cloneItem.value.css.width / 2)
|
|
|
- cloneItem.value.css.left = num
|
|
|
+ cloneItem.value.css.left = Math.round(num)
|
|
|
cloneItem.value.css.top = value.originalEvent.offsetY
|
|
|
cloneItem.value.active = true
|
|
|
const arr = JSON.parse(JSON.stringify(cloneItem.value))
|
|
|
|
|
|
extraImgs1.value.push(arr)
|
|
|
+ extraImgs1.value.forEach((item, index) => {
|
|
|
+ if (item.soleId == arr.soleId) {
|
|
|
+ currentIndex.value = index
|
|
|
+ currentSoleId.value = item.soleId
|
|
|
+ }
|
|
|
+ })
|
|
|
currentMove.value = arr
|
|
|
|
|
|
undoStack.value.push({ type: 'add', item: arr })
|
|
@@ -261,6 +334,10 @@ const handleReceivedData = (num: any) => {
|
|
|
}
|
|
|
componentLibrary.value = JSON.parse(JSON.stringify(extraImgs.value))
|
|
|
}
|
|
|
+// 切换组件页面
|
|
|
+function getTabs(params: any) {
|
|
|
+ tabsType.value = params
|
|
|
+}
|
|
|
// 切换tabs
|
|
|
function handleClick(): void {
|
|
|
console.log(24);
|
|
@@ -331,10 +408,7 @@ function announce() {
|
|
|
function preview() {
|
|
|
console.log(extraImgs1.value, '预览');
|
|
|
}
|
|
|
-
|
|
|
// 激活项索引
|
|
|
-const currentIndex: any = ref(null)
|
|
|
-const currentSoleId: any = ref(null)
|
|
|
function getId(params: any) {
|
|
|
// 激活项索引处理对齐方式
|
|
|
currentIndex.value = params.index
|
|
@@ -342,6 +416,14 @@ function getId(params: any) {
|
|
|
// 切换组件修改样式
|
|
|
currentMove.value = params.option
|
|
|
}
|
|
|
+// 点击激活
|
|
|
+function clickHandler(params: any) {
|
|
|
+ // 激活项索引处理对齐方式
|
|
|
+ currentIndex.value = params.index
|
|
|
+ currentSoleId.value = params.soleId
|
|
|
+ // 切换组件修改样式
|
|
|
+ currentMove.value = params.option
|
|
|
+}
|
|
|
// 失去活跃状态
|
|
|
function inactivation(params: any) {
|
|
|
if (currentMove.value.soleId == params.soleId) {
|
|
@@ -368,26 +450,49 @@ function modifiedItem(params: any) {
|
|
|
}
|
|
|
// 对齐方式按钮触发
|
|
|
function alignment(params: any) {
|
|
|
- if (currentIndex.value != null) {
|
|
|
- if (params.type == 'left') {
|
|
|
- extraImgs1.value[currentIndex.value].css.left = 0
|
|
|
- } else if (params.type == 'centerHorizontally') {
|
|
|
- const num = (375 / 2) - (extraImgs1.value[currentIndex.value].css.width / 2)
|
|
|
- extraImgs1.value[currentIndex.value].css.left = num
|
|
|
- } else if (params.type == 'right') {
|
|
|
- const num = 375 - extraImgs1.value[currentIndex.value].css.width
|
|
|
- extraImgs1.value[currentIndex.value].css.left = num
|
|
|
- } else if (params.type == 'top') {
|
|
|
- extraImgs1.value[currentIndex.value].css.top = 20
|
|
|
- } else if (params.type == 'verticalCenter') {
|
|
|
- const num = (667 / 2) - (extraImgs1.value[currentIndex.value].css.height / 2)
|
|
|
- extraImgs1.value[currentIndex.value].css.top = num
|
|
|
- } else if (params.type == 'bottom') {
|
|
|
- const num = 667 - extraImgs1.value[currentIndex.value].css.height
|
|
|
- extraImgs1.value[currentIndex.value].css.top = num
|
|
|
+ if (currentMove.value.active && !currentMove.value.config.lock) {
|
|
|
+ if (currentIndex.value != null) {
|
|
|
+ if (params.type == 'left') {
|
|
|
+ extraImgs1.value[currentIndex.value].css.left = 0
|
|
|
+ } else if (params.type == 'centerHorizontally') {
|
|
|
+ // 水平居中
|
|
|
+ const num = (375 / 2) - (extraImgs1.value[currentIndex.value].css.width / 2)
|
|
|
+ extraImgs1.value[currentIndex.value].css.left = Math.round(num)
|
|
|
+ } else if (params.type == 'right') {
|
|
|
+ const num = 375 - extraImgs1.value[currentIndex.value].css.width
|
|
|
+ extraImgs1.value[currentIndex.value].css.left = Math.round(num)
|
|
|
+ } else if (params.type == 'top') {
|
|
|
+ extraImgs1.value[currentIndex.value].css.top = 0
|
|
|
+ } else if (params.type == 'verticalCenter') {
|
|
|
+ // 垂直居中
|
|
|
+ const num = (647 / 2) - (extraImgs1.value[currentIndex.value].css.height / 2)
|
|
|
+ extraImgs1.value[currentIndex.value].css.top = Math.round(num)
|
|
|
+ } else if (params.type == 'bottom') {
|
|
|
+ const num = 647 - extraImgs1.value[currentIndex.value].css.height
|
|
|
+ extraImgs1.value[currentIndex.value].css.top = Math.round(num)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+// 组件拖拽锁定
|
|
|
+function dragLock() {
|
|
|
+ if (currentMove.value.active) {
|
|
|
+ if (currentMove.value.config.lock) {
|
|
|
+ currentMove.value.config.lock = false
|
|
|
+ } else {
|
|
|
+ currentMove.value.config.lock = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+// 删除选中组件
|
|
|
+function dragDel() {
|
|
|
+ if (currentMove.value.active && !currentMove.value.config.lock) {
|
|
|
+ const index = extraImgs1.value.findIndex((item) => item.soleId === currentMove.value.soleId);
|
|
|
+ if (index > -1) {
|
|
|
+ extraImgs1.value.splice(index, 1);
|
|
|
+ currentMove.value = {}
|
|
|
}
|
|
|
}
|
|
|
- console.log(extraImgs1.value, 5);
|
|
|
}
|
|
|
// 切换图片选择图标抽屉
|
|
|
function childEvent() {
|
|
@@ -399,7 +504,6 @@ function toggleIcon(params: any) {
|
|
|
}
|
|
|
// 选择图标
|
|
|
function getIconSelection(params: any) {
|
|
|
- console.log(params, currentMove, 222);
|
|
|
drawer.value = false
|
|
|
currentMove.value.config.img = params.icon
|
|
|
}
|
|
@@ -548,7 +652,36 @@ function getIconSelection(params: any) {
|
|
|
.panel_left {
|
|
|
position: absolute;
|
|
|
height: 100%;
|
|
|
- width: 380px;
|
|
|
+ display: flex;
|
|
|
+ // width: 380px;
|
|
|
+}
|
|
|
+
|
|
|
+.left_tabs_switch {
|
|
|
+ width: 68px;
|
|
|
+ z-index: 1;
|
|
|
+}
|
|
|
+
|
|
|
+.card_tabs_view {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ flex: 1;
|
|
|
+ height: 80px;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ span {
|
|
|
+ font-size: 14px;
|
|
|
+ margin-top: 5px;
|
|
|
+ color: #606266;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.tabs_active {
|
|
|
+ background-color: #fff;
|
|
|
+
|
|
|
+ span {
|
|
|
+ color: #409EFF;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.left_paneLeft {
|
|
@@ -581,7 +714,7 @@ function getIconSelection(params: any) {
|
|
|
.left_paneRight {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- position: absolute;
|
|
|
+ // position: absolute;
|
|
|
top: 0px;
|
|
|
width: calc(220px - 20px);
|
|
|
height: 100%;
|
|
@@ -695,6 +828,16 @@ function getIconSelection(params: any) {
|
|
|
position: absolute !important;
|
|
|
}
|
|
|
|
|
|
+.right_forbid {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 2;
|
|
|
+ background: rgb(255, 255, 255);
|
|
|
+ opacity: 0.3;
|
|
|
+ cursor: not-allowed;
|
|
|
+}
|
|
|
+
|
|
|
.card_maskedbox {
|
|
|
padding: 20px 14px 25px;
|
|
|
overflow: hidden overlay;
|
|
@@ -730,6 +873,10 @@ function getIconSelection(params: any) {
|
|
|
color: #409EFF;
|
|
|
}
|
|
|
|
|
|
+.active_lock .icon_alignment {
|
|
|
+ color: #409EFF;
|
|
|
+}
|
|
|
+
|
|
|
.icon_item_gray {
|
|
|
opacity: 0.3;
|
|
|
-webkit-user-select: none;
|
|
@@ -769,7 +916,6 @@ function getIconSelection(params: any) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
img {
|
|
|
width: 85px;
|
|
|
height: 85px;
|
|
@@ -787,9 +933,9 @@ img {
|
|
|
}
|
|
|
|
|
|
.Bzu {
|
|
|
- height: 100%;
|
|
|
+ height: calc(100% - 20px);
|
|
|
position: absolute;
|
|
|
- top: 0;
|
|
|
+ top: 20px;
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|