|
@@ -53,9 +53,8 @@ |
|
@@ -53,9 +53,8 @@ |
53
|
<tr>
|
53
|
<tr>
|
54
|
<th>属性名</th>
|
54
|
<th>属性名</th>
|
55
|
<th>属性类型</th>
|
55
|
<th>属性类型</th>
|
56
|
- <th>正则匹配</th>
|
|
|
57
|
- <th>长度限制</th>
|
|
|
58
|
<th>说明</th>
|
56
|
<th>说明</th>
|
|
|
57
|
+ <th>测试入参</th>
|
59
|
</tr>
|
58
|
</tr>
|
60
|
</thead>
|
59
|
</thead>
|
61
|
|
60
|
|
|
@@ -64,9 +63,8 @@ |
|
@@ -64,9 +63,8 @@ |
64
|
<tr>
|
63
|
<tr>
|
65
|
<td>{{name}}</td>
|
64
|
<td>{{name}}</td>
|
66
|
<td>{{type}}</td>
|
65
|
<td>{{type}}</td>
|
67
|
- <td>{{reg}}</td>
|
|
|
68
|
- <td>{{minLength}}-{{maxLength}}</td>
|
|
|
69
|
<td>{{message}}</td>
|
66
|
<td>{{message}}</td>
|
|
|
67
|
+ <td><input name="{{name}}" type="text" /></td>
|
70
|
</tr>
|
68
|
</tr>
|
71
|
{{/ params}}
|
69
|
{{/ params}}
|
72
|
</tbody>
|
70
|
</tbody>
|
|
@@ -75,7 +73,7 @@ |
|
@@ -75,7 +73,7 @@ |
75
|
<pre style="display:none">
|
73
|
<pre style="display:none">
|
76
|
|
74
|
|
77
|
</pre>
|
75
|
</pre>
|
78
|
- <button class="btn btn-success getRes" method="{{method}}" url="{{url}}">点击获取</button>
|
76
|
+ <button class="btn btn-success getRes" method="{{method}}" url="{{url}}" isjson="{{isJsonRaw}}">点击获取</button>
|
79
|
</div>
|
77
|
</div>
|
80
|
</div>
|
78
|
</div>
|
81
|
{{/ list}}
|
79
|
{{/ list}}
|
|
@@ -169,19 +167,31 @@ var formatJson = function(json, options) { |
|
@@ -169,19 +167,31 @@ var formatJson = function(json, options) { |
169
|
return formatted;
|
167
|
return formatted;
|
170
|
};
|
168
|
};
|
171
|
$(function(){
|
169
|
$(function(){
|
172
|
- $(".panel-minimize").click();
|
|
|
173
|
- $(".getRes").click(function(){
|
170
|
+ $('.panel-minimize').click();
|
|
|
171
|
+ $('.getRes').click(function(){
|
174
|
var panel = $(this).prev().show('fast');
|
172
|
var panel = $(this).prev().show('fast');
|
175
|
- $.ajax({
|
|
|
176
|
- url:$(this).attr("url"),
|
|
|
177
|
- type:$(this).attr("method"),
|
|
|
178
|
- dataType:'json'
|
|
|
179
|
- }).done(function(data){
|
173
|
+ var isJson = $(this).attr('isjson');
|
|
|
174
|
+ var option = {
|
|
|
175
|
+ url:$(this).attr('url'),
|
|
|
176
|
+ type:$(this).attr('method'),
|
|
|
177
|
+ }
|
|
|
178
|
+ var data = {};
|
|
|
179
|
+ if(isJson) {
|
|
|
180
|
+ option.url = '/proxy?url=' + $(this).attr('url');
|
|
|
181
|
+ }
|
|
|
182
|
+
|
|
|
183
|
+ $(this).parent().find('input').each(function(){
|
|
|
184
|
+ data[$(this).attr('name')] = $(this).val();
|
|
|
185
|
+ });
|
|
|
186
|
+
|
|
|
187
|
+ option.data = data;
|
|
|
188
|
+
|
|
|
189
|
+ $.ajax(option).done(function(data){
|
180
|
var json = formatJson(data);
|
190
|
var json = formatJson(data);
|
181
|
panel.html(json);
|
191
|
panel.html(json);
|
182
|
});
|
192
|
});
|
183
|
});
|
193
|
});
|
184
|
-})
|
194
|
+});
|
185
|
</script>
|
195
|
</script>
|
186
|
</body>
|
196
|
</body>
|
187
|
</html> |
197
|
</html> |