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
1dc2e5de
Commit
1dc2e5de
authored
Sep 24, 2019
by
张晨辰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: merge
parent
d64a4c0f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
67 deletions
+135
-67
config.js
src/config.js
+4
-0
en.json
src/locales/en.json
+2
-0
zh-CN.json
src/locales/zh-CN.json
+15
-1
project.js
src/store/modules/project.js
+21
-2
assets.scss
src/themes/light/assets.scss
+1
-1
Editor.vue
src/views/Editor.vue
+91
-62
FileItem.vue
src/views/Editor/Assets/FileItem.vue
+1
-1
No files found.
src/config.js
View file @
1dc2e5de
...
...
@@ -3,7 +3,11 @@
*/
export
const
API_HOST
=
'http://10.10.94.31:7777'
;
<<<<<<<
Updated
upstream
//export const API_HOST = 'http://localhost:3002';
=======
// export const API_HOST = 'http://localhost:3002';
>>>>>>>
Stashed
changes
export
const
ASSETS_BASE
=
'http://0.0.0.0:4002/assets'
;
//文件类型图标 t表示展示缩略图
...
...
src/locales/en.json
View file @
1dc2e5de
...
...
@@ -30,6 +30,8 @@
"Failed to delete project"
:
"Failed to delete project"
,
"Failed to get project"
:
"Failed to get project"
,
"Failed to save project"
:
"Failed to save project"
,
"Confirm to exit the editor"
:
"Confirm to exit the editor?"
,
"Confirm to publish"
:
"Confirm to publish?"
,
"menu"
:
{
"save"
:
"Save"
,
"details"
:
"Details"
,
...
...
src/locales/zh-CN.json
View file @
1dc2e5de
...
...
@@ -24,5 +24,19 @@
"Failed to duplicate project"
:
"复制项目失败"
,
"Failed to delete project"
:
"删除项目失败"
,
"Failed to get project"
:
"获取项目失败"
,
"Failed to save project"
:
"保存项目失败"
"Failed to save project"
:
"保存项目失败"
,
"menu"
:
{
"save"
:
"保存"
,
"details"
:
"详情"
,
"preview"
:
"预览"
,
"publish"
:
"发布"
,
"data-mapping"
:
"数据映射"
,
"exit"
:
"退出"
},
"panes"
:
{
"Assets"
:
"素材"
,
"Inspector"
:
"属性"
,
"Playground"
:
"编辑"
,
"Views"
:
"视图"
}
}
\ No newline at end of file
src/store/modules/project.js
View file @
1dc2e5de
...
...
@@ -2,7 +2,7 @@
* Created by rockyl on 2019-09-19.
*/
import
{
projectApi
}
from
"../../api"
;
import
{
projectApi
}
from
"../../api"
;
export
const
projectStore
=
{
state
:
{
...
...
@@ -10,7 +10,7 @@ export const projectStore = {
name
:
''
,
creator
:
''
,
data
:
{
views
:
[],
views
:
[
{
name
:
'body'
,
children
:
[]
}
],
assets
:
[],
dataMapping
:
[],
}
...
...
@@ -37,11 +37,30 @@ export const projectStore = {
}
},
createView
(
state
)
{
state
.
data
.
views
.
push
({
name
:
'未命名'
,
children
:
[]
})
console
.
log
(
state
.
data
.
views
);
}
},
getters
:
{
views
:
state
=>
{
return
state
.
views
}
},
actions
:
{
async
updateProject
({
commit
},
projectID
)
{
const
project
=
await
projectApi
.
getData
(
projectID
);
commit
(
'updateProject'
,
project
);
},
/**
* 新建视图
*/
async
createView
({
commit
})
{
commit
(
'createView'
);
}
},
};
src/themes/light/assets.scss
View file @
1dc2e5de
...
...
@@ -26,7 +26,7 @@
flex-wrap
:
wrap
;
.file-item
{
padding
:
5px
5px
0
;
padding
:
5px
;
color
:
$--color-text-regular
;
.icon
{
...
...
src/views/Editor.vue
View file @
1dc2e5de
...
...
@@ -17,70 +17,99 @@
</
template
>
<
script
>
import
{
mapState
,
mapActions
}
from
'vuex'
import
SplitPanes
from
'splitpanes'
import
ToolBar
from
"./Editor/ToolBar"
;
import
Inspector
from
"./Editor/Inspector"
;
import
Views
from
"./Editor/Views"
;
import
Playground
from
"./Editor/Playground"
;
import
Assets
from
"./Editor/Assets"
;
import
ProjectDetailsDialog
from
"./Editor/dialogs/ProjectDetailsDialog"
;
import
DataMappingDialog
from
"./Editor/dialogs/DataMappingDialog"
;
import
{
playWaiting
}
from
"../utils"
;
import
{
mapState
,
mapActions
}
from
'vuex'
;
import
SplitPanes
from
'splitpanes'
;
import
ToolBar
from
'./Editor/ToolBar'
;
import
Inspector
from
'./Editor/Inspector'
;
import
Views
from
'./Editor/Views'
;
import
Playground
from
'./Editor/Playground'
;
import
Assets
from
'./Editor/Assets'
;
import
ProjectDetailsDialog
from
'./Editor/dialogs/ProjectDetailsDialog'
;
import
DataMappingDialog
from
'./Editor/dialogs/DataMappingDialog'
;
import
{
playWaiting
}
from
'../utils'
;
export
default
{
name
:
'Editor'
,
components
:
{
DataMappingDialog
,
ProjectDetailsDialog
,
Assets
,
Playground
,
Views
,
Inspector
,
ToolBar
,
SplitPanes
,
},
data
()
{
const
panesConfig
=
localStorage
.
panesConfig
?
JSON
.
parse
(
localStorage
.
panesConfig
)
:
[
0.8
,
0.8
,
0.3
];
return
{
panesConfig
,
}
},
mounted
()
{
const
{
projectID
}
=
this
.
$route
.
params
;
if
(
projectID
){
playWaiting
(
this
.
updateProject
(
projectID
),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{});
}
else
{
this
.
$router
.
push
({
name
:
'home'
})
}
},
methods
:
{
getSize
(
id
,
side
)
{
let
ratio
=
this
.
panesConfig
[
id
];
return
(
side
===
0
?
ratio
:
1
-
ratio
)
*
100
},
onPanesReSized
(
id
,
configs
)
{
this
.
panesConfig
[
id
]
=
configs
[
0
].
width
/
100
;
localStorage
.
panesConfig
=
JSON
.
stringify
(
this
.
panesConfig
);
},
clickMenu
(
menuItem
){
console
.
log
(
menuItem
);
switch
(
menuItem
){
case
'details'
:
this
.
$refs
.
projectDialogsDialog
.
show
();
break
;
case
'data-mapping'
:
this
.
$refs
.
dataMappingDialog
.
show
();
break
;
}
},
...
mapActions
([
'updateProject'
])
}
}
export
default
{
name
:
'Editor'
,
components
:
{
DataMappingDialog
,
ProjectDetailsDialog
,
Assets
,
Playground
,
Views
,
Inspector
,
ToolBar
,
SplitPanes
},
data
()
{
const
panesConfig
=
localStorage
.
panesConfig
?
JSON
.
parse
(
localStorage
.
panesConfig
)
:
[
0.8
,
0.8
,
0.3
];
return
{
panesConfig
};
},
mounted
()
{
const
{
projectID
}
=
this
.
$route
.
params
;
if
(
projectID
)
{
playWaiting
(
this
.
updateProject
(
projectID
),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{});
}
else
{
this
.
$router
.
push
({
name
:
'home'
});
}
},
methods
:
{
getSize
(
id
,
side
)
{
let
ratio
=
this
.
panesConfig
[
id
];
return
(
side
===
0
?
ratio
:
1
-
ratio
)
*
100
;
},
onPanesReSized
(
id
,
configs
)
{
this
.
panesConfig
[
id
]
=
configs
[
0
].
width
/
100
;
localStorage
.
panesConfig
=
JSON
.
stringify
(
this
.
panesConfig
);
},
clickMenu
(
menuItem
)
{
console
.
log
(
menuItem
);
switch
(
menuItem
)
{
case
'details'
:
this
.
$refs
.
projectDialogsDialog
.
show
();
break
;
case
'data-mapping'
:
this
.
$refs
.
dataMappingDialog
.
show
();
break
;
case
'exit'
:
this
,
exitConfirm
();
break
;
case
'publish'
:
this
.
publishConfirm
();
break
;
}
},
/**
* 退出
*/
async
exitConfirm
()
{
await
this
.
$confirm
(
this
.
$t
(
'Confirm to exit the editor'
),
{
confirmButtonText
:
this
.
$t
(
'Confirm'
),
cancelButtonText
:
this
.
$t
(
'Cancle'
),
type
:
'warning'
});
// todo
// exit
console
.
log
(
'exit confirm'
);
},
/**
* 发布
*/
async
publishConfirm
()
{
await
this
.
$confirm
(
this
.
$t
(
'Confirm to publish'
),
{
confirmButtonText
:
this
.
$t
(
'Confirm'
),
cancelButtonText
:
this
.
$t
(
'Cancle'
),
type
:
'warning'
});
// todo
// exit
console
.
log
(
'exit confirm'
);
},
...
mapActions
([
'updateProject'
])
}
};
</
script
>
<
style
lang=
"scss"
>
</
style
>
\ No newline at end of file
src/views/Editor/Assets/FileItem.vue
View file @
1dc2e5de
...
...
@@ -38,7 +38,7 @@
return
fileTypeIcon
[
this
.
ext
]
===
't'
;
},
thumbnailUrl
(){
return
ASSETS_BASE
+
this
.
data
.
url
;
return
this
.
data
.
url
;
},
},
methods
:
{
...
...
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