Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-editor
Commits
157e130b
Commit
157e130b
authored
May 26, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复
parent
ba4b3b75
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
157 additions
and
45 deletions
+157
-45
bottom.png
src/assets/bottom.png
+0
-0
center.png
src/assets/center.png
+0
-0
top.png
src/assets/top.png
+0
-0
zh-CN.json
src/locales/zh-CN.json
+42
-36
editor.js
src/store/modules/editor.js
+1
-1
project.js
src/store/modules/project.js
+15
-2
views.scss
src/themes/light/views.scss
+22
-0
Views.vue
src/views/Editor/Views.vue
+12
-6
SelectDesignModeDialog.vue
src/views/Editor/Views/SelectDesignModeDialog.vue
+65
-0
No files found.
src/assets/bottom.png
0 → 100644
View file @
157e130b
769 Bytes
src/assets/center.png
0 → 100644
View file @
157e130b
710 Bytes
src/assets/top.png
0 → 100644
View file @
157e130b
752 Bytes
src/locales/zh-CN.json
View file @
157e130b
...
...
@@ -2,8 +2,8 @@
"Alert"
:
"提示"
,
"Confirm"
:
"确认"
,
"Cancel"
:
"取消"
,
"Yes"
:
"是"
,
"No"
:
"否"
,
"Yes"
:
"是"
,
"No"
:
"否"
,
"Close"
:
"关闭"
,
"Refresh"
:
"刷新"
,
"Still Close"
:
"直接关闭"
,
...
...
@@ -18,8 +18,8 @@
"Remark"
:
"备注"
,
"Assets"
:
"素材"
,
"Version"
:
"版本"
,
"Paste same level"
:
"粘贴(同级)"
,
"Paste child"
:
"粘贴(子级)"
,
"Paste same level"
:
"粘贴(同级)"
,
"Paste child"
:
"粘贴(子级)"
,
"Exit"
:
"退出"
,
"Apply"
:
"应用"
,
"Props"
:
"属性"
,
...
...
@@ -257,6 +257,7 @@
"Save behavior successfully"
:
"保存行为成功"
,
"The main editor is closed and cannot be saved"
:
"主编辑器已关闭,无法保存"
,
"A behavior is being edited. Please save it first"
:
"有行为正在编辑,请先保存"
,
"Design cut mode"
:
"设计稿裁剪模式"
,
"eventGroup"
:
{
"in"
:
"接收"
,
"out"
:
"派发"
...
...
@@ -456,5 +457,10 @@
"key"
:
"id"
,
"name"
:
"name"
}
},
"designCutModes"
:
{
"top"
:
"顶部裁剪"
,
"center"
:
"上下裁剪"
,
"bottom"
:
"底部裁剪"
}
}
\ No newline at end of file
src/store/modules/editor.js
View file @
157e130b
...
...
@@ -17,7 +17,7 @@ export const editorStore = {
state
:
{
initialized
:
false
,
name
:
'Zeroing Editor'
,
version
:
'0.
2.1
'
,
version
:
'0.
3.0
'
,
templates
:
{
builtin
:
[
'blank'
],
custom
:
[],
...
...
src/store/modules/project.js
View file @
157e130b
...
...
@@ -29,6 +29,7 @@ import {uploadFiles} from "./editor";
const
storeName
=
'project'
;
const
psStoreName
=
'pack-history'
;
const
offsetAll
=
172
;
const
defaultOptions
=
{
behaviorEditor
:
'builtin'
,
...
...
@@ -898,8 +899,20 @@ export const projectStore = {
scripts
:
_scripts
})
},
async
importPsd
({
commit
},
{
file
,
action
})
{
const
result
=
await
toZeroing
(
file
,
{
offset
:
{
y
:
172
}});
async
importPsd
({
commit
},
{
file
,
action
,
mode
})
{
let
offset
=
{};
switch
(
mode
){
case
'top'
:
offset
.
y
=
offsetAll
;
break
;
case
'center'
:
offset
.
y
=
offsetAll
/
2
;
break
;
case
'bottom'
:
break
;
}
const
result
=
await
toZeroing
(
file
,
{
offset
});
let
viewFile
=
new
File
([
result
],
'view.json'
);
const
{
view
,
assets
}
=
await
editorApi
.
uploadView
(
viewFile
);
switch
(
action
)
{
...
...
src/themes/light/views.scss
View file @
157e130b
...
...
@@ -56,3 +56,25 @@
}
}
}
.select-design-mode-dialog
{
.wrapper
{
display
:
flex
;
justify-content
:
space-around
;
padding
:
10px
;
.item
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
padding
:
10px
;
border-radius
:
10px
;
border
:
2px
solid
transparent
;
}
.item.selected
{
border-color
:
$--color-primary
;
}
}
}
\ No newline at end of file
src/views/Editor/Views.vue
View file @
157e130b
...
...
@@ -3,7 +3,7 @@
<div
class=
"container"
>
<div
class=
"header-bar"
>
<el-link
class=
"menu-item"
@
click=
"toAddView"
>
{{
$t
(
'Add'
)
}}
</el-link>
<el-link
@
click=
"
toImport(0
)"
>
{{
$t
(
'Import'
)
}}
</el-link>
<el-link
@
click=
"
onImportCommand('single'
)"
>
{{
$t
(
'Import'
)
}}
</el-link>
<el-dropdown
trigger=
"hover"
placement=
"top"
size=
"mini"
@
command=
"onImportCommand"
>
<el-link
icon=
"el-icon-arrow-down"
:underline=
"false"
></el-link>
<el-dropdown-menu
slot=
"dropdown"
>
...
...
@@ -69,6 +69,7 @@
</el-tree>
</el-scrollbar>
</div>
<select-design-mode-dialog
ref=
"selectDesignModeDialog"
@
change=
"onSelectDesignMode"
/>
</pane>
</
template
>
...
...
@@ -77,10 +78,11 @@
import
Pane
from
'../../components/Pane'
;
import
{
selectFile
}
from
"../../utils"
;
import
events
from
"../../global-events"
;
import
SelectDesignModeDialog
from
"./Views/SelectDesignModeDialog"
;
export
default
{
name
:
'Views'
,
components
:
{
Pane
},
components
:
{
SelectDesignModeDialog
,
Pane
},
data
()
{
return
{
filterText
:
''
,
...
...
@@ -239,22 +241,26 @@
.
catch
(()
=>
{
});
},
toImport
(
action
)
{
toImport
(
action
,
mode
)
{
selectFile
(
async
files
=>
{
events
.
$emit
(
'upload-indicator'
,
true
);
try
{
await
this
.
importPsd
({
file
:
files
[
0
],
action
,
mode
,
});
}
catch
(
e
)
{
}
events
.
$emit
(
'upload-indicator'
,
false
);
})
},
onImportCommand
(
command
)
{
onImportCommand
(
importType
)
{
this
.
$refs
.
selectDesignModeDialog
.
show
(
importType
);
},
onSelectDesignMode
(
mode
,
importType
){
let
action
;
switch
(
command
)
{
switch
(
importType
)
{
case
'single'
:
action
=
0
;
break
;
...
...
@@ -262,7 +268,7 @@
action
=
1
;
break
;
}
this
.
toImport
(
action
);
this
.
toImport
(
action
,
mode
);
},
onMoreMenu
(
command
,
data
,
node
)
{
switch
(
command
)
{
...
...
src/views/Editor/Views/SelectDesignModeDialog.vue
0 → 100644
View file @
157e130b
<
template
>
<el-dialog
:title=
"$t('Design cut mode')"
:visible
.
sync=
"visible"
@
opened=
"onOpen"
:append-to-body=
"true"
custom-class=
"select-design-mode-dialog"
>
<div
class=
"wrapper"
>
<div
v-for=
"(modeName, mode, index) in designCutModes"
:key=
"index"
@
click=
"selectCutMode(mode)"
class=
"item"
:class=
"
{selected: designCutMode === mode}">
{{
modeName
}}
<img
:src=
"images[index]"
>
</div>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div></div>
<div>
<el-button
size=
"mini"
@
click=
"onClose"
>
{{
$t
(
'Close'
)
}}
</el-button>
<el-button
size=
"mini"
@
click=
"onConfirm"
type=
"primary"
>
{{
$t
(
'Confirm'
)
}}
</el-button>
</div>
</div>
</el-dialog>
</
template
>
<
script
>
export
default
{
name
:
"SelectDesignModeDialog"
,
components
:
{},
data
()
{
const
designCutModes
=
this
.
$t
(
'designCutModes'
);
let
images
=
[];
let
designCutModeKeys
=
Object
.
keys
(
designCutModes
);
for
(
let
designCutModeKey
of
designCutModeKeys
)
{
images
.
push
(
require
(
`@/assets/
${
designCutModeKey
}
.png`
))
}
return
{
visible
:
false
,
designCutMode
:
'top'
,
designCutModes
,
images
,
}
},
methods
:
{
show
(
importType
)
{
this
.
importType
=
importType
;
this
.
visible
=
true
;
},
onConfirm
()
{
this
.
$emit
(
'change'
,
this
.
designCutMode
,
this
.
importType
);
this
.
visible
=
false
;
},
onClose
()
{
this
.
visible
=
false
;
},
onOpen
()
{
},
selectCutMode
(
mode
){
this
.
designCutMode
=
mode
;
}
}
}
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment