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
0b3a1a94
Commit
0b3a1a94
authored
Dec 03, 2019
by
任建锋
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into rjf_test
parents
1cc13b2d
73794e8c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
29 deletions
+53
-29
template.js
src/template.js
+1
-2
index.js
src/utils/index.js
+12
-0
properties.js
src/utils/properties.js
+7
-0
Editor.vue
src/views/Editor.vue
+18
-18
MetaEditorDialog.vue
src/views/Editor/behavior-editor/MetaEditorDialog.vue
+13
-6
PackResultDialog.vue
src/views/Editor/dialogs/PackResultDialog.vue
+2
-3
No files found.
src/template.js
View file @
0b3a1a94
...
...
@@ -34,8 +34,7 @@ content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, u
<body>
<div id="$CONTAINER_ID$" style="line-height:0;font-size:0"></div>
<script src="
${
process
.
env
.
NODE_ENV
===
'development'
?
'http://10.10.94.134:4002/dist/index.js'
:
'http://yun.duiba.com.cn/editor/zeroing/libs/engine.b0b81ba7872b4ffaa3cdbe5d440cdb4617b86c5c.js'
}
"></script>
<script src="http://yun.duiba.com.cn/editor/zeroing/libs/tslib.js"></script>
<script src="
${
process
.
env
.
NODE_ENV
===
'development'
?
'http://10.10.94.134:4002/dist/index.js'
:
'http://yun.duiba.com.cn/editor/zeroing/libs/engine.a913456caee2ee40c20108a1c4571f61479e54a1.js'
}
"></script>
<script src="$PROCESSES_URL$"></script>
<script src="$SCRIPTS_URL$"></script>
<script src="$CUSTOMS_URL$"></script>
...
...
src/utils/index.js
View file @
0b3a1a94
...
...
@@ -130,3 +130,15 @@ export function selectFile(callback, {accept, multiple} = {}) {
}
input
.
click
();
}
export
function
openPreview
(
packResult
){
setTimeout
(()
=>
{
let
url
;
if
(
location
.
host
.
startsWith
(
'localhost'
)){
url
=
packResult
.
tplUrl
;
}
else
{
url
=
'/preview?url=http:'
+
packResult
.
tplUrl
;
}
window
.
open
(
url
,
'blank'
);
},
500
);
}
src/utils/properties.js
View file @
0b3a1a94
...
...
@@ -260,5 +260,12 @@ export default {
type
:
'inputNumber'
,
value
:
20
,
},
},
htmlView
:
{
groupName
:
'HTML视图'
,
htmlElement
:
{
title
:
'HTML内容'
,
type
:
'input'
,
},
}
}
src/views/Editor.vue
View file @
0b3a1a94
...
...
@@ -25,7 +25,7 @@
import
Playground
from
"./Editor/Playground"
;
import
Assets
from
"./Editor/Assets"
;
import
DetailsDialog
from
"./Editor/dialogs/DetailsDialog"
;
import
{
playWaiting
}
from
"../utils"
;
import
{
openPreview
,
playWaiting
}
from
"../utils"
;
import
i18n
from
"../i18n"
;
import
PackResultDialog
from
"./Editor/dialogs/PackResultDialog"
;
...
...
@@ -50,7 +50,7 @@
},
watch
:
{
$route
:
{
handler
:
function
(
val
,
oldVal
)
{
handler
:
function
(
val
,
oldVal
)
{
console
.
log
(
'router changed'
);
this
.
loadProject
();
},
...
...
@@ -63,21 +63,22 @@
async
mounted
()
{
document
.
addEventListener
(
'keydown'
,
this
.
onKeyPress
);
await
playWaiting
(
this
.
prepare
(),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{});
await
playWaiting
(
this
.
prepare
(),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{
});
this
.
loadProject
();
},
destroyed
(){
destroyed
()
{
document
.
removeEventListener
(
'keydown'
,
this
.
onKeyPress
)
},
methods
:
{
prepare
(){
prepare
()
{
return
Promise
.
all
([
this
.
updateEnv
(),
])
},
onKeyPress
(
e
){
if
(
e
.
key
===
's'
&&
(
e
.
ctrlKey
||
e
.
metaKey
))
{
onKeyPress
(
e
)
{
if
(
e
.
key
===
's'
&&
(
e
.
ctrlKey
||
e
.
metaKey
))
{
e
.
preventDefault
();
this
.
saveProject
();
...
...
@@ -85,7 +86,7 @@
return
false
;
}
},
async
loadProject
(){
async
loadProject
()
{
const
{
projectID
}
=
this
.
$route
.
params
;
if
(
await
this
.
localVersionExist
(
projectID
))
{
this
.
$confirm
(
this
.
$t
(
'Unsaved version found locally'
),
this
.
$t
(
'Alert'
),
{
...
...
@@ -111,7 +112,7 @@
loadLocalVersion
(
projectID
)
{
this
.
ready
=
false
;
this
.
loadFromLocal
(
projectID
);
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
ready
=
true
;
});
},
...
...
@@ -121,7 +122,7 @@
await
playWaiting
(
this
.
loadFromRemote
(
projectID
),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{
this
.
$alert
(
this
.
$t
(
'Project does not exist'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'Confirm'
),
callback
:
action
=>
{
callback
:
action
=>
{
this
.
$router
.
replace
({
name
:
'home'
});
}
});
...
...
@@ -191,23 +192,22 @@
break
;
}
},
async
pack
(
debug
=
false
){
async
pack
(
debug
=
false
)
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
this
.
$t
(
'Packing'
),
});
try
{
try
{
await
this
.
saveProject
(
false
);
const
packResult
=
await
this
.
packProject
(
debug
);
this
.
$message
({
message
:
this
.
$t
(
'Pack project successfully'
),
type
:
'success'
,
duration
:
10
00
,
duration
:
5
00
,
});
if
(
debug
){
setTimeout
(()
=>
{
window
.
open
(
packResult
.
tplUrl
,
'blank'
);
},
500
);
}
else
{
if
(
debug
)
{
openPreview
(
packResult
);
}
else
{
this
.
$refs
.
packResultDialog
.
show
(
packResult
);
}
/*this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
...
...
@@ -221,7 +221,7 @@
}).catch(() => {
});*/
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
$message
({
message
:
this
.
$t
(
'Pack project failed'
),
type
:
'error'
,
...
...
src/views/Editor/behavior-editor/MetaEditorDialog.vue
View file @
0b3a1a94
<
template
>
<el-dialog
:title=
"$t('Meta Editor')"
width=
"80%"
:visible
.
sync=
"visible"
:close-on-click-modal=
"false"
:close-on-press-escape=
"false"
:show-close=
"false"
:append-to-body=
"true"
>
<div
class=
"meta-editor-wrapper"
>
<el-form
ref=
"form"
v-if=
"meta"
:model=
"meta"
:rules=
"rules"
:show-message=
"false"
class=
"info-editor"
size=
"mini"
label-position=
"right"
label-width=
"70px"
@
submit
.
native
.
prevent
>
...
...
@@ -41,9 +43,12 @@
</div>
<!--<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea" :placeholder="$t('Code')"
v-model="meta.script"></el-input>-->
<codemirror
ref=
"
myCm
"
v-if=
"meta"
<codemirror
ref=
"
codeEditor
"
v-if=
"meta"
v-model=
"meta.script"
:options=
"cmOptions"
>
:options=
"cmOptions"
@
cursorActivity=
"onCodeChange"
>
</codemirror>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -73,6 +78,9 @@
import
'codemirror/lib/codemirror.css'
import
'codemirror/theme/monokai.css'
import
'codemirror/addon/edit/closebrackets.js'
import
'codemirror/addon/hint/show-hint.js'
import
'codemirror/addon/hint/show-hint.css'
import
'codemirror/addon/hint/javascript-hint.js'
const
exposeVariables
=
[
'args'
,
'props'
,
'target'
,
'global'
,
'vm'
,
'engine'
];
...
...
@@ -95,7 +103,6 @@
],
},
cmOptions
:
{
// codemirror options
tabSize
:
2
,
mode
:
'text/javascript'
,
styleActiveLine
:
true
,
...
...
@@ -104,7 +111,6 @@
line
:
true
,
matchBrackets
:
true
,
autoCloseBrackets
:
true
,
// more codemirror options, 更多 codemirror 的高级配置...
}
}
},
...
...
@@ -167,8 +173,9 @@
focusPasteBoard
(){
this
.
$refs
.
pasteBoard
.
focus
();
},
onCmCodeChange
(
code
){
console
.
log
(
code
);
onCodeChange
(
codemirror
){
//codemirror.showHint();
//console.log(code);
}
}
}
...
...
src/views/Editor/dialogs/PackResultDialog.vue
View file @
0b3a1a94
...
...
@@ -18,6 +18,7 @@
<
script
>
import
copy
from
'copy-to-clipboard'
import
{
openPreview
}
from
"../../../utils"
;
export
default
{
name
:
"PackResultDialog"
,
...
...
@@ -40,9 +41,7 @@
openInNewTab
()
{
this
.
visible
=
false
;
setTimeout
(()
=>
{
window
.
open
(
this
.
packResult
.
tplUrl
,
'blank'
);
},
500
);
openPreview
(
this
.
packResult
);
},
copy
()
{
this
.
visible
=
false
;
...
...
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