mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
添加沙箱环境
This commit is contained in:
@@ -8,7 +8,7 @@ var InputCache = {
|
|||||||
if (storage) {
|
if (storage) {
|
||||||
var dataKey = location.host;
|
var dataKey = location.host;
|
||||||
|
|
||||||
$('body').on('change', 'input', function (){
|
$('body').find('input[type="text"]').unbind().change(function () {
|
||||||
var id = this.id;
|
var id = this.id;
|
||||||
if (id) {
|
if (id) {
|
||||||
var data = getCache();
|
var data = getCache();
|
||||||
|
@@ -3,11 +3,8 @@ docEvent.bind(function (docItem,layui) {
|
|||||||
selectItem(docItem, layui);
|
selectItem(docItem, layui);
|
||||||
});
|
});
|
||||||
|
|
||||||
InputCache.init();
|
|
||||||
|
|
||||||
layui.use('form', function(){
|
layui.use('form', function(){
|
||||||
var form = layui.form;
|
var form = layui.form;
|
||||||
|
|
||||||
//监听提交
|
//监听提交
|
||||||
form.on('submit(formSend)', function(data){
|
form.on('submit(formSend)', function(data){
|
||||||
doTest();
|
doTest();
|
||||||
@@ -33,6 +30,7 @@ function selectItem(docItem, layui) {
|
|||||||
|
|
||||||
var $li = $('#docItemTree').find('li[nameversion="'+nameVersion+'"]');
|
var $li = $('#docItemTree').find('li[nameversion="'+nameVersion+'"]');
|
||||||
$li.addClass('layui-this').siblings().removeClass('layui-this');
|
$li.addClass('layui-this').siblings().removeClass('layui-this');
|
||||||
|
InputCache.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRequestParameter(docItem) {
|
function createRequestParameter(docItem) {
|
||||||
@@ -78,7 +76,17 @@ function createTreeTable(id, data) {
|
|||||||
,{field: 'val', title: '值', width: 300, templet:function (row) {
|
,{field: 'val', title: '值', width: 300, templet:function (row) {
|
||||||
var id = currentItem.nameVersion + '-' + row.name;
|
var id = currentItem.nameVersion + '-' + row.name;
|
||||||
var requiredTxt = row.required ? 'required lay-verify="required"' : '';
|
var requiredTxt = row.required ? 'required lay-verify="required"' : '';
|
||||||
return !row.refs ? '<input id="' + id + '" ' + requiredTxt + ' type="text" name="' + row.name + '" class="layui-input test-input"/>' : '';
|
var module = row.module;
|
||||||
|
var attrs = [
|
||||||
|
'id="' + id + '"'
|
||||||
|
, 'name="'+row.name+'"'
|
||||||
|
, 'class="layui-input test-input"'
|
||||||
|
, 'type="text"'
|
||||||
|
, requiredTxt
|
||||||
|
, 'module="'+module+'"'
|
||||||
|
];
|
||||||
|
|
||||||
|
return !row.refs ? '<input ' + attrs.join(' ') + '/>' : '';
|
||||||
}}
|
}}
|
||||||
,{field: 'description', title: '描述'}
|
,{field: 'description', title: '描述'}
|
||||||
]]
|
]]
|
||||||
@@ -86,7 +94,7 @@ function createTreeTable(id, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doTest() {
|
function doTest() {
|
||||||
var method = currentItem.method;
|
var method = currentItem.name;
|
||||||
var version = currentItem.version;
|
var version = currentItem.version;
|
||||||
var data = {
|
var data = {
|
||||||
appId: $('#appId').val(),
|
appId: $('#appId').val(),
|
||||||
@@ -97,7 +105,16 @@ function doTest() {
|
|||||||
var $inputs = $body.find('.test-input');
|
var $inputs = $body.find('.test-input');
|
||||||
var bizContent = {};
|
var bizContent = {};
|
||||||
$inputs.each(function () {
|
$inputs.each(function () {
|
||||||
|
var module = $(this).attr('module');
|
||||||
|
if (module) {
|
||||||
|
if (!bizContent[module]) {
|
||||||
|
bizContent[module] = {};
|
||||||
|
}
|
||||||
|
var moduleObj = bizContent[module];
|
||||||
|
moduleObj[this.name] = this.value;
|
||||||
|
} else {
|
||||||
bizContent[this.name] = this.value;
|
bizContent[this.name] = this.value;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
data.bizContent = JSON.stringify(bizContent);
|
data.bizContent = JSON.stringify(bizContent);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
Reference in New Issue
Block a user