|
|
|
@ -93,8 +93,10 @@
|
|
|
|
|
</el-aside> |
|
|
|
|
<el-container> |
|
|
|
|
<el-header> |
|
|
|
|
<el-button style="margin-top: 8px" type="primary" plain @click="clearCurrentApi">文档说明</el-button> |
|
|
|
|
<el-button style="margin-top: 8px" type="primary" plain @click="docDesVisible = true">文档说明</el-button> |
|
|
|
|
<el-button style="margin-top: 8px" type="primary" plain @click="showMark = !showMark">我的标记</el-button> |
|
|
|
|
检索:<el-input v-model="searchText" style="width: 200px" placeholder="搜索:地址|名字" clearable></el-input> |
|
|
|
|
版本检索:<el-input v-model="version" style="width: 200px" placeholder="版本号" clearable></el-input> |
|
|
|
|
</el-header> |
|
|
|
|
<el-main> |
|
|
|
|
<el-row v-if="currentApiInfo.name" :gutter="10"> |
|
|
|
@ -221,8 +223,11 @@
|
|
|
|
|
|
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<div v-else> |
|
|
|
|
<el-alert title="页面介绍" type="success"> |
|
|
|
|
</el-main> |
|
|
|
|
</el-container> |
|
|
|
|
</el-container> |
|
|
|
|
<el-dialog title="文档说明" :visible.sync="docDesVisible"> |
|
|
|
|
<el-alert title="页面介绍" type="success" :closable="false"> |
|
|
|
|
<div><i class="el-icon-star-on" style="color: #E6A23C"></i> 已做标记,可认为是收藏,接口详情点击可切换标记状态</div> |
|
|
|
|
<div><i class="el-icon-star-off" style="color: #E6A23C"></i> 未做标记</div> |
|
|
|
|
<div><i style="color:#F56C6C;" class="el-icon-s-check"></i>必须使用Token验证</div> |
|
|
|
@ -230,7 +235,7 @@
|
|
|
|
|
<div><i style="color:#909399;" class="el-icon-s-check"></i> 无需token</div> |
|
|
|
|
<div><i class="el-icon-s-promotion"></i> 发送模拟请求</div> |
|
|
|
|
</el-alert> |
|
|
|
|
<el-alert title="响应介绍" type="warning"> |
|
|
|
|
<el-alert title="响应介绍" type="warning" :closable="false"> |
|
|
|
|
<div><b>code:</b> 状态码</div> |
|
|
|
|
<div><b>data:</b> 数据</div> |
|
|
|
|
<div><b>msg:</b> 响应提示语</div> |
|
|
|
@ -242,10 +247,11 @@
|
|
|
|
|
<div><b style="margin-left: 10px">1001:</b>刷新token,此时响应数据会带上新的token</div> |
|
|
|
|
<div><b style="margin-left: 10px">1002:</b>token无效,应要求用户重新登录</div> |
|
|
|
|
</el-alert> |
|
|
|
|
</div> |
|
|
|
|
</el-main> |
|
|
|
|
</el-container> |
|
|
|
|
</el-container> |
|
|
|
|
<el-alert title="认证说明" type="error" :closable="false"> |
|
|
|
|
<div>认证方式采用JWT方式, 传输方式使用Header参数: Authenticate</div> |
|
|
|
|
<div><b>例:</b>Authenticate: Bearer G0peyJhbGciF7hOiJyaXB.G0peyJhbGciF7hOiJyaXB.G0peyJhbGciF7hOiJyaXB</div> |
|
|
|
|
</el-alert> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</body> |
|
|
|
|
|
|
|
|
@ -253,7 +259,7 @@
|
|
|
|
|
var APP = new Vue({ |
|
|
|
|
el:'#app', |
|
|
|
|
data: { |
|
|
|
|
editApiDoc:false, |
|
|
|
|
docDesVisible:true, |
|
|
|
|
paramInfo: 'request', |
|
|
|
|
paramShowType: 'form', |
|
|
|
|
requestUrl: 'https://vuejs.org/guide/introduction.html', |
|
|
|
@ -271,15 +277,27 @@
|
|
|
|
|
myMark:[], |
|
|
|
|
showMark:false, |
|
|
|
|
searchText:"", |
|
|
|
|
apiActive:-1 |
|
|
|
|
apiActive:-1, |
|
|
|
|
version:'' |
|
|
|
|
}, |
|
|
|
|
created(){ |
|
|
|
|
if (localStorage.getItem("ScBefore")){ |
|
|
|
|
this.scriptBeforeRequest = localStorage.getItem("ScBefore"); |
|
|
|
|
} |
|
|
|
|
if (!/requestData\.headers/.test(this.scriptBeforeRequest)) { |
|
|
|
|
this.scriptBeforeRequest += `\nif(ApiInfo.auth){\n`; |
|
|
|
|
this.scriptBeforeRequest += ` requestData.headers = { Authenticate: 'Bearer ' + localStorage.getItem("token")};\n`; |
|
|
|
|
this.scriptBeforeRequest += `}`; |
|
|
|
|
} |
|
|
|
|
if (localStorage.getItem("ScAfter")){ |
|
|
|
|
this.scriptAfterRequest = localStorage.getItem("ScAfter"); |
|
|
|
|
} |
|
|
|
|
if (!/response\.data\.token/.test(this.scriptAfterRequest)) { |
|
|
|
|
this.scriptAfterRequest += `\nif(response.data.token){\n` |
|
|
|
|
+ ` localStorage.setItem("token", response.data.token);\n` |
|
|
|
|
+ `}`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.getApiInfo(); |
|
|
|
|
this.myMark = localStorage.getItem("myMark").split(','); |
|
|
|
|
}, |
|
|
|
@ -303,7 +321,13 @@
|
|
|
|
|
} |
|
|
|
|
if(this.searchText){ |
|
|
|
|
let length = item.children.filter(a => { |
|
|
|
|
return a.url.indexOf(this.searchText) < 0 || a.name.indexOf(this.searchText) < 0 |
|
|
|
|
return a.url.indexOf(this.searchText) < 0 && a.name.indexOf(this.searchText) < 0 |
|
|
|
|
}); |
|
|
|
|
if (length > 0) show = false; |
|
|
|
|
} |
|
|
|
|
if (this.version) { |
|
|
|
|
let length = item.children.filter(a => { |
|
|
|
|
return !a.version.includes(this.version * 1) |
|
|
|
|
}); |
|
|
|
|
if (length > 0) show = false; |
|
|
|
|
} |
|
|
|
@ -314,7 +338,10 @@
|
|
|
|
|
if(this.showMark && !this.myMark.includes(a.url)){ |
|
|
|
|
show = false; |
|
|
|
|
} |
|
|
|
|
if(this.searchText && (a.url.indexOf(this.searchText) < 0 || a.name.indexOf(this.searchText) < 0)){ |
|
|
|
|
if(this.searchText && (a.url.indexOf(this.searchText) < 0 && a.name.indexOf(this.searchText) < 0)){ |
|
|
|
|
show = false; |
|
|
|
|
} |
|
|
|
|
if(this.version && !a.version.includes(this.version * 1)) { |
|
|
|
|
show = false; |
|
|
|
|
} |
|
|
|
|
return show; |
|
|
|
@ -326,10 +353,6 @@
|
|
|
|
|
this.form = this.requestParamsResolve(this.currentApiInfo.requestParams); |
|
|
|
|
this.paramShowJsonEl && this.paramShowJsonEl.set(this.form); |
|
|
|
|
}, |
|
|
|
|
clearCurrentApi(){ |
|
|
|
|
this.currentApiInfo = {}; |
|
|
|
|
this.form = {}; |
|
|
|
|
}, |
|
|
|
|
getPath(){ |
|
|
|
|
try{ |
|
|
|
|
return new URL(this.currentApiInfo.url).pathname |
|
|
|
|