...
|
...
|
@@ -53,9 +53,8 @@ |
|
|
<tr>
|
|
|
<th>属性名</th>
|
|
|
<th>属性类型</th>
|
|
|
<th>正则匹配</th>
|
|
|
<th>长度限制</th>
|
|
|
<th>说明</th>
|
|
|
<th>测试入参</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
...
|
...
|
@@ -64,9 +63,8 @@ |
|
|
<tr>
|
|
|
<td>{{name}}</td>
|
|
|
<td>{{type}}</td>
|
|
|
<td>{{reg}}</td>
|
|
|
<td>{{minLength}}-{{maxLength}}</td>
|
|
|
<td>{{message}}</td>
|
|
|
<td><input name="{{name}}" type="text" /></td>
|
|
|
</tr>
|
|
|
{{/ params}}
|
|
|
</tbody>
|
...
|
...
|
@@ -75,7 +73,7 @@ |
|
|
<pre style="display:none">
|
|
|
|
|
|
</pre>
|
|
|
<button class="btn btn-success getRes" method="{{method}}" url="{{url}}">点击获取</button>
|
|
|
<button class="btn btn-success getRes" method="{{method}}" url="{{url}}" isjson="{{isJsonRaw}}">点击获取</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
{{/ list}}
|
...
|
...
|
@@ -169,19 +167,31 @@ var formatJson = function(json, options) { |
|
|
return formatted;
|
|
|
};
|
|
|
$(function(){
|
|
|
$(".panel-minimize").click();
|
|
|
$(".getRes").click(function(){
|
|
|
$('.panel-minimize').click();
|
|
|
$('.getRes').click(function(){
|
|
|
var panel = $(this).prev().show('fast');
|
|
|
$.ajax({
|
|
|
url:$(this).attr("url"),
|
|
|
type:$(this).attr("method"),
|
|
|
dataType:'json'
|
|
|
}).done(function(data){
|
|
|
var isJson = $(this).attr('isjson');
|
|
|
var option = {
|
|
|
url:$(this).attr('url'),
|
|
|
type:$(this).attr('method'),
|
|
|
}
|
|
|
var data = {};
|
|
|
if(isJson) {
|
|
|
option.url = '/proxy?url=' + $(this).attr('url');
|
|
|
}
|
|
|
|
|
|
$(this).parent().find('input').each(function(){
|
|
|
data[$(this).attr('name')] = $(this).val();
|
|
|
});
|
|
|
|
|
|
option.data = data;
|
|
|
|
|
|
$.ajax(option).done(function(data){
|
|
|
var json = formatJson(data);
|
|
|
panel.html(json);
|
|
|
});
|
|
|
});
|
|
|
})
|
|
|
});
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |
...
|
...
|
|