添加沙箱环境

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

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

@ -3,6 +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;
@ -15,14 +17,12 @@ layui.use('form', function(){
var $body = $('body'); var $body = $('body');
var treetable; var treetable;
var method,version; var currentItem;
var nameVersion;
function selectItem(docItem, layui) { function selectItem(docItem, layui) {
currentItem = docItem;
resetResultDiv(); resetResultDiv();
nameVersion = docItem.nameVersion; var nameVersion = docItem.nameVersion;
method = docItem.name;
version = docItem.version;
treetable = treetable || layui.treetable; treetable = treetable || layui.treetable;
$('.sop-name').text(docItem.name); $('.sop-name').text(docItem.name);
$('.sop-version').text(docItem.version); $('.sop-version').text(docItem.version);
@ -33,7 +33,6 @@ 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) {
@ -77,7 +76,7 @@ function createTreeTable(id, data) {
cols: [[ cols: [[
{field: 'name', title: '参数',width: 200} {field: 'name', title: '参数',width: 200}
,{field: 'val', title: '值', width: 300, templet:function (row) { ,{field: 'val', title: '值', width: 300, templet:function (row) {
var id = 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"/>' : ''; return !row.refs ? '<input id="' + id + '" ' + requiredTxt + ' type="text" name="' + row.name + '" class="layui-input test-input"/>' : '';
}} }}
@ -87,6 +86,8 @@ function createTreeTable(id, data) {
} }
function doTest() { function doTest() {
var method = currentItem.method;
var version = currentItem.version;
var data = { var data = {
appId: $('#appId').val(), appId: $('#appId').val(),
privateKey: $('#privateKey').val(), privateKey: $('#privateKey').val(),

Loading…
Cancel
Save