添加沙箱环境

1.x
tanghc 6 years ago
parent 246791751d
commit e40ab63f1f
  1. 2
      sop-website/website-front/assets/js/inputcache.js
  2. 27
      sop-website/website-front/pages/sandbox/sandbox.js

@ -8,7 +8,7 @@ var InputCache = {
if (storage) {
var dataKey = location.host;
$('body').on('change', 'input', function (){
$('body').find('input[type="text"]').unbind().change(function () {
var id = this.id;
if (id) {
var data = getCache();

@ -3,11 +3,8 @@ docEvent.bind(function (docItem,layui) {
selectItem(docItem, layui);
});
InputCache.init();
layui.use('form', function(){
var form = layui.form;
//监听提交
form.on('submit(formSend)', function(data){
doTest();
@ -33,6 +30,7 @@ function selectItem(docItem, layui) {
var $li = $('#docItemTree').find('li[nameversion="'+nameVersion+'"]');
$li.addClass('layui-this').siblings().removeClass('layui-this');
InputCache.init();
}
function createRequestParameter(docItem) {
@ -78,7 +76,17 @@ function createTreeTable(id, data) {
,{field: 'val', title: '值', width: 300, templet:function (row) {
var id = currentItem.nameVersion + '-' + row.name;
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: '描述'}
]]
@ -86,7 +94,7 @@ function createTreeTable(id, data) {
}
function doTest() {
var method = currentItem.method;
var method = currentItem.name;
var version = currentItem.version;
var data = {
appId: $('#appId').val(),
@ -97,7 +105,16 @@ function doTest() {
var $inputs = $body.find('.test-input');
var bizContent = {};
$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;
}
});
data.bizContent = JSON.stringify(bizContent);
$.ajax({

Loading…
Cancel
Save