Skip to content

Commit 143d8b2

Browse files
committed
Java:更新 APIAuto
1 parent 0478c83 commit 143d8b2

File tree

3 files changed

+1271
-240
lines changed

3 files changed

+1271
-240
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5928,7 +5928,7 @@ var CodeUtil = {
59285928
throw new Error('远程函数参数数量 ' + argLen + ' 非法!必须是 ' + allowArgLen + ' 个!格式为 ' + fun + '(' + StringUtil.trim(allowArgStr) + ')')
59295929
}
59305930

5931-
return CodeUtil.getType4Language(language, funObj.returntype) + ', ' + (funObj.rawDetail || funObj.detail)
5931+
return CodeUtil.getType4Language(language, funObj.returnType) + ', ' + (funObj.rawDetail || funObj.detail)
59325932
},
59335933

59345934
getFunctionFromList: function (name, method) {

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

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(StringUtil.isEmpty(host, true), 3)">{{ StringUtil.isEmpty(host, true) ? '隐藏(固定)URL Host: 可用空格隔开' : '显示(编辑)URL Host: \n' + host }}</a>
117117
<a style="border-bottom: #DDD 1px solid;width: 100%;display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;" href="javascript:void(0)" @click="showConfig(! isRandomShow, 5)">{{ isRandomShow ? '隐藏(固定)参数注入 Random Test' : '显示(编辑)参数注入 Random Test' }}</a>
118118
<a style="border-bottom: #DDD 1px solid;width: 100%;display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;" href="javascript:void(0)" @click="showConfig(! isHeaderShow, 4)">{{ (isHeaderShow ? '隐藏(固定)' : '显示(编辑)') + (isEditResponse ? '响应头 Response Header' : '请求头 Request Header' ) }}</a>
119+
<a style="border-bottom: #DDD 1px solid;width: 100%;display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;" href="javascript:void(0)" @click="showConfig(! isScriptShow, 13)">{{ (isScriptShow ? '隐藏(固定)' : '显示(编辑)') + '执行脚本 JavaScript' }}</a>
119120
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 2)">生成代码(封装,解析) : {{ language || '例如 Java' }}</a>
120121
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 0)">数据库类型 Database: {{ database || '例如 MYSQL' }}</a>
121122
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 1)">数据库名/模式 Schema: {{ schema || '例如 sys' }}</a>
@@ -261,6 +262,8 @@
261262
## 快捷键
262263
Ctrl + I 或 Command + I 格式化 JSON,清除所有注释和无效空格、换行等;
263264
Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
265+
Ctrl + D 或 Command + D 删除 选中行;
266+
Ctrl + S 或 Command + S 保存当前请求;
264267
265268
#### 右上角设置项 > 预览请求输入框,显示对应的预览效果
266269
*/
@@ -286,6 +289,8 @@
286289
## 快捷键
287290
Ctrl + I 或 Command + I 格式化输入框,清除所有注释和无效空格、换行等;
288291
Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
292+
Ctrl + D 或 Command + D 删除 选中行;
293+
Ctrl + S 或 Command + S 保存当前请求;
289294

290295
#### 右上角设置项 > 预览请求输入框,显示对应的预览效果
291296
*/
@@ -441,26 +446,65 @@
441446
// ## 快捷键
442447
// Ctrl + I 或 Command + I 格式化文本,清除所有注释和无效空格、换行等;
443448
// Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
449+
// Ctrl + D 或 Command + D 删除 选中行;
450+
// Ctrl + S 或 Command + S 保存当前请求;
444451
</textarea>
445452
</div>
446453

