Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
afbad86b
提交
afbad86b
authored
8月 03, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:仪表板样式修改保存按钮还是灰的问题
上级
a48ee015
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
173 行增加
和
0 行删除
+173
-0
DragShadow.vue
frontend/src/components/DeDrag/DragShadow.vue
+172
-0
index.vue
frontend/src/components/canvas/components/Editor/index.vue
+1
-0
没有找到文件。
frontend/src/components/DeDrag/DragShadow.vue
0 → 100644
浏览文件 @
afbad86b
<
template
>
<div
class=
"home"
>
<Toolbar
/>
<main>
<!-- 左侧组件列表 -->
<!--
<section
class=
"left"
>
-->
<!--
<ComponentList
/>
-->
<!--
</section>
-->
<!-- 中间画布 -->
<section
class=
"center"
>
<div
class=
"content"
@
drop=
"handleDrop"
@
dragover=
"handleDragOver"
@
mousedown=
"handleMouseDown"
@
mouseup=
"deselectCurComponent"
>
<Editor
/>
</div>
</section>
</main>
</div>
</
template
>
<
script
>
import
Editor
from
'@/components/Editor/index'
import
ComponentList
from
'@/components/ComponentList'
// 左侧列表组件
import
AttrList
from
'@/components/canvas/components/AttrList'
// 右侧属性列表
import
AnimationList
from
'@/components/canvas/components/AnimationList'
// 右侧动画列表
import
EventList
from
'@/components/canvas/components/EventList'
// 右侧事件列表
import
componentList
from
'@/components/canvas/custom-component/component-list'
// 左侧列表数据
import
Toolbar
from
'@/components/Toolbar'
import
{
deepCopy
}
from
'@/utils/utils'
import
{
mapState
}
from
'vuex'
import
generateID
from
'@/utils/generateID'
import
{
listenGlobalKeyDown
}
from
'@/utils/shortcutKey'
export
default
{
// eslint-disable-next-line vue/no-unused-components
components
:
{
Editor
,
ComponentList
,
AttrList
,
AnimationList
,
EventList
,
Toolbar
},
data
()
{
return
{
activeName
:
'attr'
,
reSelectAnimateIndex
:
undefined
}
},
computed
:
mapState
([
'componentData'
,
'curComponent'
,
'isClickComponent'
,
'canvasStyleData'
]),
created
()
{
this
.
restore
()
// 全局监听按键事件
listenGlobalKeyDown
()
},
methods
:
{
restore
()
{
// 用保存的数据恢复画布
if
(
localStorage
.
getItem
(
'canvasData'
))
{
this
.
$store
.
commit
(
'setComponentData'
,
this
.
resetID
(
JSON
.
parse
(
localStorage
.
getItem
(
'canvasData'
))))
}
if
(
localStorage
.
getItem
(
'canvasStyle'
))
{
this
.
$store
.
commit
(
'setCanvasStyle'
,
JSON
.
parse
(
localStorage
.
getItem
(
'canvasStyle'
)))
}
},
resetID
(
data
)
{
if
(
data
)
{
data
.
forEach
(
item
=>
{
// eslint-disable-next-line no-undef
item
.
type
!==
'custom'
&&
(
item
.
id
=
uuid
.
v1
())
})
}
return
data
},
handleDrop
(
e
)
{
e
.
preventDefault
()
e
.
stopPropagation
()
let
component
const
id
=
e
.
dataTransfer
.
getData
(
'componentId'
)
componentList
.
forEach
(
componentTemp
=>
{
if
(
id
===
componentTemp
.
id
)
{
component
=
deepCopy
(
componentTemp
)
}
})
// const component = deepCopy(componentList[e.dataTransfer.getData('index')])
component
.
style
.
top
=
e
.
offsetY
component
.
style
.
left
=
e
.
offsetX
component
.
id
=
generateID
()
this
.
$store
.
commit
(
'addComponent'
,
{
component
})
this
.
$store
.
commit
(
'recordSnapshot'
)
},
handleDragOver
(
e
)
{
e
.
preventDefault
()
e
.
dataTransfer
.
dropEffect
=
'copy'
},
handleMouseDown
()
{
this
.
$store
.
commit
(
'setClickComponentStatus'
,
false
)
},
deselectCurComponent
(
e
)
{
if
(
!
this
.
isClickComponent
)
{
this
.
$store
.
commit
(
'setCurComponent'
,
{
component
:
null
,
index
:
null
})
}
// 0 左击 1 滚轮 2 右击
if
(
e
.
button
!==
2
)
{
this
.
$store
.
commit
(
'hideContextMenu'
)
}
}
}
}
</
script
>
<
style
lang=
"scss"
>
.home
{
height
:
100vh
;
background
:
#fff
;
main
{
height
:
calc
(
100%
-
64px
);
position
:
relative
;
.left
{
position
:
absolute
;
height
:
100%
;
width
:
200px
;
left
:
0
;
top
:
0
;
padding-top
:
10px
;
}
.right
{
position
:
absolute
;
height
:
100%
;
width
:
262px
;
right
:
0
;
top
:
0
;
}
.center
{
margin-left
:
200px
;
margin-right
:
262px
;
background
:
#f5f5f5
;
height
:
100%
;
overflow
:
auto
;
padding
:
20px
;
.content
{
width
:
100%
;
height
:
100%
;
overflow
:
auto
;
}
}
}
.placeholder
{
text-align
:
center
;
color
:
#333
;
}
}
</
style
>
frontend/src/components/canvas/components/Editor/index.vue
浏览文件 @
afbad86b
...
...
@@ -275,6 +275,7 @@ export default {
// 第一次变化 不需要 重置边界 待改进
if
(
this
.
changeIndex
++
>
0
)
{
this
.
resizeParentBounds
()
this
.
$store
.
state
.
styleChangeTimes
++
}
// this.changeScale()
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论