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
Hide 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 @@
...
@@ -4,7 +4,7 @@
import
Vue
from
'vue'
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
Vuex
from
'vuex'
import
{
e
nvStore
}
from
"./modules/env
"
;
import
{
e
ditorStore
}
from
"./modules/editor
"
;
import
{
projectsStore
}
from
"./modules/projects"
;
import
{
projectsStore
}
from
"./modules/projects"
;
import
{
projectStore
}
from
"./modules/project"
;
import
{
projectStore
}
from
"./modules/project"
;
import
SaveToLocalPlugin
from
"./save-to-local-plugin"
;
import
SaveToLocalPlugin
from
"./save-to-local-plugin"
;
...
@@ -21,7 +21,7 @@ export default new Vuex.Store({
...
@@ -21,7 +21,7 @@ export default new Vuex.Store({
},
},
modules
:
{
modules
:
{
e
nv
:
env
Store
,
e
ditor
:
editor
Store
,
projects
:
projectsStore
,
projects
:
projectsStore
,
project
:
projectStore
,
project
:
projectStore
,
behavior
:
behaviorStore
,
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";
...
@@ -9,7 +9,7 @@ import i18n from "../../i18n";
const
storeKey
=
'code-sync-serve-config'
;
const
storeKey
=
'code-sync-serve-config'
;
export
const
e
nv
Store
=
{
export
const
e
ditor
Store
=
{
state
:
{
state
:
{
initialized
:
false
,
initialized
:
false
,
name
:
'Zeroing Editor'
,
name
:
'Zeroing Editor'
,
...
@@ -18,9 +18,6 @@ export const envStore = {
...
@@ -18,9 +18,6 @@ export const envStore = {
builtin
:
[
'blank'
],
builtin
:
[
'blank'
],
custom
:
[],
custom
:
[],
},
},
processes
:
[],
scripts
:
[],
customs
:
[],
codeSyncServeConfig
:
{
codeSyncServeConfig
:
{
ip
:
'localhost'
,
ip
:
'localhost'
,
port
:
7788
,
port
:
7788
,
...
@@ -29,9 +26,6 @@ export const envStore = {
...
@@ -29,9 +26,6 @@ export const envStore = {
mutations
:
{
mutations
:
{
updateEnv
(
state
,
env
)
{
updateEnv
(
state
,
env
)
{
Object
.
assign
(
state
,
env
);
Object
.
assign
(
state
,
env
);
state
.
processes
=
parseItem
(
state
.
processes
);
state
.
scripts
=
parseItem
(
state
.
scripts
);
state
.
customs
=
parseItem
(
state
.
customs
);
state
.
initialized
=
true
;
state
.
initialized
=
true
;
...
@@ -111,18 +105,3 @@ function groupProcesses(processes, filterFunc) {
...
@@ -111,18 +105,3 @@ function groupProcesses(processes, filterFunc) {
});
});
return
result
;
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";
...
@@ -16,6 +16,7 @@ import {addBehavior, deleteProcessMeta, findProcess} from "./behavior";
import
db
from
"../../utils/db-storage"
;
import
db
from
"../../utils/db-storage"
;
import
{
preprocess
}
from
"../../views/Preview/preview-preprocess"
;
import
{
preprocess
}
from
"../../views/Preview/preview-preprocess"
;
import
{
packagesStore
}
from
"./packages"
;
const
storeName
=
'project'
;
const
storeName
=
'project'
;
...
@@ -79,6 +80,9 @@ function copyBaseRoot(node) {
...
@@ -79,6 +80,9 @@ function copyBaseRoot(node) {
}
}
export
const
projectStore
=
{
export
const
projectStore
=
{
modules
:
{
packages
:
packagesStore
,
},
state
:
{
state
:
{
id
:
''
,
id
:
''
,
name
:
''
,
name
:
''
,
...
@@ -102,7 +106,6 @@ export const projectStore = {
...
@@ -102,7 +106,6 @@ export const projectStore = {
dirty
:
false
,
dirty
:
false
,
operateStack
:
[],
operateStack
:
[],
stackIndex
:
0
,
stackIndex
:
0
,
packages
:
{},
},
},
mutations
:
{
mutations
:
{
setDirty
(
state
,
dirty
=
true
)
{
setDirty
(
state
,
dirty
=
true
)
{
...
@@ -110,6 +113,13 @@ export const projectStore = {
...
@@ -110,6 +113,13 @@ export const projectStore = {
},
},
makeDirty
()
{
makeDirty
()
{
},
updatePackages
(
state
,
packages
)
{
state
.
packages
=
packages
?
JSON
.
parse
(
packages
)
:
{
processes
:
[],
customs
:
[],
scripts
:
[],
};
},
},
updateProject
(
state
,
project
)
{
updateProject
(
state
,
project
)
{
const
{
id
,
name
,
creator
,
data
}
=
project
;
const
{
id
,
name
,
creator
,
data
}
=
project
;
...
@@ -526,7 +536,8 @@ export const projectStore = {
...
@@ -526,7 +536,8 @@ export const projectStore = {
//let json = localStorage.getItem('project-' + projectID);
//let json = localStorage.getItem('project-' + projectID);
return
!!
json
;
return
!!
json
;
},
},
async
loadFromLocal
({
commit
},
projectID
)
{
async
loadFromLocal
({
commit
,
dispatch
},
projectID
)
{
await
dispatch
(
'loadPackages'
,
projectID
);
let
json
=
await
db
.
get
(
storeName
,
projectID
);
let
json
=
await
db
.
get
(
storeName
,
projectID
);
//let json = localStorage.getItem('project-' + projectID);
//let json = localStorage.getItem('project-' + projectID);
if
(
json
)
{
if
(
json
)
{
...
@@ -541,6 +552,7 @@ export const projectStore = {
...
@@ -541,6 +552,7 @@ export const projectStore = {
commit
(
'setDirty'
,
false
);
commit
(
'setDirty'
,
false
);
},
},
async
loadFromRemote
({
commit
,
dispatch
},
projectID
)
{
async
loadFromRemote
({
commit
,
dispatch
},
projectID
)
{
await
dispatch
(
'loadPackages'
,
projectID
);
const
project
=
await
projectApi
.
fetchOne
(
projectID
);
const
project
=
await
projectApi
.
fetchOne
(
projectID
);
if
(
project
)
{
if
(
project
)
{
dispatch
(
'deleteLocalVersion'
,
projectID
);
dispatch
(
'deleteLocalVersion'
,
projectID
);
...
@@ -550,6 +562,7 @@ export const projectStore = {
...
@@ -550,6 +562,7 @@ export const projectStore = {
}
}
},
},
async
loadFromDataUrl
({
commit
,
dispatch
},
{
project
,
dataUrl
})
{
async
loadFromDataUrl
({
commit
,
dispatch
},
{
project
,
dataUrl
})
{
await
dispatch
(
'loadPackages'
,
project
.
id
);
const
projectData
=
await
projectApi
.
fetchOneFromDataUrl
(
dataUrl
);
const
projectData
=
await
projectApi
.
fetchOneFromDataUrl
(
dataUrl
);
if
(
projectData
)
{
if
(
projectData
)
{
project
.
data
=
projectData
;
project
.
data
=
projectData
;
...
@@ -567,13 +580,11 @@ export const projectStore = {
...
@@ -567,13 +580,11 @@ export const projectStore = {
const
project
=
await
projectApi
.
getData
(
projectID
);
const
project
=
await
projectApi
.
getData
(
projectID
);
commit
(
'updateProject'
,
project
);
commit
(
'updateProject'
,
project
);
},
},
async
loadPackages
({
state
,
commit
})
{
let
packages
=
await
db
.
get
(
'packages'
,
state
.
id
);
},
async
resolveDependencies
({
state
})
{
async
resolveDependencies
({
state
})
{
for
(
let
key
in
state
.
data
.
dependencies
)
{
for
(
let
key
in
state
.
data
.
dependencies
)
{
let
version
=
state
.
data
.
dependencies
[
key
];
let
version
=
state
.
data
.
dependencies
[
key
];
}
}
},
},
...
@@ -718,7 +729,7 @@ export const projectStore = {
...
@@ -718,7 +729,7 @@ export const projectStore = {
savePreview
({
state
,
rootState
,
getters
})
{
savePreview
({
state
,
rootState
,
getters
})
{
const
{
project
}
=
getters
;
const
{
project
}
=
getters
;
const
{
processes
,
scripts
,
customs
}
=
root
State
.
env
;
const
{
processes
,
scripts
,
customs
}
=
root
state
.
editor
;
/*const data = {
/*const data = {
processes, scripts, customs,
processes, scripts, customs,
data: state.data,
data: state.data,
...
@@ -806,3 +817,18 @@ export async function updateMock(mocks) {
...
@@ -806,3 +817,18 @@ export async function updateMock(mocks) {
db
.
set
(
'mock'
,
mock
);
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 @@
...
@@ -73,7 +73,7 @@
computed
:
{
computed
:
{
...
mapState
({
...
mapState
({
codeSyncServeConfig
(
state
)
{
codeSyncServeConfig
(
state
)
{
return
state
.
e
nv
.
codeSyncServeConfig
;
return
state
.
e
ditor
.
codeSyncServeConfig
;
},
},
}),
}),
},
},
...
@@ -309,6 +309,7 @@
...
@@ -309,6 +309,7 @@
},
300
);
},
300
);
},
},
...
mapActions
([
...
mapActions
([
'loadPackages'
,
'localVersionExist'
,
'localVersionExist'
,
'loadFromLocal'
,
'loadFromLocal'
,
'loadFromRemote'
,
'loadFromRemote'
,
...
...
src/views/Editor/Inspector/ScriptsTab.vue
View file @
d6843bc5
...
@@ -79,7 +79,7 @@ export default {
...
@@ -79,7 +79,7 @@ export default {
...
mapGetters
([
'activeComponent'
,
'activeComponentCopy'
,
'componentList'
]),
...
mapGetters
([
'activeComponent'
,
'activeComponentCopy'
,
'componentList'
]),
...
mapState
({
...
mapState
({
scripts
(
state
){
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 @@
...
@@ -47,7 +47,7 @@
computed
:
{
computed
:
{
...
mapState
({
...
mapState
({
codeSyncServeConfig
(
state
)
{
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 @@
...
@@ -68,8 +68,8 @@
computed
:
{
computed
:
{
...
mapState
({
...
mapState
({
customs
(
state
)
{
customs
(
state
)
{
console
.
log
(
state
.
e
nv
.
customs
);
console
.
log
(
state
.
e
ditor
.
customs
);
return
state
.
e
nv
.
customs
;
return
state
.
e
ditor
.
customs
;
},
},
}),
}),
...
mapGetters
([
...
mapGetters
([
...
...
src/views/Editor/dialogs/editors/CustomModuleEditor.vue
View file @
d6843bc5
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
edit
()
{
edit
()
{
this
.
editData
=
clonePureObj
(
this
.
customs
);
this
.
editData
=
clonePureObj
(
this
.
customs
);
this
.
customMetas
.
splice
(
0
);
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
);
let
data
=
this
.
editData
.
find
(
item
=>
item
.
id
===
meta
.
id
);
this
.
customMetas
.
push
({
this
.
customMetas
.
push
({
id
:
meta
.
id
,
id
:
meta
.
id
,
...
...
src/views/Home.vue
View file @
d6843bc5
<
template
>
<
template
>
<div
class=
"home"
>
<div
class=
"home"
>
<div
class=
"editor-name"
style=
"font-weight: bold"
>
{{
e
nv
.
name
}}
<div
class=
"editor-name"
style=
"font-weight: bold"
>
{{
e
ditor
.
name
}}
<span
class=
"editor-version"
>
{{
e
nv
.
version
}}
</span>
<span
class=
"editor-version"
>
{{
e
ditor
.
version
}}
</span>
</div>
</div>
<main>
<main>
<div
class=
"project-list"
>
<div
class=
"project-list"
>
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
},
},
...
mapState
([
...
mapState
([
'projects'
,
'projects'
,
'e
nv
'
,
'e
ditor
'
,
]),
]),
},
},
watch
:
{
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