447-
448-
<div v-show="isHeaderShow" style="width: 100%; height: 150px; position: relative;" >
449-
<div class="left-bar" style="border-top: #DDD 1px solid; position: relative">
450-
<a style="padding-left: 10px;padding-right: 2px;font-size: medium;color: black" >{{ (isEditResponse ? '响应头 Response Header' : '请求头 Request Header' ) }}<a style="display: flex;flex-grow: 1;padding-right: 10px;padding-top: 2px"> (每行都按 key: value 格式)</a></a>
451-
<a class="hint--top @cli-tool" data-hint="隐藏" style="float: right;padding: 8px;height: 100%" href="javascript:void(0)" @click="showConfig(false, 4)">
452-
<svg class="icon close-icon" >
453-
<use xlink:href="svg/icon.svg#close"></use>
454-
</svg>
455-
</a>
456-
</div>
457-
<textarea id="vHeader" @copy="doOnCopy" @paste="doOnPaste" @keyup="onChange(true)" style="width: 100%;height: 100%;" wrap="off" placeholder="Authorization: Basic YWRtaW46YWRtaW4= // 示例,支持单行注释
454+
<div v-show="isHeaderShow" style="width: 100%; height: 150px; position: relative;" >
455+
<div class="left-bar" style="border-top: #DDD 1px solid; position: relative">
456+
<a style="padding-left: 10px;padding-right: 2px;font-size: medium;color: black" >{{ (isEditResponse ? '响应头 Response Header' : '请求头 Request Header' ) }}<a style="display: flex;flex-grow: 1;padding-right: 10px;padding-top: 2px"> (每行都按 key: value 格式)</a></a>
457+
<a class="hint--top @cli-tool" data-hint="隐藏" style="float: right;padding: 8px;height: 100%" href="javascript:void(0)" @click="showConfig(false, 4)">
458+
<svg class="icon close-icon" >
459+
<use xlink:href="svg/icon.svg#close"></use>
460+
</svg>
461+
</a>
462+
</div>
463+
<textarea id="vHeader" @copy="doOnCopy" @paste="doOnPaste" @keyup="onChange(true)" style="width: 100%;height: 100%;" wrap="off" placeholder="Authorization: Basic YWRtaW46YWRtaW4= // 示例,支持单行注释
458464
My-Header: 'Secret' + Math.random() // 示例,代码执行结果作为实际值,值为 fun(arg0, arg1..) 等包含函数名与括号的格式
459465
// ## 快捷键
460466
// Ctrl + I 或 Command + I 格式化文本,清除所有注释和无效空格、换行等;
461-
// Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;"></textarea>
467+
// Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
468+
// Ctrl + D 或 Command + D 删除 选中行;
469+
// Ctrl + S 或 Command + S 保存当前请求;"></textarea>
470+
</div>
471+
472+
<div v-show="isScriptShow" style="width: 100%; height: 240px; position: relative;" >
473+
<div class="left-bar" style="border-top: #DDD 1px solid; position: relative">
474+
<a href="javascript:void(0)" @click="changeScriptType('case')" :style="{'color': scriptType == 'case' ? 'red' : 'gray'}" style="padding-left: 10px; font-size: medium">用例</a><a v-show="getCurrentAccountId() != null">|<a v-show="getCurrentAccountId() != null" href="javascript:void(0)" @click="changeScriptType('account')" :style="{'color': scriptType == 'account' ? 'red' : 'gray'}" style="font-size: medium">账号</a></a><a>|</a><a href="javascript:void(0)" @click="changeScriptType('global')" :style="{'color': scriptType == 'global' ? 'red' : 'gray'}" style="font-size: medium">全局</a><a href="javascript:void(0)" @click="changeScriptPriority(true)" :style="{'color': isPreScript ? 'red' : 'gray'}" style="font-size: medium; padding-left: 10px">前置</a><a>|</a><a href="javascript:void(0)" @click="changeScriptPriority(false)" :style="{'color': isPreScript ? 'gray' : 'red'}" style="font-size: medium">后置</a><a style="display: flex;flex-grow: 1;padding-left: 10px;font-size: medium;color: black">执行脚本 JavaScript</a>
475+
<a class="hint--top @cli-tool" style="font-size: small;" data-hint="测试" href="javascript:void(0)" @click="onClickTestScript()">
476+
<img class="icon" src="img/refresh.png"/>
477+
</a>
478+
<a class="hint--top @cli-tool" data-hint="添加脚本" style="font-size:xx-large; margin-bottom: 2px; color: black;"
479+
href="javascript:void(0)" @click="showExport(true, true, false, true)"> + </a>
480+
<a v-show="false" href="javascript:void(0)" style="font-size: small;" class="hint--top" data-hint="上传/分享" @click="showExport(true, true)">
481+
<svg class="icon">
482+
<use xlink:href="svg/icon.svg#share"></use>
483+
</svg>
484+
</a>
485+
<a class="hint--top @cli-tool" data-hint="隐藏" style="float: right; padding: 8px; margin-top: 2px; height: 100%" href="javascript:void(0)" @click="showConfig(false, 13)">
486+
<svg class="icon close-icon" >
487+
<use xlink:href="svg/icon.svg#close"></use>
488+
</svg>
489+
</a>
462490
</div>
463491

492+
<!-- v-model 不允许调用方法 -->
493+
<textarea id="vScript" style="width: 100%;height: 100%;" wrap="off"
494+
v-model="scripts[scriptType][scriptBelongId][isPreScript ? 'pre' : 'post'].script"
495+
placeholder="// JavaScript 脚本
496+
// 逻辑代码 ..
497+
498+
function fun(arg0, arg1, arg2..) {
499+
// TODO 获取 token 或 自定义断言 等逻辑
500+
}
501+
fun(true, 1, 'a'..);
502+
503+
// .. 逻辑代码
504+
">
505+
</textarea>
506+
</div>
507+
464508
</div>
465509
</div>
466510
</div>
@@ -661,7 +705,7 @@
661705
</svg>
662706

663707
<input type="text" placeholder="请输入名称" v-model="exTxt.name" />
664-
<div style="display: inline-block; margin-top: 6px; padding-bottom: 0px"><button @click="exportTxt(0)">{{isExportRemote ? '上传' : '下载'}}</button><button v-show="isExportRemote && (isExportRandom != true || isEditResponse != true)" style="margin-left: 6px" @click="exportTxt(1)">{{isExportRandom ? '发布简单接口' : '分享'}}</button></div>
708+
<div style="display: inline-block; margin-top: 6px; padding-bottom: 0px"><button @click="exportTxt(0)">{{isExportRemote ? '上传' : '下载'}}</button><button v-show="isExportRemote && isExportScript != true && (isExportRandom != true || isEditResponse != true)" style="margin-left: 6px" @click="exportTxt(1)">{{isExportRandom ? '发布简单接口' : '分享'}}</button></div>
665709
</div>
666710

667711
<!--弹出设置文本框-->
@@ -888,6 +932,7 @@
888932
var vWarning = document.getElementById("vWarning");
889933
var vComment = document.getElementById("vComment");
890934
var vHeader = document.getElementById("vHeader");
935+
var vScript = document.getElementById("vScript");
891936
var vRandom = document.getElementById("vRandom");
892937
var vOutput = document.getElementById("vOutput");
893938

0 commit comments

Comments
 (0)