加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 58.36 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
<!DOCTYPE html>
<html>
<head>
<title>APIAuto-机器学习零代码测试、生成代码与静态检查、生成文档与光标悬浮注释</title>
<meta charset="utf-8" />
<meta name="keywords" content="apijson,api,json,auto,apiauto,自动生成接口文档,自动化接口回归测试,机器学习接口回归测试,回归测试,机器学习,接口测试,API测试,自动化,API自动化,接口自动化,fastjson,json在线解析,json格式化验证"/>
<meta name="description" content="APIAuto-敏捷开发最强大易用的 HTTP 接口工具,机器学习零代码测试、生成代码与静态检查、生成文档与光标悬浮注释"/>
<!-- 登录 <<<<<<<<<<<<<<<<<<<< -->
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/login.css">
<!-- 登录 >>>>>>>>>>>>>>>>>>>> -->
<link href="css/hint.min.css" rel="stylesheet">
<!-- <link href="css/diffview.css" rel="stylesheet"> -->
<link href="css/loading.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link rel="stylesheet" href="md/css/editormd.preview.css" />
<style >
input[type=number] {
-moz-appearance:textfield;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
</style>
</head>
<body>
<style type="text/css">
.url {
height: 100%;
border: none;
display: flex;
align-items: center;
flex-grow: 1
/* justify-content: center */
}
.transfer {
width: 50px;
height: 100%;
margin: 0;
padding: 0;
}
.send {
width: 16%;
min-width: 30px;
max-width: 100px;
height: 100%;
margin: 0;
padding: 0;
}
.statement {
position: absolute;
bottom: 0px;
width: 100%;
text-align: center;
font-size: small;
z-index: 100;
background-color: white;
color: #bbb;
border-top: #fafafa 1px solid;
}
</style>
<div id="app" style="background-color: white">
<div class="side-top">
<img src="img/logo.png" class="logo-img"/>
<a class="logo" href="http://apijson.cn" target="_blank">
<span class="on">APIJSON</span><span >.cn</span>
</a>
<a v-show="isDelayShow" >2s</a>
<iframe v-show="User.id == null || User.id <= 0" src="https://ghbtns.com/github-btn.html?user=Tencent&amp;repo=APIJSON&amp;type=star&amp;count=true&amp;size=small" frameborder="0" scrolling="0" width="160px" height="18px"></iframe>
<!--只用60%避免拦截左右两侧View的触摸事件-->
<div style="width: 40%;height: 100%;left: 30%;display: inline-block;text-align: center;position: fixed;padding-top: 10px">
<a style="font-size: large;margin-left: 10px;margin-right: 10px;color: silver" href="https://github.com/Tencent/APIJSON/blob/master/Document.md" target="_blank" >文档</a>
<a style="font-size: large;margin-left: 10px;margin-right: 10px;color: silver" href="https://search.bilibili.com/all?keyword=APIJSON" target="_blank" >视频</a>
<a style="font-size: large;margin-left: 10px;margin-right: 10px;color: silver" href="https://github.com/search?o=desc&q=apijson&s=stars&type=Repositories" target="_blank" >生态</a>
</div>
<div class="top-right">
<a v-show="User.id == null || User.id <= 0" href="https://git.code.tencent.com/Tencent_Open_Source/APIJSON" target="_blank" >
<img class="ui inline black image" height="24" src="http://apijson.cn/images/tencent_open_logo.png">
</a>
<a v-show="User.id == null || User.id <= 0" href="https://gitee.com/Tencent/APIJSON" target="_blank">
<img class="ui inline black image" height="24" src="https://gitee.com/logo-black.svg?20171024" width="60">
</a>
<a v-show="User.id != null && User.id > 0" href="javascript:void(0)" @click="logout(true)">
退出
</a>
<a v-show="User.id == null || User.id <= 0" href="javascript:void(0)" @click="showLogin(true, true)">
登录
</a>
<span class="pop-btn">
<a href="javascript:void(0)" style="padding: 14px">
{{ User.id != null && User.id > 0 ? User.name : '设置' }}
</a>
<ul class="themes pop" style="z-index: 200;padding: 0px;margin-top: 8px;width: 300px">
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(! isDelegateEnabled, 9)">托管服务器代理: {{ isDelegateEnabled ? '已开启,点击关闭' : '已关闭,点击开启' }}</a>
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(! isEncodeEnabled, 12)">自动 URL 转义: {{ isEncodeEnabled ? '已开启,点击关闭' : '已关闭,点击开启' }}</a>
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(! isPreviewEnabled, 10)">预览左侧输入框: {{ isPreviewEnabled ? '已开启,点击关闭' : '已关闭,点击开启' }}</a>
<a v-show="User.id != null && User.id > 0" style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(! isEditResponse, 11)">当前编辑模式: {{ isEditResponse ? 'Response 后端响应结果' : 'Request 前端请求参数' }}</a>
<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>
<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>
<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>
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 2)">生成代码(封装,解析) : {{ language || '例如 Java' }}</a>
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 0)">数据库类型 Database: {{ database || '例如 MYSQL' }}</a>
<a style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 1)">数据库名/模式 Schema: {{ schema || '例如 sys' }}</a>
<a v-show="User.id == null || User.id <= 0" style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 7)">使用的请求类型: {{ types == null || types.length <= 0 ? '点击设置' : (types instanceof Array ? types.join() : types) }}</a>
<a v-show="User.id == null || User.id <= 0" style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 6)">托管服务器地址 URL: {{ server || '点击设置' }}</a>
<a v-show="User.id != null && User.id > 0" style="border-bottom: #DDD 1px solid;width: 100%" href="javascript:void(0)" @click="showConfig(true, 8)">导入第三方文档(平台名 URL): <br/>{{ thirdParty || '点击设置' }}</a>
</ul>
</span>
<!-- 部分头像加载不出,或者显示为开源中国LOGO -->
<!--<img v-show="User.id != null && User.id > 0" href="javascript:void(0)" @click="logout()" :src="User.head"-->
<!--style="width: 100%; height: 100%; padding: 10%;"/>-->
</div>
</div>
<!--<div :class="'side-left side-view-' + baseview">-->
<div class="side-left">
<div v-show="! isTestCaseShow" class="left-bar" >
<button class="transfer" id="vTransfer" @click="transfer()">' / "</button>
<button v-show="types != null && types.length > 1" class="transfer" id="vType" :disabled="isEditResponse" @click="changeType()">{{ getTypeName(type) }}</button>
<div style="height: 100%;display: flex;flex-grow: 1">
<input class="url" id="vUrlComment" :disabled="isEditResponse" type="text" style="width: 100%; position: absolute; z-index: -100; color: darkseagreen;background: #0000;" />
<input class="url" id="vUrl" :disabled="isEditResponse" type="text" @keyup="doOnKeyUp(event)" placeholder="请输入请求的接口地址" style="z-index: 0; background: #0000;" />
</div>
<button class="send" id="vSend" @click="onClickSend()">{{ isEditResponse ? '模拟返回' : '发送请求' }}</button>
</div>
<div v-show="isTestCaseShow" class="left-bar">
<!--<svg class="icon" style="margin-left: 10px">-->
<!--<use xlink:href="svg/icon.svg#share"></use>-->
<!--</svg>-->
<a style="display: flex;flex-grow: 1;font-size: medium;color: black" class="hint--top save-tool" data-hint="点击切换" href="javascript:void(0)" @click="showTestCase(true, ! isLocalShow)">测试用例:{{ (isLocalShow ? '本地历史(' : '远程共享(') + (testCases == null ? 0 : testCases.length) + ')' }}</a>
<a v-show="! isLocalShow" class="hint--top save-tool" data-hint="点击切换" href="javascript:void(0)" @click="enableCross(! isCrossEnabled)">{{ crossProcess }}</a>
<a v-show="! isLocalShow" class="hint--top save-tool" data-hint="点击切换" href="javascript:void(0)" @click="enableML(! isMLEnabled)">{{ testProcess }}</a>
<a v-show="! isLocalShow" class="hint--top @cli-tool" data-hint="回归测试" href="javascript:void(0)" @click="onClickTest()">
<img class="icon" src="img/refresh.png"/>
</a>
<a v-show="isLocalShow" class="hint--top @cli-tool" data-hint="清空" href="javascript:void(0)" @click="clearLocal()">
<svg class="icon" >
<use xlink:href="svg/icon.svg#trash"></use>
</svg>
</a>
</div>
<div v-show="isTestCaseShow && ! isLocalShow" style="bottom: 4px; padding: 4px 13px 0px 10px; position: absolute; width: 100%; text-align: right; background-color: white; z-index: 100">
<a >搜索</a>
<input id="vTestCaseSearch" v-model="testCaseSearch" style="min-width: 60px; display: inline-flex; text-align: center" @keyup="doOnKeyUp(event, 'testCase', true)" />
<button @click="pageDown('testCase')">上一页</button>
<input id="vTestCasePage" v-model="testCasePage" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'testCase', true)" />
<button @click="pageUp('testCase')">下一页</button>
<a >每页</a>
<input id="vTestCaseCount" v-model="testCaseCount" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'testCase', true)" />
<a ></a>
</div>
<div class="left-panel">
<ul v-show="isTestCaseShow" class="historys" style="width: 100%;height: 100%;overflow: hidden;overflow-y: scroll;padding-bottom: 50px">
<li v-for="(item, index) in testCases" >
<div style="display: inline-table">
<button v-show="types != null && types.length > 1" style="width: 48px;margin-right: 6px;padding: 0px;position: relative" id="vDocType" @click="restoreRemoteAndTest(index, item)">{{ getTypeName(item.Document.type) }}</button>
<a class="hint--rounded hint--no-animate" ref="testCaseTexts" @mouseover="setRequestHint(index, item)" href="javascript:void(0)" @click="restoreRemote(index, item)" :style="{ color: index == currentDocIndex ? 'black' : 'gray' }"> {{(item.Document.version > 0 ? 'V' + item.Document.version : 'V*') + ' ' + item.Document.name + ' ' + item.Document.url}}</a>
<div :style="{ background: item.compareColor }" v-show="item.compareType != null" style="position: absolute;top: 8px;right: 36px;display: inline-block;">
<button class="hint--left" ref="testResultButtons" @mouseover="setTestHint(index, item)" v-show="item.compareType != null" @click="handleTest(false, index, item)" style="position: relative;">{{ item.compareMessage + (item.showType == 'before' ? '-前' : '-后') }}</button>
<svg class="icon" style="position: relative;margin-left: 10px" @click="downloadTest(index, item)">
<use xlink:href="svg/icon.svg#export-txt"></use>
</svg> <!-- 中间 button 仅用来占位,解决上面按钮隐藏后,下载图标纵向没对齐 -->
<button v-show="(item.showType != 'before' && item.compareType != 0) || (item.showType == 'before' && (item.TestRecord || {}).id != null)" @click="handleTest(true, index, item)">{{ item.showType == 'before' ? '错的,撤回' : '对的,纠正' }}</button><button v-show="! ((item.showType != 'before' && item.compareType != 0) || (item.showType == 'before' && (item.TestRecord || {}).id != null))" style="color: white;background: white;border-color: white;" disabled>对的,纠正</button><button style="padding-left: 1px; padding-right: 1px; width: 50px" :style="{ color: item.durationColor }" class="hint--left" ref="testResultDurationButtons" @mouseover="setTestHint(index, item, false, true)" @click="handleTest(true, index, item, false, true)">{{ (item.showType == 'before' ? item.durationBeforeShowStr : item.durationShowStr) || '?' }}</button>
</div>
<svg v-show="isLocalShow || (item.Document != null && item.Document.userId == User.id)" class="icon" style="margin-right: 5px; top: 13px" @click="remove(item, index, true)">
<use xlink:href="svg/icon.svg#trash"></use>
</svg>
</div>
</li>
</ul>
<div v-show="! isTestCaseShow" style="width: 100%;height: 100%;" >
<div v-show="! isPreviewEnabled" style="width: 100%;height: 100%;position: absolute;display: flex;flex-grow: 1" >
<textarea id="vComment" style="width: 100%; height: 100%; position: absolute; z-index: 0; color: darkseagreen; background-color: white;" wrap="off" disabled>
</textarea>
<textarea v-show="! isEditResponse" id="vWarning" style="width: 100%; height: 100%; position: absolute; z-index: 0; color: orangered; background-color: #0000;" wrap="off" disabled>
</textarea>
<textarea id="vInput" @keyup="onChange(true)" style="width: 100%;height: 100%; position: absolute; z-index: 100; background: #0000;" wrap="off" placeholder="{ // 根对象,可在内部加 format,tag,version,@role,@database,@schema,@datasource,@explain,@cache 等全局关键词键值对
'[]': { // 数组,可在内部加 count,page,query,join 等关键词键值对
'count': 5, // 每页数量
'page': 0, // 分页页码
'join': '</User/id@', // 多表连接:LEFT JOIN User,同一层级必须有 'User':{ 'id@':'/../..' }
'Moment': { // 动态
'@order': 'date+', // 排序方式:+升序,-降序
'@column': 'id,userId;date_format(date,%Y-%m-%d %H:%m)', // 返回字段,可传 字段(:别名)、SQL 函数(:别名,用分号 ; 隔开)、表达式,以及部分 SQL 关键词
'@explain': true, // 性能分析:true-开启 false-关闭,返回执行的 SQL 及查询计划
'content~': 'o', // 正则匹配 < content: String(300)? 内容
'userId!': 82001, // 都不符合 < userId: Int(15), 用户id
'@combine': 'userId!,content~' // 条件组合,| 可省略。合并同类,外层按照 & | ! 顺序,内层按传参顺序组合成 (key0 & key1 & key6 & 其它key) & (key2 | key3 | key7) & !(key4 | key5)
},
'User': { // 用户公开信息表。 对安全要求高,不想泄漏真实名称。对外名称为 User
'id@': '/Moment/userId', // 引用赋值,从对象父级开始的相对(缺省)路径 < id: Int(15), 唯一标识
'@column': 'id,name,head' // 返回字段,可传 字段(:别名)、SQL 函数(:别名,用分号 ; 隔开)、表达式,以及部分 SQL 关键词
},
'[]': { // 数组,可在内部加 count,page,query,join 等关键词键值对
'count': 6, // 每页数量
'join': '@/User/id@', // 多表连接:APP JOIN User,同一层级必须有 'User':{ 'id@':'/../..' }
'Comment': { // 评论
'@order': 'date-', // 排序方式:+升序,-降序
'momentId@': '[]/Moment/id' // 引用赋值,从最外层开始的绝对(完整)路径 < momentId: Int(15), 动态id
},
'User': { // 用户公开信息表。 对安全要求高,不想泄漏真实名称。对外名称为 User
'id@': '/Comment/userId', // 引用赋值,从对象父级开始的相对(缺省)路径 < id: Int(15), 唯一标识
'@column': 'DISTINCT id,name;concat(%,name,%):concat' // 返回字段,可传 字段(:别名)、SQL 函数(:别名,用分号 ; 隔开)、表达式,以及部分 SQL 关键词
}
}
}
}
/*
JSON 右侧可以写行注释,两个空格加两个斜杆 ' //' 开头;
JSON 下方可以写段注释,'/*' 开头 '*/' 结尾,都在每行最前,
段注释可以是普通文本或 Markdown 格式文本,一般用于枚举值等额外说明。
### 例如一个表格
开发流程 | 传统方式 | APIJSON
--- | --- | ---
实现接口 | 写代码 + 写文档 | 都不用写
兼容旧版 | v2, v3.. 接口 | 都不用写
### 例如一段代码
```js
// 前端解析并打印 Response JSON
var list = data['[]'] || []
for (var i = 0; i < list.length; i ++) {
console.log('[]/' + i + '=' + JSON.stringify(list[i]))
}
```
### 例如一张图片
![](http://apijson.cn/images/logo-big.png)
## 快捷键
Ctrl + I 或 Command + I 格式化 JSON
#### 右上角设置项 > 预览请求输入框,显示对应的预览效果
*/
" >
{
"User": {
"id": 82001
},
"[]": {
"Comment": {
"userId@": "User/id"
}
}
}
/*
以上 JSON 文本支持 JSON5 格式。清空文本内容可查看规则。
注释可省略。行注释前必须有两个空格;段注释必须在 JSON 下方。
## 快捷键
Ctrl + I 或 Command + I 格式化 JSON
#### 右上角设置项 > 预览请求输入框,显示对应的预览效果
*/
</textarea>
</div>
<div id="vRequestMarkdown" v-show="isPreviewEnabled" style="width: 100%;height: 100%;position: relative;"></div>
<div style="width: 100%; height: auto; position: absolute;bottom: 0px; z-index: 100; background: white;" >
<div v-show="isRandomShow" style="width: 100%; height: 330px; position: relative;" >
<div class="left-bar" style="border-top: #DDD 1px solid; position: relative">
<input v-show="isRandomListShow != true && isRandomSubListShow != true" id="vTestRandomCount" v-model="testRandomCount" style="margin-left: 10px; min-width: 12px; max-width: 30px; width: auto; text-align: center" type="number" />
<a v-show="isRandomListShow != true && isRandomSubListShow != true" style="margin-left: 4px;"></a>
<a style="display: flex;flex-grow: 1;padding-left: 10px;padding-right: 2px;font-size: medium;color: black" >{{ (isRandomListShow || StringUtil.isEmpty(randomTestTitle, true) ? '随机测试 Random Test' : randomTestTitle) + (isRandomListShow || isRandomSubListShow ? ' (' + ((isRandomListShow ? randoms : randomSubs) || []).length + ')' : '') }}
<a style="padding-right: 10px;padding-top: 2px">
{{ testRandomProcess }}
</a>
<a v-show="isRandomListShow != true && (currentRemoteItem || {}).Document != null" style="padding-right: 10px;padding-top: 2px" href="javascript:void(0)" @click="showRandomList(true, (currentRemoteItem || {}).Document)">
查看父项列表
</a>
</a>
<a v-show="(currentRemoteItem || {}).Document != null" class="hint--top @cli-tool" data-hint="添加" style="font-size:xx-large; margin-bottom: 2px; color: black;"
href="javascript:void(0)" @click="if(isRandomListShow || isRandomSubListShow) { randomTestTitle = null; isRandomListShow = false; isRandomSubListShow = false; } else { showExport(true, true, true) }"> + </a>
<a v-show="false" href="javascript:void(0)" style="font-size: small;" class="hint--top" data-hint="上传/共享" @click="showExport(true, true)">
<svg class="icon">
<use xlink:href="svg/icon.svg#share"></use>
</svg>
</a>
<a class="hint--top @cli-tool" style="font-size: small;" data-hint="测试" href="javascript:void(0)" @click="onClickTestRandom()">
<img class="icon" src="img/refresh.png"/>
</a>
<a class="hint--top @cli-tool" data-hint="隐藏" style="float: right;padding: 8px;height: 100%" href="javascript:void(0)" @click="showConfig(false, 5)">
<svg class="icon close-icon" >
<use xlink:href="svg/icon.svg#close"></use>
</svg>
</a>
</div>
<!-- 临时生成的配置子项 -->
<ul v-show="isRandomSubListShow" class="historys" style="width: 100%;height: 100%;overflow: hidden;overflow-y: scroll; padding-bottom: 100px">
<li style="width: 100%" v-for="(item, index) in randomSubs" >
<a v-show="! isRandomEditable" class="hint--rounded hint--no-animate" ref="randomSubTexts" @mouseover="setRequestHint(index, item, true)" href="javascript:void(0)" @click="restoreRandom(index, item)" :style="{ color: index == currentRandomSubIndex ? 'black' : 'gray' }">{{ (item.Random || {}).name }}</a>
<input v-show="isRandomEditable" style="width: 96%" v-model="(item.Random || {}).name" @keyup="doOnKeyUp(event, 'randomSub', false, item)" />
<div :style="{ background: item.compareColor }" v-show="! isRandomEditable && item.compareType != null" style="position: absolute;top: 8px;right: 36px;display: inline-block;">
<button class="hint--left" ref="testRandomSubResultButtons" @mouseover="setTestHint(index, item, true)" v-show="item.compareType != null" @click="handleTest(false, index, item, true)" style="position: relative;">{{ item.compareMessage + (item.showType == 'before' ? '-前' : '-后') }}</button>
<svg class="icon" style="position: relative;margin-left: 10px" @click="downloadTest(index, item, true)">
<use xlink:href="svg/icon.svg#export-txt"></use>
</svg> <!-- 中间 button 仅用来占位,解决上面按钮隐藏后,下载图标纵向没对齐 -->
<button v-show="(item.showType != 'before' && item.compareType != 0) || (item.showType == 'before' && (item.TestRecord || {}).id != null)" @click="handleTest(true, index, item, true)">{{ item.showType == 'before' ? '错的,撤回' : '对的,纠正' }}</button><button v-show="! ((item.showType != 'before' && item.compareType != 0) || (item.showType == 'before' && (item.TestRecord || {}).id != null))" style="color: white;background: white;border-color: white;" disabled>对的,纠正</button><button style="padding-left: 1px; padding-right: 1px; width: 50px" :style="{ color: item.durationColor }" class="hint--left" ref="testRandomSubResultDurationButtons" @mouseover="setTestHint(index, item, true, true)" @click="handleTest(true, index, item, true, true)">{{ (item.showType == 'before' ? item.durationBeforeShowStr : item.durationShowStr) || '?' }}</button>
</div>
<svg v-show="item.Random != null && item.Random.userId == User.id" class="icon" style="margin-right: 5px; top: 13px" @click="remove(item, index, true, true)">
<use xlink:href="svg/icon.svg#trash"></use>
</svg>
</li>
</ul>
<div v-show="isRandomSubListShow" style="bottom: 0px; padding: 4px 13px 4px 10px; position: absolute; width: 100%; text-align: right; background-color: white; z-index: 100">
<a >搜索</a>
<input id="vRandomSubSearch" v-model="randomSubSearch" style="min-width: 60px; display: inline-flex; text-align: center" @keyup="doOnKeyUp(event, 'randomSub', true)" />
<button @click="pageDown('randomSub')">上一页</button>
<input id="vRandomSubPage" v-model="randomSubPage" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'randomSub', true)" />
<button @click="pageUp('randomSub')">下一页</button>
<a >每页</a>
<input id="vRandomSubCount" v-model="randomSubCount" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'randomSub', true)" />
<a ></a>
</div>
<!-- 持久化存储的配置项 -->
<ul v-show="isRandomListShow" class="historys" style="width: 100%;height: 100%;overflow: hidden;overflow-y: scroll;padding-bottom: 100px">
<li style="width: 100%; display: inline-table" v-for="(item, index) in randoms" >
<input v-model="(item.Random || {}).count" style="min-width: 12px; max-width: 30px; width: auto; text-align: center" type="number" @keyup="doOnKeyUp(event, 'random', false, item)" />
<a style="margin-left: 4px; "></a>
<a v-show="! isRandomEditable" style="top: 13px; left: 68px; position: absolute" class="hint--rounded hint--no-animate" ref="randomTexts" @mouseover="setRequestHint(index, item, true)" href="javascript:void(0)" @click="restoreRandom(index, item)" :style="{ color: index == currentRandomIndex ? 'black' : 'gray' }">{{ (item.Random || {}).name }}</a>
<input v-show="isRandomEditable" style="top: 10px; left: 68px; position: absolute; display: inline-flex; width: 64%" v-model="(item.Random || {}).name" @keyup="doOnKeyUp(event, 'random', false, item)" />
<button v-show="((item.Random || {}).count || 0) > 1 && (item.totalCount || 0) <= 0" style="position: absolute;top: 10px;right: 36px;display: inline-block;" @click="handleTest(true, index, item, true)">{{ '查看 ' + ((item.subs || item['[]']) || []).length + ' 个子项' }}</button>
<div v-show="((item.Random || {}).count || 0) > 1 && (item.totalCount || 0) > 0" style="background: lightgray; position: absolute; padding: 1px; top: 10px;right: 36px;display: inline-block" @click="handleTest(true, index, item, true)">
<!-- 只能写成一行来消除间隙,不能换行、空格 -->
<a style="background: transparent; color: black; position: relative; min-width: 6px; width: auto; height: 100%; margin: 0; padding: 2px">{{ (item.totalCount || 0) + ':' }}</a><a style="background: white; color: black; position: relative; min-width: 6px; width: auto; height: 100%; margin: 0; padding: 2px">{{ item.whiteCount || 0 }}</a><a style="background: green; color: white; position: relative; min-width: 6px; width: auto; height: 100%; margin: 0; padding: 2px">{{ (item || {}).greenCount || 0 }}</a><a style="background: blue; color: white; position: relative; min-width: 6px; width: auto; height: 100%; margin: 0; padding: 2px">{{ (item || {}).blueCount || 0 }}</a><a style="background: orange; color: white; position: relative; min-width: 6px; width: auto; height: 100%; margin: 0; padding: 2px">{{ (item || {}).orangeCount || 0 }}</a><a style="background: red; color: white; position: relative; min-width: 6px; width: auto; height: 100%; margin: 0; padding: 2px">{{ (item || {}).redCount || 0 }}</a>
</div>
<div v-show="! isRandomEditable && ((item.Random || {}).count || 1) <= 1" style="position: absolute;top: 10px;right: 36px;display: inline-block;">
<div :style="{ background: item.compareColor }" v-show="item.compareType != null" >
<button class="hint--left" ref="testRandomResultButtons" @mouseover="setTestHint(index, item, true)" v-show="item.compareType != null" @click="handleTest(false, index, item, true)" style="position: relative;">{{ item.compareMessage + (item.showType == 'before' ? '-前' : '-后') }}</button>
<svg class="icon" style="position: relative;margin-left: 10px" @click="downloadTest(index, item, true)">
<use xlink:href="svg/icon.svg#export-txt"></use>
</svg> <!-- 中间 button 仅用来占位,解决上面按钮隐藏后,下载图标纵向没对齐 -->
<button v-show="(item.showType != 'before' && item.compareType != 0) || (item.showType == 'before' && (item.TestRecord || {}).id != null)" @click="handleTest(true, index, item, true)">{{ item.showType == 'before' ? '错的,撤回' : '对的,纠正' }}</button><button v-show="! ((item.showType != 'before' && item.compareType != 0) || (item.showType == 'before' && (item.TestRecord || {}).id != null))" style="color: white;background: white;border-color: white;" disabled>对的,纠正</button><button style="padding-left: 1px; padding-right: 1px; width: 50px" :style="{ color: item.durationColor }" class="hint--left" ref="testRandomResultDurationButtons" @mouseover="setTestHint(index, item, true, true)" @click="handleTest(true, index, item, true, true)">{{ (item.showType == 'before' ? item.durationBeforeShowStr : item.durationShowStr) || '?' }}</button>
</div>
</div>
<svg v-show="item.Random != null && item.Random.userId == User.id" class="icon" style="margin-right: 5px; top: 13px" @click="remove(item, index, true, true)">
<use xlink:href="svg/icon.svg#trash"></use>
</svg>
</li>
</ul>
<div v-show="isRandomListShow" style="bottom: 0px; padding: 4px 13px 4px 10px; position: absolute; width: 100%; text-align: right; background-color: white; z-index: 100">
<a >搜索</a>
<input id="vRandomSearch" v-model="randomSearch" style="min-width: 60px; display: inline-flex; text-align: center" @keyup="doOnKeyUp(event, 'random', true)" />
<button @click="pageDown('random')">上一页</button>
<input id="vRandomPage" v-model="randomPage" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'random', true)" />
<button @click="pageUp('random')">下一页</button>
<a >每页</a>
<input id="vRandomCount" v-model="randomCount" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'random', true)" />
<a ></a>
</div>
<textarea id="vRandom" style="width: 100%;height: 100%;" wrap="off"
placeholder="# 常用:
RANDOM_IN(val0:Any, val1:Any ...) // 从选项内随机取值
RANDOM_INT(min:Integer, max:Integer) // 从范围内随机取整数
RANDOM_DB(min:Integer, max:Integer, table:String, column:String) // 从数据库随机取值
RANDOM_NUM(min:Number, max:Number, precision:Integer) // 从范围内随机取小数
RANDOM_STR(minLength:Integer, maxLength:Integer, regexp:String) // 从长度范围内随机取字符串
ORDER_IN(val0:Any, val1:Any ...) // 从选项内顺序取值
ORDER_INT(min:Integer, max:Integer) // 从范围内顺序取整数
ORDER_DB(min:Integer, max:Integer, table:String, column:String) // 从数据库顺序取值
其中 RANDOM 开头的是随机函数;ORDER 开头的是顺序函数,可以使用 + - 升降序 和 step 跨步,例如 ORDER_IN-(1, 2, 3) 降序取值,ORDER_INT+3(0, 100) 间隔 step = 3 位来升序取整数。
# 模板:
format: ORDER_IN(true, false, null, undefined) // 从选项中顺序取值
User/id: RANDOM_DB() // 从数据库随机取值,等价于 User/id: RANDOM_DB(null, null, 'User', 'id')
[]/page: Math.round(100*Math.random()) // 通过 JavaScript 代码来自定义 [] 内的 page
">
User/id: RANDOM_INT(82001, 82020) // 随机整数
[]/count: RANDOM_IN(5, 10, 's', false, [], {}) // 随机取值
[]/page: Math.round(5*Math.random()) // 通过代码来自定义
@explain: ORDER_IN(true, false) // 顺序取值
// 从数据库随机取值 []/Comment/toId: RANDOM_DB()
// 注释可省略,但如果未省略则前面两个空格必须;清空文本内容可查看规则。</textarea>
</div>
<div v-show="isHeaderShow" style="width: 100%; height: 150px; position: relative;" >
<div class="left-bar" style="border-top: #DDD 1px solid; position: relative">
<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>
<a class="hint--top @cli-tool" data-hint="隐藏" style="float: right;padding: 8px;height: 100%" href="javascript:void(0)" @click="showConfig(false, 4)">
<svg class="icon close-icon" >
<use xlink:href="svg/icon.svg#close"></use>
</svg>
</a>
</div>
<textarea id="vHeader" @keyup="onChange(true)" style="width: 100%;height: 100%;" wrap="off" placeholder="Authorization: Basic YWRtaW46YWRtaW4= // 示例,支持单行注释
My-Header: 'Secret' + Math.random() // 示例,代码执行结果作为实际值,值为 fun(arg0, arg1..) 等包含函数名与括号的格式 "></textarea>
</div>
</div>
</div>
</div>
</div>
<div class="splitx" ></div>
<div class="side-right">
<div class="right-inner">
<div class="right-bar">
<div class="pull-left">
<a v-show="! isExpand" href="javascript:void(0)" class="hint--top" data-hint="全部展开" @click="expandAll()">
<svg class="icon" >
<use xlink:href="svg/icon.svg#expand"></use>
</svg>
</a>
<a v-show="isExpand" href="javascript:void(0)" class="hint--top" data-hint="全部折叠" @click="collapseAll()">
<svg class="icon" >
<use xlink:href="svg/icon.svg#collapse"></use>
</svg>
</a>
<span class="pop-btn" > <!--v-show="historys.length > 0">-->
<a class="hint--top save-tool" data-hint="保存到本地" href="javascript:void(0)" @click="showSave(true)">
<svg class="icon">
<use xlink:href="svg/icon.svg#save"></use>
</svg>
</a>
<ul class="historys pop" style="width: 304px"> <!-- 没必要太长,遮挡范围过大 // 490 刚好与 URL 输入框左对齐 -->
<li v-for="(his, index) in historys">
<a href="javascript:void(0)" @click="restore(his, his.response)" > {{his.name}}</a>
<svg class="icon" @click="remove(his, index, false)">
<use xlink:href="svg/icon.svg#trash"></use>
</svg>
</li>
</ul>
</span>
<a v-show="isTestCaseShow" class="hint--top" data-hint="隐藏共享用例" href="javascript:void(0)">
<svg class="icon" @click="showTestCase(false, isLocalShow)">
<use xlink:href="svg/icon.svg#record"></use>
</svg>
</a>
<a v-show="! isTestCaseShow" class="hint--top" data-hint="查看共享用例" href="javascript:void(0)">
<svg class="icon" @click="showTestCase(true, isLocalShow)">
<use xlink:href="svg/icon.svg#record"></use>
</svg>
</a>
</div>
<div class="pull-center" >
<ul style="width: 100%; padding-left: 18px;padding-right: 18px;" >
<li style="width: 100%; display: inline-block;text-align: center;">
<button style="background-color: #DDD;margin: 0px;outline: none;border: #DDD 1px solid;" href="javascript:void(0)" @click="removeAccountTab()"> - </button>
<button style="outline: none;border: #DDD 1px solid;" :style="{backgroundColor: currentAccountIndex == index ? 'transparent' : '#DDD', color: item.isLoggedIn ? 'red' : 'black'}" v-for="(item, index) in accounts" @click="onClickAccount(index, item)">{{ item.name }}</button>
<button style="background-color: #DDD;margin: 0px;outline: none;border: #DDD 1px solid;" href="javascript:void(0)" @click="addAccountTab()"> + </button>
</li>
</ul>
</div>
<div class="pull-right">
<a href="javascript:void(0)" class="hint--top" data-hint="下载" @click="showExport(true, false)">
<svg class="icon">
<use xlink:href="svg/icon.svg#export-txt"></use>
</svg>
</a>
<a href="javascript:void(0)" class="hint--top" data-hint="上传/共享" @click="showExport(true, true)">
<svg class="icon">
<use xlink:href="svg/icon.svg#share"></use>
</svg>
</a>
<span class="pop-btn">
<a class="hint--top" data-hint="换肤" href="javascript:void(0)" @click="isThemeShow = true">
<svg class="icon">
<use xlink:href="svg/icon.svg#theme"></use>
</svg>
</a>
<div class="themes pop">
<div :class="'theme-item ' + (index === checkedTheme)" v-for="(theme, index) in themes" @click="switchTheme(index)">
<span class="theme-color" v-for="color in theme" :style="{backgroundColor: color}" ></span>
</div>
</div>
</span>
</div>
</div>
<div class="right-main" v-show="baseview == 'formater' && view != 'error'" >
<!--正常JSON格式化视图-->
<div style="position: relative" class="view-code" v-show="view == 'code'">
<vue-outer :jsondata="jsonhtml" isend="true" :theme="theme"></vue-outer>
</div>
<!--空视图-->
<div class="view-code" v-show="view == 'empty'">
</div>
<!--压缩视图-->
<textarea v-show="view == 'compress'">{{compressStr}}</textarea>
<textarea id="vOutput" v-show="view == 'output'"></textarea>
<div class="right-main" id="vMarkdown" v-show="view == 'markdown'"></div>
<div v-show="view == 'markdown'" style="bottom: -6px; text-align: right; position: absolute; width: 100%; padding: 4px 20px 0px 4px; background-color: white;">
<a >搜索</a>
<input id="vSearch" v-model="search" style="min-width: 60px; display: inline-flex; text-align: center" @keyup="doOnKeyUp(event, 'document', true)" />
<button @click="pageDown('document')">上一页</button>
<input id="vPage" v-model="page" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'document', true)" />
<button @click="pageUp('document')">下一页</button>
<a >每页</a>
<input id="vCount" v-model="count" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'document', true)" />
<a ></a>
</div>
</div>
<!--格式化错误视图-->
<div class="view-error" v-show="view == 'error'">
<pre v-cloak>{{error.msg}}</pre>
</div>
<!--diff视图-->
<!-- <div id="diffoutput" v-show="baseview == 'diff' && view != 'error'">
</div> -->
</div>
</div>
<!--<div class="statement">-->
<!--Copyright ©2016-2021 APIJSON.cn All right reserved.-->
<!--<a href="https://beian.miit.gov.cn/" target="_blank">-->
<!--<span >粤ICP备18005508号-1.</span>-->
<!--</a>-->
<!--本网站部分工具是站长整合网上已有工具、开源包等,并全部遵循原有协议发布,著作权归属原作者或是团队。-->
<!--</div>-->
<!--弹出保存框-->
<div class="save-box" v-show="isSaveShow">
<svg class="icon close-icon" @click="showSave(false)">
<use xlink:href="svg/icon.svg#close"></use>
</svg>
<input type="text" placeholder="请输入名称" v-model="history.name" />
<button @click="save()" >保存</button>
</div>
<!--弹出下载文本框-->
<div class="save-box" v-show="isExportShow">
<svg class="icon close-icon" @click="showExport(false, isExportRemote)">
<use xlink:href="svg/icon.svg#close"></use>
</svg>
<input type="text" placeholder="请输入名称" v-model="exTxt.name" />
<button @click="exportTxt()">{{isExportRemote ? '上传' : '下载'}}</button>
</div>
<!--弹出设置文本框-->
<div class="save-box" v-show="isConfigShow">
<svg class="icon close-icon" @click="showConfig(false)">
<use xlink:href="svg/icon.svg#close"></use>
</svg>
<input type="text" placeholder="请输入名称" v-model="exTxt.name" />
<button @click="saveConfig()">{{ exTxt.button || '切换' }}</button>
</div>
<!--弹出删除文本框-->
<div class="save-box" v-show="isDeleteShow">
<svg class="icon close-icon" @click="showDelete(false, {})">
<use xlink:href="svg/icon.svg#close"></use>
</svg>
<input type="text" placeholder="请输入名称" v-model="exTxt.name" />
<button @click="deleteDoc()">删除</button>
</div>
<!-- 登录 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -->
<div class="my-login-page" v-show="isLoginShow">
<section class="h-100">
<div class="container h-100">
<div class="row justify-content-md-center h-100">
<div class="card-wrapper">
<div class="card fat" >
<div class="card-body">
<div class="card-title">
<a style="font-size: x-large;color: black">{{ ( loginType == "login" ? "登录" : (loginType == "register" ? "注册" : "重置密码") ) + (isAdminOperation ? "(管理员)" : "(测试用户)")}}</a>
<a style="float: right;margin-top: 8px" href="javascript:void(0)" @click="showLogin(false)">
<svg class="icon close-icon" >
<use xlink:href="svg/icon.svg#close"></use>
</svg>
</a>
</div>
<form method="POST">
<div class="form-group">
<label for="vAccount">账号</label>
<input id="vAccount" type="text" class="form-control" name="account" v-model="account" value="13000082001" required autofocus />
</div>
<div class="form-group">
<label for="vPassword">密码
<a class="float-right" v-show="loginType != 'register'" href="javascript:void(0)" @click="loginType = loginType == 'login' ? 'forget' : 'login'">
{{ loginType == "login" ? "忘记密码?" : "记得密码?" }}
</a>
</label>
<input id="vPassword" type="password" class="form-control" name="password" v-model="password" value="123456" required data-eye />
</div>
<div class="form-group" v-show="loginType != 'login'">
<label for="vVerify">验证码
<a class="float-right" href="javascript:void(0)" @click="getVerify(isAdminOperation)">获取</a>
</label>
<input id="vVerify" type="tel" class="form-control" name="verify" required />
</div>
<div class="form-group" v-show="loginType == 'login'">
<label >
<input id="vRemember" type="checkbox" name="remember" @change="setRememberLogin(vRemember.checked)"/> 记住登录
</label>
</div>
<div class="form-group" style="margin-top: 30px">
<button class="btn btn-primary btn-block" type="button" @click="confirm(isAdminOperation)">
确定
</button>
</div>
<div class="margin-top20 text-center" v-show="loginType != 'forget'">
{{ loginType == "login" ? "没有账号?" : "已有账号?" }}
<a href="javascript:void(0)" @click="loginType = loginType == 'login' ? 'register' : 'login'">
{{ loginType == "login" ? "注册" : "登录" }}
</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- 登录 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
</div>
<!--用于移动的时候遮住文本域 避免被选中-->
<div class="widnow-cover">
</div>
<!--最外层根结构-->
<script type="text/x-template" id="outer-template">
<ul class="json-item">
<vue-val :val="jsondata" :isend="isend" :theme="theme"></vue-val>
</ul>
</script>
<!--内层每个键值对-->
<script type="text/x-template" id="item-template">
<ul class="json-item">
<vue-val :field="key" :theme="theme" :val="val" :isend="index == objLength(jsondata) - 1"
v-show="onRenderJSONItem(val, key, jsondata._$_this_$_ == null ? null : (JSON.parse(jsondata._$_this_$_) || {}).path)"
v-for="(val, key, index) in jsondata"></vue-val>
</ul>
</script>
<!--key value 最终的渲染方式-->
<script type="text/x-template" id="val-template">
<div class="keyval">
<template v-if="!isObjectArr(val)">
<span class="key hint--top-right hint--rounded hint--no-animate" v-show="field" :style="{color: theme.key}"
ref="responseKey" @mouseover="setResponseHint(val, field, $event)">"{{field}}": </span>
<span :class="'val val-' + getTyp(val, field)" :style="{color: theme[getTyp(val)]}">
<span v-if="!isaLink(val)">{{formatVal(val)}}</span>
<a v-if="isaLink(val)" :href="val" target="_blank" class="json-link" :style="{color: theme['link-link']}">{{formatVal(val)}}</a>
<span v-if="!isend">,</span>
</span>
</template>
<!--key + 展开折叠ICON-->
<template v-if="isObjectArr(val)">
<span class="key hint--right hint--rounded hint--no-animate" :style="{color: theme.key}" v-show="field"
ref="responseKey" @mouseover="setResponseHint(val, field, $event)">"{{field}}": </span>
<vue-expand></vue-expand>
</template>
<!--值为对象时-->
<template v-if="getTyp(val) == 'Object'">
<span class="expand-view">
<span>{</span>
<vue-item :jsondata="val" :theme="theme"></vue-item>
<div class="brace-end">}<span v-if="!isend">,</span></div>
</span>
<span class="fold-view">{{getTyp(val)}}{<label class="ex-alia" @click="expand($event)">{{objLength(val)}}</label>}<span v-if="!isend">,</span></span>
</template>
<!--值为数组时-->
<template v-if="getTyp(val) == 'Array'">
<span class="expand-view">
<span>[</span>
<span class="val">
<vue-outer :jsondata="sub" v-for="(sub, index) in val" :isend="index == val.length - 1" :theme="theme"></vue-outer>
</span>
<div class="brace-end">]<span v-if="!isend">,</span></div>
</span>
<span class="fold-view">{{getTyp(val)}}[<label class="arrlen ex-alia" @click="expand($event)">{{val.length}}</label>]<span v-if="!isend">,</span></span>
</template>
</div>
</script>
<!--展开 折叠的 UI 组件-->
<script type="text/x-template" id="expand-template">
<span class="expand-wraper">
<svg class="icon icon-square icon-square-min" @click="fold($event)" title="折叠">
<use xlink:href="svg/icon.svg#minus-square"></use>
</svg>
<svg class="icon icon-square icon-square-plus" @click="expand($event)" title="展开">
<use xlink:href="svg/icon.svg#plus-square"></use>
</svg>
</span>
</script>
<script src="js/vue.min.js"></script>
<script src="js/jquery.js"></script>
<script src="js/jsonlint.js"></script>
<script src="js/parse.js"></script>
<script src="js/editor.js"></script>
<!-- <script src="js/diffview.js"></script> -->
<script src="js/localforage.min.js"></script>
<script src="js/FileSaver.js"></script>
<script src="js/uuid.js"></script>
<script src="js/clipboard.min.js"></script>
<script src="js/helper.js"></script>
<!-- 必须在main.js前 TODO 可能有冲突,代码写入vue文件? <<<<<<<<<<<<<<<< -->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript" language="JavaScript" charset="UTF-8" src="apijson/StringUtil.js" ></script>
<script type="text/javascript" language="JavaScript" charset="UTF-8" src="apijson/JSONObject.js" ></script>
<script type="text/javascript" language="JavaScript" charset="UTF-8" src="apijson/JSONRequest.js" ></script>
<script type="text/javascript" language="JavaScript" charset="UTF-8" src="apijson/JSONResponse.js" ></script>
<script type="text/javascript" language="JavaScript" charset="UTF-8" src="apijson/CodeUtil.js" ></script>
<!-- 必须在main.js前 TODO 可能有冲突,代码写入vue文件? >>>>>>>>>>>>>>>> -->
<script src="https://unpkg.com/json5@^2.0.0/dist/index.min.js"></script>
<script src="js/main.js"></script>
<script type="text/javascript" language="JavaScript" charset="UTF-8" >
//TODO 保留,用v-model绑定到App.data会报错,各种undefined
var vUrl = document.getElementById("vUrl");
var vUrlComment = document.getElementById("vUrlComment");
var vTransfer = document.getElementById("vTransfer");
var vType = document.getElementById("vType");
var vSend = document.getElementById("vSend");
var vInput = document.getElementById("vInput");
var vWarning = document.getElementById("vWarning");
var vComment = document.getElementById("vComment");
var vHeader = document.getElementById("vHeader");
var vRandom = document.getElementById("vRandom");
var vOutput = document.getElementById("vOutput");
var vAccount = document.getElementById("vAccount");
var vPassword = document.getElementById("vPassword");
var vVerify = document.getElementById("vVerify");
var vRemember = document.getElementById("vRemember");
vUrl.value = new String(URL_BASE + '/get'); //main.js里访问不到,可能是script引用顺序问题
var vRequestMarkdown = document.getElementById('vRequestMarkdown');
var vMarkdown = document.getElementById('vMarkdown');
var vPage = document.getElementById('vPage');
var vCount = document.getElementById('vCount');
var vSearch = document.getElementById('vSearch');
var vTestCasePage = document.getElementById('vTestCasePage');
var vTestCaseCount = document.getElementById('vTestCaseCount');
var vTestCaseSearch = document.getElementById('vTestCaseSearch');
var vRandomPage = document.getElementById('vRandomPage');
var vRandomCount = document.getElementById('vRandomCount');
var vRandomSearch = document.getElementById('vRandomSearch');
var vRandomSubPage = document.getElementById('vRandomSubPage');
var vRandomSubCount = document.getElementById('vRandomSubCount');
var vRandomSubSearch = document.getElementById('vRandomSubSearch');
function onScrollChanged() {
$(vComment).scrollLeft(vInput.scrollLeft);
$(vComment).scrollTop(vInput.scrollTop);
$(vWarning).scrollLeft(vInput.scrollLeft);
$(vWarning).scrollTop(vInput.scrollTop);
}
//vComment跟随vInput滚动,避免JSON重叠"露馅"
$(vInput).on('scroll', onScrollChanged);
function onURLScrollChanged() {
$(vUrlComment).scrollLeft(vUrl.scrollLeft);
}
//vURLComment跟随vUrl滚动,避免JSON重叠"露馅"
$(vUrl).on('scroll', onURLScrollChanged);
function markdownToHTML(md, isRequest) {
if (editormd == null) {
return;
}
if (isRequest) {
vRequestMarkdown.innerHTML = '';
}
else {
vMarkdown.innerHTML = '';
}
editormd.markdownToHTML(isRequest ? 'vRequestMarkdown' : "vMarkdown", {
markdown : md ,//+ "\r\n" + $("#append-test").text(),
//htmlDecode : true, // 开启 HTML 标签解析,为了安全性,默认不开启
htmlDecode : "style,script,iframe", // you can filter tags decode
//toc : false,
tocm : true, // Using [TOCM]
//tocContainer : "#custom-toc-container", // 自定义 ToC 容器层
//gfm : false,
tocDropdown : true,
// markdownSourceCode : true, // 是否保留 Markdown 源码,即是否删除保存源码的 Textarea 标签
taskList : true,
tex : true, // 默认不解析
flowChart : true, // 默认不解析
sequenceDiagram : true, // 默认不解析
});
}
</script>
<script src="md/lib/jquery.min.js"></script>
<script src="md/lib/marked.min.js"></script>
<script src="md/lib/prettify.min.js"></script>
<script src="md/lib/raphael.min.js"></script>
<script src="md/lib/underscore.min.js"></script>
<script src="md/lib/sequence-diagram.min.js"></script>
<script src="md/lib/flowchart.min.js"></script>
<script src="md/lib/jquery.flowchart.min.js"></script>
<script src="md/editormd.js"></script>
<!-- 百度统计 <<<<<<<<<<<<<<<<<<<<<<<<<<<<< -->
<script>
var _hmt = _hmt || [];
(function() {
try {
var hm = document.createElement("script");
// hm.src = "https://hm.baidu.com/hm.js?b8fc421d7c0dc354c6c8fb5a2c4f7729"; //cn
hm.src = "https://hm.baidu.com/hm.js?965ec968d2d53b729b90efc7ffb3ead2"; //org
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
} catch (e) {
console.log('BaiduStatistics: catch\n' + e.message)
}
})();
</script>
<!-- 百度统计 >>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化