|
@@ -228,7 +228,7 @@
|
|
<div class="tab-content">
|
|
<div class="tab-content">
|
|
{{include "step1.html"}}
|
|
{{include "step1.html"}}
|
|
{{include "step2.html"}}
|
|
{{include "step2.html"}}
|
|
- {{include "step3.html"}}
|
|
|
|
|
|
+ {{include "step3.html"}}
|
|
{{include "stepre3.html"}}
|
|
{{include "stepre3.html"}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -259,13 +259,29 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
$(function(){
|
|
$(function(){
|
|
|
|
+ editor2_js = CodeMirror.fromTextArea($("#step2_js")[0], {
|
|
|
|
+ theme:"solarized light",
|
|
|
|
+ lineNumbers: true,
|
|
|
|
+ indentUnit:4,
|
|
|
|
+ smartIndent:true
|
|
|
|
+ });
|
|
|
|
+ editor2_js.setSize("auto","300");
|
|
|
|
+ editor3_js = CodeMirror.fromTextArea($("#step3_js")[0], {
|
|
|
|
+ theme:"solarized light",
|
|
|
|
+ lineNumbers: true,
|
|
|
|
+ indentUnit:4,
|
|
|
|
+ smartIndent:true
|
|
|
|
+ });
|
|
|
|
+ editor3_js.setSize("auto","300");
|
|
|
|
+
|
|
|
|
+
|
|
if({{.T.lua.iscopycontent}}){
|
|
if({{.T.lua.iscopycontent}}){
|
|
$("#copyTab").prop('checked','checked');
|
|
$("#copyTab").prop('checked','checked');
|
|
$("#copyTabDom").show()
|
|
$("#copyTabDom").show()
|
|
//$("#copyTabDom").find('a').trigger('click')
|
|
//$("#copyTabDom").find('a').trigger('click')
|
|
//editor_re3.refresh()
|
|
//editor_re3.refresh()
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
$("#copyTab").on('change', function () {
|
|
$("#copyTab").on('change', function () {
|
|
var result = $(this).prop('checked')
|
|
var result = $(this).prop('checked')
|
|
if (result) {
|
|
if (result) {
|
|
@@ -277,19 +293,19 @@
|
|
$("#copyTabDom").prev().find('a').trigger('click')
|
|
$("#copyTabDom").prev().find('a').trigger('click')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
// showTip("注意修改:最大页和间隔时间", 3000);
|
|
// showTip("注意修改:最大页和间隔时间", 3000);
|
|
$(document).keydown(function(e){
|
|
$(document).keydown(function(e){
|
|
if(e.keyCode==13){
|
|
if(e.keyCode==13){
|
|
$("#com-alert").modal("hide");
|
|
$("#com-alert").modal("hide");
|
|
- }
|
|
|
|
|
|
+ }
|
|
});
|
|
});
|
|
//初始化编辑器
|
|
//初始化编辑器
|
|
common.setActive("spider");
|
|
common.setActive("spider");
|
|
common.spider.guideActive($(".edit-step li:eq(0)").attr("data-mode"),$(".edit-step li:eq(0)").get(0));
|
|
common.spider.guideActive($(".edit-step li:eq(0)").attr("data-mode"),$(".edit-step li:eq(0)").get(0));
|
|
$(".edit-step li[data-mode]").click(function(node){
|
|
$(".edit-step li[data-mode]").click(function(node){
|
|
|
|
+ // console.log(1);
|
|
common.spider.guideActive($(this).attr("data-mode"),this);
|
|
common.spider.guideActive($(this).attr("data-mode"),this);
|
|
- //console.log(1);
|
|
|
|
switch ($(this).index()+1){
|
|
switch ($(this).index()+1){
|
|
case 1:
|
|
case 1:
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
@@ -306,11 +322,11 @@
|
|
editor_3.refresh();
|
|
editor_3.refresh();
|
|
},50)
|
|
},50)
|
|
break;
|
|
break;
|
|
- case 4:
|
|
|
|
|
|
+ case 4:
|
|
setTimeout(function(){
|
|
setTimeout(function(){
|
|
editor_re3.refresh();
|
|
editor_re3.refresh();
|
|
},50)
|
|
},50)
|
|
- break;
|
|
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$(".guide button").click(function(){
|
|
$(".guide button").click(function(){
|
|
@@ -323,13 +339,13 @@
|
|
editor_4.refresh();
|
|
editor_4.refresh();
|
|
editor_re3.refresh();
|
|
editor_re3.refresh();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
|
|
|
|
$.getJSON("/province.json",function(json){
|
|
$.getJSON("/province.json",function(json){
|
|
common.spider.json=json;
|
|
common.spider.json=json;
|
|
common.spider.getModel(common.spider.setModel);
|
|
common.spider.getModel(common.spider.setModel);
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
$("legend a").click(function(event,editor){
|
|
$("legend a").click(function(event,editor){
|
|
var node = $(this).parent().find("input[type='radio']:checked").val()
|
|
var node = $(this).parent().find("input[type='radio']:checked").val()
|
|
@@ -346,7 +362,7 @@
|
|
var isstep=common.form.isCheck(target,check)
|
|
var isstep=common.form.isCheck(target,check)
|
|
if(!isbase || !isstep){
|
|
if(!isbase || !isstep){
|
|
return
|
|
return
|
|
- }else{
|
|
|
|
|
|
+ }else{
|
|
common.maskShow();
|
|
common.maskShow();
|
|
var modal=target.replace("step","#tab_");
|
|
var modal=target.replace("step","#tab_");
|
|
var data=common.form.serializeArray(target);
|
|
var data=common.form.serializeArray(target);
|
|
@@ -499,6 +515,65 @@
|
|
})
|
|
})
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ //编辑js
|
|
|
|
+ function editJs(step) {
|
|
|
|
+ if (step == "list"){//list
|
|
|
|
+ $("#step2_js_pre").removeClass("hide")
|
|
|
|
+ $("#step3_js_pre").addClass("hide")
|
|
|
|
+ $("#js_name").val({{.T.lua.js_list.js_name}});
|
|
|
|
+ $("#js_alias").val({{.T.lua.js_list.js_alias}});
|
|
|
|
+ // $("#param_type").val({{.T.lua.js_list.js_param}});
|
|
|
|
+ // $("#return_type").val({{.T.lua.js_list.js_return}});
|
|
|
|
+ }else if (step == "detail"){//detail
|
|
|
|
+ $("#step2_js_pre").addClass("hide")
|
|
|
|
+ $("#step3_js_pre").removeClass("hide")
|
|
|
|
+ $("#js_name").val({{.T.lua.js_detail.js_name}});
|
|
|
|
+ $("#js_alias").val({{.T.lua.js_detail.js_alias}});
|
|
|
|
+ // $("#param_type").val({{.T.lua.js_detail.js_param}});
|
|
|
|
+ // $("#return_type").val({{.T.lua.js_detail.js_return}});
|
|
|
|
+ }
|
|
|
|
+ console.log(step)
|
|
|
|
+ $("#savejs").attr("step",step)
|
|
|
|
+ common.spider.editjs(step);
|
|
|
|
+ }
|
|
|
|
+ //保存js
|
|
|
|
+ function saveJs() {
|
|
|
|
+ var step = $("#savejs").attr("step");
|
|
|
|
+ var jstext = ""
|
|
|
|
+ if (step == "list"){
|
|
|
|
+ jstext = editor2_js.getValue();
|
|
|
|
+ }else if (step == "detail"){
|
|
|
|
+ jstext = editor3_js.getValue();
|
|
|
|
+ }
|
|
|
|
+ var js_name = $("#js_name").val();
|
|
|
|
+ var js_alias = $("#js_alias").val();
|
|
|
|
+ if (jstext == ""){
|
|
|
|
+ alert("js不能为空!");
|
|
|
|
+ return;
|
|
|
|
+ }else if (js_name !="" && js_alias == ""){
|
|
|
|
+ alert("js别名不能为空!");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // var param_type = $("#param_type").val();
|
|
|
|
+ // var return_type = $("#return_type").val();
|
|
|
|
+ // if (jstext==""||param_type==""||return_type==""){
|
|
|
|
+ // alert("js、参数、返回值不能为空!");
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ $.ajax({
|
|
|
|
+ url:"/center/save/js",
|
|
|
|
+ type:"post",
|
|
|
|
+ // data:{"step":step,"jstext":jstext,"js_name":js_name,"param_type":param_type,"return_type":return_type,"code":{{.T.lua.code}}},
|
|
|
|
+ data:{"step":step,"jstext":jstext,"js_name":js_name,"js_alias":js_alias,"code":{{.T.lua.code}}},
|
|
|
|
+ success:function(r){
|
|
|
|
+ $("#modal-js").modal("hide");
|
|
|
|
+ showTip("保存成功", 1000);
|
|
|
|
+ setTimeout(function (){
|
|
|
|
+ window.location.reload();
|
|
|
|
+ }, 1000);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
{{include "socket.html"}}
|
|
{{include "socket.html"}}
|
|
{{include "bottom.html"}}
|
|
{{include "bottom.html"}}
|