|
116 | 116 | <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>
|
117 | 117 | <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>
|
118 | 118 | <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> |
119 | 120 | <a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 2)">生成代码(封装,解析) : {{ language || '例如 Java' }}</a>
|
120 | 121 | <a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 0)">数据库类型 Database: {{ database || '例如 MYSQL' }}</a>
|
121 | 122 | <a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 1)">数据库名/模式 Schema: {{ schema || '例如 sys' }}</a>
|
|
261 | 262 | ## 快捷键
|
262 | 263 | Ctrl + I 或 Command + I 格式化 JSON,清除所有注释和无效空格、换行等;
|
263 | 264 | Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
|
| 265 | +Ctrl + D 或 Command + D 删除 选中行; |
| 266 | +Ctrl + S 或 Command + S 保存当前请求; |
264 | 267 |
|
265 | 268 | #### 右上角设置项 > 预览请求输入框,显示对应的预览效果
|
266 | 269 | */
|
|
286 | 289 | ## 快捷键
|
287 | 290 | Ctrl + I 或 Command + I 格式化输入框,清除所有注释和无效空格、换行等;
|
288 | 291 | Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
|
| 292 | +Ctrl + D 或 Command + D 删除 选中行; |
| 293 | +Ctrl + S 或 Command + S 保存当前请求; |
289 | 294 |
|
290 | 295 | #### 右上角设置项 > 预览请求输入框,显示对应的预览效果
|
291 | 296 | */
|
|
441 | 446 | // ## 快捷键
|
442 | 447 | // Ctrl + I 或 Command + I 格式化文本,清除所有注释和无效空格、换行等;
|
443 | 448 | // Ctrl + / 或 Command + / 对选中行 新增行注释 或 取消行注释;
|
| 449 | +// Ctrl + D 或 Command + D 删除 选中行; |
| 450 | +// Ctrl + S 或 Command + S 保存当前请求; |
444 | 451 | </textarea>
|
445 | 452 | </div>
|
446 | 453 |
|
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= // 示例,支持单行注释 |
458 | 464 | My-Header: 'Secret' + Math.random() // 示例,代码执行结果作为实际值,值为 fun(arg0, arg1..) 等包含函数名与括号的格式
|
459 | 465 | // ## 快捷键
|
460 | 466 | // 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> |
462 | 490 | </div>
|
463 | 491 |
|
| 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 | + |
464 | 508 | </div>
|
465 | 509 | </div>
|
466 | 510 | </div>
|
|
661 | 705 | </svg>
|
662 | 706 |
|
663 | 707 | <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> |
665 | 709 | </div>
|
666 | 710 |
|
667 | 711 | <!--弹出设置文本框-->
|
|
888 | 932 | var vWarning = document.getElementById("vWarning");
|
889 | 933 | var vComment = document.getElementById("vComment");
|
890 | 934 | var vHeader = document.getElementById("vHeader");
|
| 935 | + var vScript = document.getElementById("vScript"); |
891 | 936 | var vRandom = document.getElementById("vRandom");
|
892 | 937 | var vOutput = document.getElementById("vOutput");
|
893 | 938 |
|
|
0 commit comments