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
d6843bc5
Commit
d6843bc5
authored
Jan 06, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
包管理修改
parent
acdb6949
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
61 additions
and
39 deletions
+61
-39
index.js
src/store/index.js
+2
-2
editor.js
src/store/modules/editor.js
+1
-22
packages.js
src/store/modules/packages.js
+16
-0
project.js
src/store/modules/project.js
+32
-6
Editor.vue
src/views/Editor.vue
+2
-1
ScriptsTab.vue
src/views/Editor/Inspector/ScriptsTab.vue
+1
-1
CodeSyncServeDialog.vue
src/views/Editor/dialogs/CodeSyncServeDialog.vue
+1
-1
AssetMappingEditorDialog.vue
...views/Editor/dialogs/editors/AssetMappingEditorDialog.vue
+2
-2
CustomModuleEditor.vue
src/views/Editor/dialogs/editors/CustomModuleEditor.vue
+1
-1
Home.vue
src/views/Home.vue
+3
-3
No files found.
src/store/index.js
View file @
d6843bc5
...
...
@@ -4,7 +4,7 @@
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
{
e
nvStore
}
from
"./modules/env
"
;
import
{
e
ditorStore
}
from
"./modules/editor
"
;
import
{
projectsStore
}
from
"./modules/projects"
;
import
{
projectStore
}
from
"./modules/project"
;
import
SaveToLocalPlugin
from
"./save-to-local-plugin"
;
...
...
@@ -21,7 +21,7 @@ export default new Vuex.Store({
},
modules
:
{
e
nv
:
env
Store
,
e
ditor
:
editor
Store
,
projects
:
projectsStore
,
project
:
projectStore
,
behavior
:
behaviorStore
,
...
...
src/store/modules/e
nv
.js
→
src/store/modules/e
ditor
.js
View file @
d6843bc5
...
...
@@ -9,7 +9,7 @@ import i18n from "../../i18n";
const
storeKey
=
'code-sync-serve-config'
;
export
const
e
nv
Store
=
{
export
const
e
ditor
Store
=
{
state
:
{
initialized
:
false
,
name
:
'Zeroing Editor'
,
...
...
@@ -18,9 +18,6 @@ export const envStore = {
builtin
:
[
'blank'
],
custom
:
[],
},
processes
:
[],
scripts
:
[],
customs
:
[],
codeSyncServeConfig
:
{
ip
:
'localhost'
,
port
:
7788
,
...
...
@@ -29,9 +26,6 @@ export const envStore = {
mutations
:
{
updateEnv
(
state
,
env
)
{
Object
.
assign
(
state
,
env
);
state
.
processes
=
parseItem
(
state
.
processes
);
state
.
scripts
=
parseItem
(
state
.
scripts
);
state
.
customs
=
parseItem
(
state
.
customs
);
state
.
initialized
=
true
;
...
...
@@ -111,18 +105,3 @@ function groupProcesses(processes, filterFunc) {
});
return
result
;
}
function
parseItem
(
list
)
{
let
hasError
,
result
=
[];
for
(
let
i
=
0
,
li
=
list
.
length
;
i
<
li
;
i
++
)
{
try
{
result
.
push
(
JSON
.
parse
(
list
[
i
].
data
));
}
catch
(
e
)
{
hasError
=
true
;
}
}
if
(
hasError
)
{
console
.
warn
(
'parse env error'
);
}
return
result
;
}
src/store/modules/packages.js
0 → 100644
View file @
d6843bc5
import
db
from
"../../utils/db-storage"
;
/**
* Created by rockyl on 2020-01-04.
*/
export
const
packagesStore
=
{
state
:
{},
actions
:
{
async
loadPackages
({
state
,
commit
},
id
)
{
let
packages
=
await
db
.
get
(
'packages'
,
id
);
commit
(
'updatePackages'
,
packages
);
},
},
};
src/store/modules/project.js
View file @
d6843bc5
...
...
@@ -16,6 +16,7 @@ import {addBehavior, deleteProcessMeta, findProcess} from "./behavior";
import
db
from
"../../utils/db-storage"
;
import
{
preprocess
}
from
"../../views/Preview/preview-preprocess"
;
import
{
packagesStore
}
from
"./packages"
;
const
storeName
=
'project'
;
...
...
@@ -79,6 +80,9 @@ function copyBaseRoot(node) {
}
export
const
projectStore
=
{
modules
:
{
packages
:
packagesStore
,
},
state
:
{
id
:
''
,
name
:
''
,
...
...
@@ -102,7 +106,6 @@ export const projectStore = {
dirty
:
false
,
operateStack
:
[],
stackIndex
:
0
,
packages
:
{},
},
mutations
:
{
setDirty
(
state
,
dirty
=
true
)
{
...
...
@@ -110,6 +113,13 @@ export const projectStore = {
},
makeDirty
()
{
},
updatePackages
(
state
,
packages
)
{
state
.
packages
=
packages
?
JSON
.
parse
(
packages
)
:
{
processes
:
[],
customs
:
[],
scripts
:
[],
};
},
updateProject
(
state
,
project
)
{
const
{
id
,
name
,
creator
,
data
}
=
project
;
...
...
@@ -526,7 +536,8 @@ export const projectStore = {
//let json = localStorage.getItem('project-' + projectID);
return
!!
json
;
},
async
loadFromLocal
({
commit
},
projectID
)
{
async
loadFromLocal
({
commit
,
dispatch
},
projectID
)
{
await
dispatch
(
'loadPackages'
,
projectID
);
let
json
=
await
db
.
get
(
storeName
,
projectID
);
//let json = localStorage.getItem('project-' + projectID);
if
(
json
)
{
...
...
@@ -541,6 +552,7 @@ export const projectStore = {
commit
(
'setDirty'
,
false
);
},
async
loadFromRemote
({
commit
,
dispatch
},
projectID
)
{
await
dispatch
(
'loadPackages'
,
projectID
);
const
project
=
await
projectApi
.
fetchOne
(
projectID
);
if
(
project
)
{
dispatch
(
'deleteLocalVersion'
,
projectID
);
...
...
@@ -550,6 +562,7 @@ export const projectStore = {
}
},
async
loadFromDataUrl
({
commit
,
dispatch
},
{
project
,
dataUrl
})
{
await
dispatch
(
'loadPackages'
,
project
.
id
);
const
projectData
=
await
projectApi
.
fetchOneFromDataUrl
(
dataUrl
);
if
(
projectData
)
{
project
.
data
=
projectData
;
...
...
@@ -567,13 +580,11 @@ export const projectStore = {
const
project
=
await
projectApi
.
getData
(
projectID
);
commit
(
'updateProject'
,
project
);
},
async
loadPackages
({
state
,
commit
})
{
let
packages
=
await
db
.
get
(
'packages'
,
state
.
id
);
},
async
resolveDependencies
({
state
})
{
for
(
let
key
in
state
.
data
.
dependencies
)
{
let
version
=
state
.
data
.
dependencies
[
key
];
}
},
...
...
@@ -718,7 +729,7 @@ export const projectStore = {
savePreview
({
state
,
rootState
,
getters
})
{
const
{
project
}
=
getters
;
const
{
processes
,
scripts
,
customs
}
=
root
State
.
env
;
const
{
processes
,
scripts
,
customs
}
=
root
state
.
editor
;
/*const data = {
processes, scripts, customs,
data: state.data,
...
...
@@ -806,3 +817,18 @@ export async function updateMock(mocks) {
db
.
set
(
'mock'
,
mock
);
}
}
function
parseItem
(
list
)
{
let
hasError
,
result
=
[];
for
(
let
i
=
0
,
li
=
list
.
length
;
i
<
li
;
i
++
)
{
try
{
result
.
push
(
JSON
.
parse
(
list
[
i
].
data
));
}
catch
(
e
)
{
hasError
=
true
;
}
}
if
(
hasError
)
{
console
.
warn
(
'parse env error'
);
}
return
result
;
}
src/views/Editor.vue
View file @
d6843bc5
...
...
@@ -73,7 +73,7 @@
computed
:
{
...
mapState
({
codeSyncServeConfig
(
state
)
{
return
state
.
e
nv
.
codeSyncServeConfig
;
return
state
.
e
ditor
.
codeSyncServeConfig
;
},
}),
},
...
...
@@ -309,6 +309,7 @@
},
300
);
},
...
mapActions
([
'loadPackages'
,
'localVersionExist'
,
'loadFromLocal'
,
'loadFromRemote'
,
...
...
src/views/Editor/Inspector/ScriptsTab.vue
View file @
d6843bc5
...
...
@@ -79,7 +79,7 @@ export default {
...
mapGetters
([
'activeComponent'
,
'activeComponentCopy'
,
'componentList'
]),
...
mapState
({
scripts
(
state
){
return
state
.
e
nv
.
scripts
;
return
state
.
e
ditor
.
scripts
;
}
}),
},
...
...
src/views/Editor/dialogs/CodeSyncServeDialog.vue
View file @
d6843bc5
...
...
@@ -47,7 +47,7 @@
computed
:
{
...
mapState
({
codeSyncServeConfig
(
state
)
{
return
state
.
e
nv
.
codeSyncServeConfig
;
return
state
.
e
ditor
.
codeSyncServeConfig
;
}
})
},
...
...
src/views/Editor/dialogs/editors/AssetMappingEditorDialog.vue
View file @
d6843bc5
...
...
@@ -68,8 +68,8 @@
computed
:
{
...
mapState
({
customs
(
state
)
{
console
.
log
(
state
.
e
nv
.
customs
);
return
state
.
e
nv
.
customs
;
console
.
log
(
state
.
e
ditor
.
customs
);
return
state
.
e
ditor
.
customs
;
},
}),
...
mapGetters
([
...
...
src/views/Editor/dialogs/editors/CustomModuleEditor.vue
View file @
d6843bc5
...
...
@@ -63,7 +63,7 @@
edit
()
{
this
.
editData
=
clonePureObj
(
this
.
customs
);
this
.
customMetas
.
splice
(
0
);
for
(
let
meta
of
this
.
$store
.
state
.
e
nv
.
customs
)
{
for
(
let
meta
of
this
.
$store
.
state
.
e
ditor
.
customs
)
{
let
data
=
this
.
editData
.
find
(
item
=>
item
.
id
===
meta
.
id
);
this
.
customMetas
.
push
({
id
:
meta
.
id
,
...
...
src/views/Home.vue
View file @
d6843bc5
<
template
>
<div
class=
"home"
>
<div
class=
"editor-name"
style=
"font-weight: bold"
>
{{
e
nv
.
name
}}
<span
class=
"editor-version"
>
{{
e
nv
.
version
}}
</span>
<div
class=
"editor-name"
style=
"font-weight: bold"
>
{{
e
ditor
.
name
}}
<span
class=
"editor-version"
>
{{
e
ditor
.
version
}}
</span>
</div>
<main>
<div
class=
"project-list"
>
...
...
@@ -110,7 +110,7 @@
},
...
mapState
([
'projects'
,
'e
nv
'
,
'e
ditor
'
,
]),
},
watch
:
{
...
...
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