Skip to content

Commit 310022d

Browse files
committed
Java: MultiDataSource 中 AutoUI 新增 操作、HTTP Method, Content-Type 的下拉选项
1 parent 34e1780 commit 310022d

4 files changed

Lines changed: 116 additions & 18 deletions

File tree

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ textarea {
276276
padding-right: 10px;
277277
display: flex;
278278
align-items: center;
279-
z-index: 101;
279+
z-index: 102;
280280
background-color: #FFF;
281281
box-shadow: 1px 1px 1px rgba(244, 243, 243, 0.64)
282282
}

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/au/css/main.css

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,13 @@ a:active svg, a:hover svg{
176176
top: 0px;
177177
display: flex;
178178
align-items: center;
179-
z-index: 100;
179+
z-index: 101;
180180
background-color: #FFF;
181181
box-shadow: 1px 1px 1px rgba(244, 243, 243, 0.64)
182182
}
183+
.side-left > .left-bar {
184+
z-index: 101;
185+
}
183186

184187
.left-panel {
185188
height: 100%;
@@ -272,7 +275,7 @@ textarea {
272275
padding-right: 10px;
273276
display: flex;
274277
align-items: center;
275-
z-index: 100;
278+
z-index: 101;
276279
background-color: #FFF;
277280
box-shadow: 1px 1px 1px rgba(244, 243, 243, 0.64)
278281
}
@@ -336,7 +339,7 @@ textarea {
336339
display: inline-block;
337340
position: relative
338341
}
339-
.pop-btn:hover .pop, .pop:hover {
342+
.pop-btn:hover .pop, .pop:hover, .pop:focus-within {
340343
display: block;
341344
}
342345

@@ -489,7 +492,7 @@ textarea {
489492
top: 50px;
490493
bottom: 0;
491494
left: 40%;
492-
z-index: 100;
495+
z-index: 1000;
493496
cursor: w-resize;
494497
border-right: rgba(221, 221, 221, 0.34) 1px solid;
495498
border-left: rgba(221, 221, 221, 0.34) 1px solid;
@@ -580,6 +583,58 @@ table.diff thead th.texttitle {
580583
height: 15px;
581584
}
582585

586+
.method-pop {
587+
left: 0;
588+
right: auto;
589+
top: 100%
590+
}
591+
592+
.method-pop li {
593+
display: block;
594+
padding: 0;
595+
padding-right: 0;
596+
border-bottom: 0;
597+
overflow: visible;
598+
}
599+
600+
.method-pop li a {
601+
display: block;
602+
width: 100%;
603+
height: 28px;
604+
line-height: 28px;
605+
padding: 0;
606+
border-bottom: #DDD 1px solid;
607+
box-sizing: border-box;
608+
color: black;
609+
text-align: center;
610+
}
611+
612+
.type-pop {
613+
left: 0;
614+
right: auto;
615+
top: 100%
616+
}
617+
618+
.type-pop li {
619+
display: block;
620+
padding: 0;
621+
padding-right: 0;
622+
border-bottom: 0;
623+
overflow: visible;
624+
}
625+
626+
.type-pop li a {
627+
display: block;
628+
width: 100%;
629+
height: 28px;
630+
line-height: 28px;
631+
padding: 0;
632+
padding-left: 4px;
633+
border-bottom: #DDD 1px solid;
634+
box-sizing: border-box;
635+
color: black;
636+
text-align: left;
637+
}
583638

584639
.projects {
585640
margin: 0;

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/au/index.html

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,40 @@
160160
<!--<div :class="'side-left side-view-' + baseview">-->
161161
<div class="side-left" style="padding-bottom: -4px">
162162
<div v-show="! isTestCaseShow" class="left-bar" >
163-
<button class="transfer" id="vOperate" :disabled="isEditResponse" @click="changeOperate()">{{ getOperateName(operate) }}</button>
163+
<span class="pop-btn transfer">
164+
<button class="transfer" id="vOperate" :disabled="isEditResponse" @click="changeOperate()">{{ getOperateName(operate) }}</button>
165+
<ul class="historys pop type-pop" style="width: 100px;">
166+
<li ><a href="javascript:void(0)" :style="{color: operate == 'RECORD' ? 'red' : 'black'}" @click="changeOperate('RECORD')" >录制 RECORD</a></li>
167+
<li ><a href="javascript:void(0)" :style="{color: operate == 'REVIEW' ? 'red' : 'black'}" @click="changeOperate('REVIEW')" >查看 REVIEW</a></li>
168+
<li ><a href="javascript:void(0)" :style="{color: operate == 'REPLAY' ? 'red' : 'black'}" @click="changeOperate('REPLAY')" >回放 REPLAY</a></li>
169+
<li ><a href="javascript:void(0)" :style="{color: operate == 'HTTP' ? 'red' : 'black'}" @click="changeOperate('HTTP')" >HTTP 请求</a></li>
170+
</ul>
171+
</span>
172+
164173
<button v-show="operate != 'HTTP'" class="transfer" id="vTransfer" @click="transfer()">{{ isVideoFirst ? '视频' : '截屏' }}</button>
165-
<button v-show="isShowMethod()" class="transfer" style="width: 60px" id="vMethod" :disabled="isEditResponse" @click="changeMethod()">{{ getMethodName(method, type) }}</button>
166-
<button v-show="isShowType()" class="transfer" id="vType" :disabled="isEditResponse" @click="changeType()">{{ getTypeName(type, method) }}</button>
174+
<span v-show="isShowMethod()" class="pop-btn transfer" style="width: 60px">
175+
<button class="transfer" style="width: 60px" id="vMethod" :disabled="isEditResponse" @click="changeMethod()">{{ getMethodName(method, type) }}</button>
176+
<ul class="historys pop method-pop" style="width: 60px;">
177+
<li ><a href="javascript:void(0)" :style="{color: method == 'GET' ? 'red' : 'black'}" @click="changeMethod('GET')" >GET</a></li>
178+
<li ><a href="javascript:void(0)" :style="{color: method == 'POST' ? 'red' : 'black'}" @click="changeMethod('POST')" >POST</a></li>
179+
<li ><a href="javascript:void(0)" :style="{color: method == 'PUT' ? 'red' : 'black'}" @click="changeMethod('PUT')" >PUT</a></li>
180+
<li ><a href="javascript:void(0)" :style="{color: method == 'PATCH' ? 'red' : 'black'}" @click="changeMethod('PATCH')" >PATCH</a></li>
181+
<li ><a href="javascript:void(0)" :style="{color: method == 'DELETE' ? 'red' : 'black'}" @click="changeMethod('DELETE')" >DELETE</a></li>
182+
<li ><a href="javascript:void(0)" :style="{color: method == 'HEAD' ? 'red' : 'black'}" @click="changeMethod('HEAD')" >HEAD</a></li>
183+
<li ><a href="javascript:void(0)" :style="{color: method == 'OPTIONS' ? 'red' : 'black'}" @click="changeMethod('OPTIONS')" >OPTIONS</a></li>
184+
<li ><a href="javascript:void(0)" :style="{color: method == 'TRACE' ? 'red' : 'black'}" @click="changeMethod('TRACE')" >TRACE</a></li>
185+
</ul>
186+
</span>
187+
<span v-show="isShowType()" class="pop-btn transfer">
188+
<button class="transfer" id="vType" :disabled="isEditResponse" @click="changeType()">{{ getTypeName(type, method) }}</button>
189+
<ul class="historys pop type-pop" style="width: 250px;">
190+
<li ><a href="javascript:void(0)" :style="{color: type == 'PARAM' ? 'red' : 'black'}" @click="changeType('PARAM')" >PARAM // ?a=1&b=c&key=value</a></li>
191+
<li ><a href="javascript:void(0)" :style="{color: type == 'FORM' ? 'red' : 'black'}" @click="changeType('FORM')" >FORM // x-www-form-urlencoded</a></li>
192+
<li ><a href="javascript:void(0)" :style="{color: type == 'DATA' ? 'red' : 'black'}" @click="changeType('DATA')" >DATA // form-data</a></li>
193+
<li ><a href="javascript:void(0)" :style="{color: type == 'JSON' ? 'red' : 'black'}" @click="changeType('JSON')" >JSON // application/json</a></li>
194+
<li ><a href="javascript:void(0)" :style="{color: type == 'GRPC' ? 'red' : 'black'}" @click="changeType('GRPC')" >GRPC // application/json</a></li>
195+
</ul>
196+
</span>
167197
<div style="height: 100%;display: flex;flex-grow: 1">
168198
<input class="url" id="vUrlComment" :disabled="isEditResponse" type="text" style="width: 100%; position: absolute; z-index: -100; color: darkseagreen;background: #0000;" ></input>
169199
<textarea class="url" id="vUrl" :disabled="isEditResponse" type="text" @copy="doOnCopy" @paste="doOnPaste" @keyup="doOnKeyUp(event)"
@@ -600,7 +630,7 @@
600630
<div class="splitx" ></div>
601631

602632
<div class="side-right">
603-
<div class="right-inner" style="z-index: 100" >
633+
<div class="right-inner" style="z-index: 101" >
604634
<div class="right-bar">
605635
<div class="pull-left">
606636

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/au/js/main.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ https://github.com/Tencent/APIJSON/issues
748748
var HTTP_JSON_TYPES = [HTTP_METHOD_POST, REQUEST_TYPE_JSON, REQUEST_TYPE_GRPC]
749749
var HTTP_FORM_TYPES = [REQUEST_TYPE_FORM, HTTP_METHOD_PUT, HTTP_METHOD_DELETE]
750750
var HTTP_DATA_TYPES = [REQUEST_TYPE_DATA, HTTP_METHOD_PUT, HTTP_METHOD_DELETE]
751+
var HTTP_FORM_DATA_TYPES = [REQUEST_TYPE_DATA, HTTP_METHOD_PUT, HTTP_METHOD_DELETE]
751752
var HTTP_CONTENT_TYPES = [REQUEST_TYPE_PARAM, REQUEST_TYPE_FORM, REQUEST_TYPE_DATA, REQUEST_TYPE_JSON, REQUEST_TYPE_GRPC]
752753

753754
var CONTENT_TYPE_MAP = {
@@ -6451,7 +6452,10 @@ https://github.com/Tencent/APIJSON/issues
64516452

64526453
/**请求类型切换
64536454
*/
6454-
changeMethod: function () {
6455+
changeMethod: function (method) {
6456+
if (StringUtil.isNotEmpty(method)) {
6457+
CodeUtil.method = this.method = method
6458+
} else {
64556459
var methods = this.methods
64566460
var count = methods == null ? 0 : methods.length
64576461
if (count <= 0) {
@@ -6463,6 +6467,7 @@ https://github.com/Tencent/APIJSON/issues
64636467
var index = methods.indexOf(this.method) + 1
64646468
CodeUtil.method = this.method = methods[index % count]
64656469
}
6470+
}
64666471
this.onChange(false);
64676472
},
64686473

@@ -6508,7 +6513,10 @@ https://github.com/Tencent/APIJSON/issues
65086513
},
65096514
/**请求类型切换
65106515
*/
6511-
changeType: function () {
6516+
changeType: function (type) {
6517+
if (StringUtil.isNotEmpty(type)) {
6518+
CodeUtil.type = this.type = type
6519+
} else {
65126520
var types = this.types
65136521
var count = types == null ? 0 : types.length
65146522
if (count <= 0) {
@@ -6520,6 +6528,7 @@ https://github.com/Tencent/APIJSON/issues
65206528
var index = types.indexOf(this.type) + 1
65216529
this.type = types[index % count]
65226530
CodeUtil.type = this.type;
6531+
}
65236532
}
65246533

65256534
var url = StringUtil.trim(vUrl.value).replaceAll('\n', '')
@@ -6561,13 +6570,17 @@ https://github.com/Tencent/APIJSON/issues
65616570
},
65626571
/**操作类型切换
65636572
*/
6564-
changeOperate: function () {
6565-
var operates = this.operates || [OPERATE_TYPE_RECORD, OPERATE_TYPE_REVIEW, OPERATE_TYPE_REPLAY]
6566-
var count = operates.length
6567-
if (count > 1) {
6568-
var index = operates.indexOf(this.operate)
6569-
index++;
6570-
this.operate = operates[index % count]
6573+
changeOperate: function (operate) {
6574+
if (StringUtil.isNotEmpty(operate)) {
6575+
this.operate = operate
6576+
} else {
6577+
var operates = this.operates || [OPERATE_TYPE_RECORD, OPERATE_TYPE_REVIEW, OPERATE_TYPE_REPLAY]
6578+
var count = operates.length
6579+
if (count > 1) {
6580+
var index = operates.indexOf(this.operate)
6581+
index++;
6582+
this.operate = operates[index % count]
6583+
}
65716584
}
65726585

65736586
this.onChange(false);

0 commit comments

Comments
 (0)