单独页面配置,更加方便,逻辑更清晰
This commit is contained in:
@@ -215,28 +215,28 @@ public class MgDocumentController {
|
||||
}
|
||||
String resourcesStr = null;
|
||||
try {
|
||||
resourcesStr = HttpRequest.get(resourcesUrl).timeout(3000).execute().body();
|
||||
List<SwaggerResource> resourceList = JSON.parseArray(resourcesStr, SwaggerResource.class);
|
||||
if (resourceList == null || resourceList.isEmpty()) {
|
||||
return DocResponseJson.warn("该地址未找到文档");
|
||||
}
|
||||
// 重新加入的时候把之前的已删除的回恢复
|
||||
String resourcesDomain = resourcesUrl.substring(0, resourcesUrl.lastIndexOf("/") + 1);
|
||||
for (SwaggerResource swaggerResource : resourceList) {
|
||||
String location = swaggerResource.getLocation();
|
||||
// 最后一个斜杠在resourcesUrl中已经加上,替换掉后面的防止两根斜杠
|
||||
location = location.startsWith("/") ? location.replaceFirst("/", "") : location;
|
||||
if (location.indexOf("?") >= 0) {
|
||||
try {
|
||||
String encode = URLEncoder.encode(swaggerResource.getName(), "utf-8");
|
||||
location = location.substring(0, location.lastIndexOf("?")) + "?group=" + encode;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
location = resourcesDomain + location;
|
||||
swaggerDocsDeleteSet.remove(location);
|
||||
}
|
||||
// resourcesStr = HttpRequest.get(resourcesUrl).timeout(3000).execute().body();
|
||||
// List<SwaggerResource> resourceList = JSON.parseArray(resourcesStr, SwaggerResource.class);
|
||||
// if (resourceList == null || resourceList.isEmpty()) {
|
||||
// return DocResponseJson.warn("该地址未找到文档");
|
||||
// }
|
||||
// // 重新加入的时候把之前的已删除的回恢复
|
||||
// String resourcesDomain = resourcesUrl.substring(0, resourcesUrl.lastIndexOf("/") + 1);
|
||||
// for (SwaggerResource swaggerResource : resourceList) {
|
||||
// String location = swaggerResource.getLocation();
|
||||
// // 最后一个斜杠在resourcesUrl中已经加上,替换掉后面的防止两根斜杠
|
||||
// location = location.startsWith("/") ? location.replaceFirst("/", "") : location;
|
||||
// if (location.indexOf("?") >= 0) {
|
||||
// try {
|
||||
// String encode = URLEncoder.encode(swaggerResource.getName(), "utf-8");
|
||||
// location = location.substring(0, location.lastIndexOf("?")) + "?group=" + encode;
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// location = resourcesDomain + location;
|
||||
// swaggerDocsDeleteSet.remove(location);
|
||||
// }
|
||||
resourcesSet.add(resourcesUrl);
|
||||
} catch (Exception e) {
|
||||
// 暂不想支持直接添加地址
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
</div>
|
||||
</li>
|
||||
<li id="homePageLi"><a href="javascript:void(0)" path=""><i class="icon-home"></i> 控制台</a></li>
|
||||
<li>
|
||||
<li id="tabZpagesNavigationLi">
|
||||
<a href="#"><i class="icon icon-cogs"></i> 文档管理</a>
|
||||
<ul>
|
||||
<li id="onlineDebugLi" class="local-storage"><a href="javascript:void(0)" path=""><i class="icon-bug"></i> 在线调试管理</a></li>
|
||||
<li><a href="javascript:changeOpenZpage('docShowConfig', 'webjars/zpages/docShowConfig.html', 'icon-home', false)" path=""><i class="icon-cog"></i> 文档展示配置</a></li>
|
||||
<li><a href="#" path=""><i class="icon-globe"></i> 全局参数管理</a></li>
|
||||
<li><a href="#" path=""><i class="icon-bug"></i> 调试数据管理</a></li>
|
||||
<li><a href="#" path=""><i class="icon-list-ul"></i> 文档地址管理</a></li>
|
||||
<li id="onlineDebugLi1" class="local-storage"><a href="javascript:void(0)" path=""><i class="icon-bug"></i> 在线调试管理</a></li>
|
||||
<li><a href="#" class="page-nav" data-id="docShowConfig" data-href="webjars/zpages/docShowConfig.html" data-icon="icon-cog" data-reload="0"><i class="icon-cog"></i> 文档展示配置</a></li>
|
||||
<li><a href="#" class="page-nav" data-id="docUrlConfig" data-href="webjars/zpages/docUrlConfig.html" data-icon="icon-list-ul" data-reload="1"><i class="icon-list-ul"></i> 文档地址管理</a></li>
|
||||
<li><a href="#" class="page-nav" data-id="globalParamConfig" data-href="webjars/zpages/globalParamConfig.html" data-icon="icon-globe" data-reload="1"><i class="icon-globe"></i> 全局参数管理</a></li>
|
||||
<li><a href="#" class="page-nav" data-id="debugDataConfig" data-href="webjars/zpages/debugDataConfig.html" data-icon="icon-bug" data-reload="1"><i class="icon-bug"></i> 调试数据管理</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -45,85 +45,25 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="resizebleLeftRight" class="ui-resizable-handle mgresizebleW"></div>
|
||||
<div class="right-container" id="rightContentMask"></div>
|
||||
<div class="right-container" id="rightContent">
|
||||
<div class="tab-page tab-home-page">
|
||||
<div id="homePageDashboard" class="dashboard dashboard-draggable" data-height="320">
|
||||
<div id="homePageDashboard" class="dashboard" data-height="320">
|
||||
<section class="row">
|
||||
<div class="col-md-6 col-sm-6">
|
||||
<div class="panel" data-id="1">
|
||||
<div class="panel-heading">
|
||||
<div class="title">配置中心</div>
|
||||
<div class="title">工具介绍</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="content">
|
||||
<table class="table table-bordered setting-table">
|
||||
<tr>
|
||||
<td class="info">目录展示方式</td>
|
||||
<td>
|
||||
<label><input type="radio" name="catalogShowType" value="1">分路径展示</label>
|
||||
<label><input type="radio" name="catalogShowType" value="2">分标签展示</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">树形菜单展示方式</td>
|
||||
<td>
|
||||
<label><input type="radio" name="treeShowType" value="1">直角</label>
|
||||
<label><input type="radio" name="treeShowType" value="2">导航</label>
|
||||
<label><input type="radio" name="treeShowType" value="3">加减</label>
|
||||
<label><input type="radio" name="treeShowType" value="4">文件夹</label>
|
||||
<label><input type="radio" name="treeShowType" value="5">V型</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">是否展示字段的类型</td>
|
||||
<td>
|
||||
<label><input type="radio" name="showParamType" value="1">是</label>
|
||||
<label><input type="radio" name="showParamType" value="0">否</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">仅使用上次请求参数<i class="icon icon-info-sign" title="每个接口都使用最后一次请求的header、form、body参数,参数列表有的字段但上一次请求没有使用的则不会展示在请求参数里面,从未请求过则展示所有参数"></i></td>
|
||||
<td>
|
||||
<label><input type="radio" name="onlyUseLastParam" value="1">是</label>
|
||||
<label><input type="radio" name="onlyUseLastParam" value="0">否</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">自动填充请求参数</td>
|
||||
<td>
|
||||
<label><input type="radio" name="autoFillParam" value="0">否</label>
|
||||
<label><input type="radio" name="autoFillParam" value="1">智能填充</label>
|
||||
<label><input type="radio" name="autoFillParam" value="2">全部填充</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">文档管理</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm" data-moveable="true" id="addNewDocument">增加文档</button>
|
||||
<button type="button" class="btn btn-sm btn-primary" data-moveable="true" id="exportDocument">导出文档</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">配置管理</td>
|
||||
<td>
|
||||
<button class="btn btn-sm" type="button" data-moveable="true" id="exportSetting">导出配置</button>
|
||||
<button class="btn btn-sm" type="button" data-moveable="true" id="importSetting">导入配置</button>
|
||||
<button class="btn btn-sm" type="button" id="restoreDefault">恢复默认</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div align="center">简介</div>
|
||||
zyplayer-doc-swagger是swagger-ui的一个前端实现,使用简单、解析速度快、走心的设计,
|
||||
支持多项目同时展示,多种文档目录的展示方案,多种自定义配置,满足各种使用习惯。
|
||||
本项目是完全从头写的,所以有任何属性未解析到、UI上有何建议都能及时处理得到。
|
||||
使用中您有任何的意见和建议都可到源码地址处反馈哦!<br/>
|
||||
源码地址:<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc-swagger</a>,
|
||||
前端框架:<a target="_blank" href="http://zui.sexy">zui</a>,
|
||||
我的网站:<a target="_blank" href="http://kongjianzhou.com">空间轴</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="content about">
|
||||
zyplayer-doc-swagger是swagger文档的管理工具,使用简单、解析速度快、走心的设计,
|
||||
支持多项目同时展示,多种文档目录的展示方案,多种自定义配置,满足各种使用习惯。
|
||||
本项目是完全从头写的,所以有任何属性未解析到、UI上有何建议都能及时处理得到。
|
||||
使用中您有任何的意见和建议都可到源码地址处反馈哦!<br/>
|
||||
源码地址:<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc-swagger</a>(还有其他很多功能哦),
|
||||
前端框架:<a target="_blank" href="http://zui.sexy">zui</a>(很不错),
|
||||
我的网站:<a target="_blank" href="http://kongjianzhou.com">空间轴</a>、<a target="_blank" href="http://zyplayer.com">自由发挥</a>(都已很久未维护)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -399,25 +339,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 增加文档弹出框 -->
|
||||
<div class="modal fade" id="addNewDocumentModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">输入文档地址</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input id="addNewDocumentInput" type="text" class="form-control" placeholder="例:http://192.168.0.172/swagger-resources">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" id="addNewDocumentBtn">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 导出文档 -->
|
||||
<div class="modal fade" id="exportDocumentModal">
|
||||
<div class="modal-dialog">
|
||||
@@ -445,41 +366,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 导出配置 -->
|
||||
<div class="modal fade" id="exportSettingModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">导出配置</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea id="exportSettingText" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 导入配置 -->
|
||||
<div class="modal fade" id="importSettingModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">导入配置</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea id="importSettingText" class="form-control"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" id="importSettingBtn">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 选择展示的项目 -->
|
||||
<div class="modal fade" id="choiseDocModal">
|
||||
<div class="modal-dialog">
|
||||
|
||||
@@ -38,6 +38,7 @@ label{font-weight: normal;}
|
||||
|
||||
#homePageDashboard{overflow-y: auto;bottom: 0;top: 0;right: 0;left: 0;position: absolute;overflow-x: hidden;padding: 10px;}
|
||||
#homePageDashboard .panel-body{padding: 10px;}
|
||||
.content.about{line-height: 30px;}
|
||||
|
||||
#homePageLi{margin-top: 5px;}
|
||||
|
||||
@@ -75,6 +76,9 @@ label{font-weight: normal;}
|
||||
|
||||
#exportDocumentText{height: 350px;}
|
||||
|
||||
#rightContentMask{background-color: rgba(0, 0, 0, 0);display: none;position: relative;top: 0;bottom: 0;left:0;right: 0;}
|
||||
#rightZpages{height: 100%;position: relative;top: 0;bottom: 0;left:0;right: 0;}
|
||||
|
||||
/* 在线调试框样式 */
|
||||
#tabParamBody .tab-content{padding-top: 10px;}
|
||||
|
||||
|
||||
@@ -266,21 +266,49 @@ String.prototype.startWith = function(str) {
|
||||
return (this.substr(0, str.length) == str);
|
||||
};
|
||||
|
||||
var rightContentTabs;
|
||||
function changeOpenZpage(id, url, icon, reload){
|
||||
if(reload || $("#tab-"+id).length <= 0) {
|
||||
var newTab = {id: id, url: url, type: 'iframe', icon: icon};
|
||||
rightContentTabs.open(newTab);
|
||||
} else {
|
||||
$("#tab-nav-item-"+id+" .tab-nav-link").click();
|
||||
}
|
||||
/**
|
||||
* 获取数据,异步的操作
|
||||
*/
|
||||
function getStorage(key, success, fail) {
|
||||
var start = (typeof urlBase === 'string') ? urlBase : '';
|
||||
ajaxTemp(start + "swagger-mg-ui/storage/data", "get", "json", {key: key}, function(json){
|
||||
if(json.errCode == 200) {
|
||||
if(typeof success == "function") {
|
||||
var result = deserialize(json.data);
|
||||
success(result);
|
||||
}
|
||||
} else {
|
||||
if(typeof fail == "function") {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}, function(msg){
|
||||
if(typeof fail == "function") {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
// 定义标签页
|
||||
var tabsArr = [
|
||||
//{id: 'system-console', url: 'system/console', type: 'iframe', icon: 'icon-home', forbidClose: true},
|
||||
];
|
||||
$('#rightZpages').tabs({tabs: tabsArr});
|
||||
rightContentTabs = $('#rightZpages').data('zui.tabs');
|
||||
}
|
||||
/**
|
||||
* 存储数据,异步的操作
|
||||
*/
|
||||
function setStorage(key, value, success, fail) {
|
||||
value = $.zui.store.serialize(value);
|
||||
var start = (typeof urlBase === 'string') ? urlBase : '';
|
||||
ajaxTemp(start + "swagger-mg-ui/storage/data", "post", "json", {key: key, value: value}, function(json){
|
||||
if(json.errCode == 200) {
|
||||
if(typeof success == "function") {
|
||||
success();
|
||||
}
|
||||
} else {
|
||||
if(typeof fail == "function") {
|
||||
fail(getNotEmptyStr(json.errMsg));
|
||||
}
|
||||
}
|
||||
}, function(msg){
|
||||
if(typeof fail == "function") {
|
||||
fail("");
|
||||
}
|
||||
console.log("存储数据到服务器失败,请检查");
|
||||
});
|
||||
}
|
||||
@@ -159,7 +159,7 @@ $(document).ready(function(){
|
||||
* 在线调试管理
|
||||
*/
|
||||
$("#onlineDebugLi").click(function(){
|
||||
$(".tab-page").hide();
|
||||
$(".tab-page,.tab-zpages").hide();
|
||||
$(".tab-online-debug-page").show();
|
||||
createOnlineDebugParamTable();
|
||||
});
|
||||
|
||||
@@ -47,6 +47,8 @@ var requestParamObjTemp = {
|
||||
}
|
||||
};
|
||||
|
||||
var rightContentTabs;
|
||||
|
||||
/**
|
||||
* 网页加载完毕后的处理
|
||||
*/
|
||||
@@ -140,9 +142,11 @@ $("#resizebleLeftRight").mgResizebleWidth({
|
||||
},
|
||||
onstart:function(){
|
||||
$("body").addClass("unselect");
|
||||
$("#rightContentMask").show();
|
||||
},
|
||||
onfinish:function(){
|
||||
$("body").removeClass("unselect");
|
||||
$("#rightContentMask").hide();
|
||||
storeUserSettings();
|
||||
}
|
||||
});
|
||||
@@ -212,18 +216,10 @@ $("#searchDocBt").click(function(){
|
||||
searchDoc();
|
||||
});
|
||||
|
||||
/**
|
||||
* 增加文档
|
||||
*/
|
||||
$("#addNewDocument").click(function(){
|
||||
$('#addNewDocumentInput').val("");
|
||||
$('#addNewDocumentModal').modal({moveable:true});
|
||||
});
|
||||
|
||||
/**
|
||||
* 导出文档
|
||||
*/
|
||||
$("#exportDocument").click(function(){
|
||||
function exportDocument(){
|
||||
// 清空
|
||||
$("#exportDocumentText").val("");
|
||||
$("#exportDocumentUl").show();
|
||||
@@ -237,7 +233,7 @@ $("#exportDocument").click(function(){
|
||||
}
|
||||
$('#exportDocumentModal').modal({moveable:true, backdrop: 'static'});
|
||||
$('#exportDocumentModal').modal('ajustPosition', 'fit');
|
||||
});
|
||||
}
|
||||
|
||||
$("#doExportBtn").click(function(){
|
||||
var jsonStrAll = "";
|
||||
@@ -264,46 +260,30 @@ $("#doExportBtn").click(function(){
|
||||
$('#exportDocumentModal').modal('ajustPosition', 'fit');
|
||||
});
|
||||
|
||||
/**
|
||||
* 切换选中和非选中样式
|
||||
*/
|
||||
$(".choise").on("click", "li", function(){
|
||||
$(this).toggleClass("checked");
|
||||
});
|
||||
|
||||
/**
|
||||
* 恢复默认
|
||||
* 页面导航切换
|
||||
*/
|
||||
$("#restoreDefault").click(function(){
|
||||
userSettings = defaultUserSettings;
|
||||
$("input[name='treeShowType'][value='"+userSettings.treeShowType+"']").prop("checked",true);
|
||||
$("input[name='catalogShowType'][value='"+userSettings.catalogShowType+"']").prop("checked",true);
|
||||
$("input[name='showParamType'][value='"+userSettings.showParamType+"']").prop("checked",true);
|
||||
storeUserSettings();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
/**
|
||||
* 导出配置
|
||||
*/
|
||||
$("#exportSetting").click(function(){
|
||||
$("#exportSettingText").val(JSON.stringify(userSettings));
|
||||
$('#exportSettingModal').modal({moveable:true});
|
||||
});
|
||||
|
||||
/**
|
||||
* 导入配置
|
||||
*/
|
||||
$("#importSetting").click(function(){
|
||||
$("#importSettingText").val("");
|
||||
$('#importSettingModal').modal({moveable:true});
|
||||
});
|
||||
|
||||
/**
|
||||
* 导入配置-确认
|
||||
*/
|
||||
$("#importSettingBtn").click(function(){
|
||||
var exportSettingText = $("#importSettingText").val();
|
||||
userSettings = JSON.parse(exportSettingText);
|
||||
$('#importSettingModal').modal('hide');
|
||||
storeUserSettings();
|
||||
$("#tabZpagesNavigationLi").on("click", ".page-nav", function(){
|
||||
var id = $(this).data("id");
|
||||
var href = $(this).data("href");
|
||||
var icon = $(this).data("icon");
|
||||
var reload = $(this).data("reload");
|
||||
$(".tab-page").hide();
|
||||
$(".tab-online-debug-page").hide();
|
||||
$(".tab-zpages").show();
|
||||
if(reload || $("#tab-"+id).length <= 0) {
|
||||
var newTab = {id: id, url: href, type: 'iframe', icon: icon};
|
||||
rightContentTabs.open(newTab);
|
||||
} else {
|
||||
$("#tab-nav-item-"+id+" .tab-nav-link").click();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -348,7 +328,7 @@ $("#addNewDocumentBtn").click(function(){
|
||||
* 主页li点击事件,展示主页
|
||||
*/
|
||||
$("#homePageLi").click(function(){
|
||||
$(".tab-page").hide();
|
||||
$(".tab-page,.tab-zpages").hide();
|
||||
$(".tab-home-page").show();
|
||||
});
|
||||
|
||||
@@ -872,7 +852,7 @@ function getRequestParamObj(responsesObj, prevRef) {
|
||||
function changeContentWidth(width) {
|
||||
$("#leftContent").css("width", width + 'px');
|
||||
$("#resizebleLeftRight").css("left", width + 'px');
|
||||
$("#rightContent").css("left", width + 'px');
|
||||
$("#rightContent,#rightContentMask").css("left", width + 'px');
|
||||
var logoText = "zyplayer-doc-swagger";
|
||||
if(width < 370 && width > 290){
|
||||
logoText = "zyplayer-doc";
|
||||
@@ -919,9 +899,9 @@ function addHomePageDashboard(json, fullUrl) {
|
||||
+'<div class="panel-heading">'
|
||||
+'<div class="title">'+info.title+'</div>'
|
||||
+'<div class="panel-actions">'
|
||||
+'<button type="button" class="btn remove-panel" data-placement="bottom">'
|
||||
+'<i class="icon-remove"></i>'
|
||||
+'</button>'
|
||||
// +'<button type="button" class="btn remove-panel" data-placement="bottom">'
|
||||
// +'<i class="icon-remove"></i>'
|
||||
// +'</button>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="panel-body">'
|
||||
@@ -958,11 +938,18 @@ function addHomePageDashboard(json, fullUrl) {
|
||||
*/
|
||||
function documentLoadFinish() {
|
||||
showGlobalLoadingMessage('文档解析完成!', false);
|
||||
// 定义配置的标签页
|
||||
var tabsArr = [
|
||||
{id: 'docShowConfig', url: 'webjars/zpages/docShowConfig.html', type: 'iframe', icon: 'icon-cog', forbidClose: true},
|
||||
];
|
||||
$('#rightZpages').tabs({tabs: tabsArr});
|
||||
rightContentTabs = $('#rightZpages').data('zui.tabs');
|
||||
// 隐藏提示框
|
||||
setTimeout(function() {
|
||||
globalLoadingMessager.hide();
|
||||
}, 1000);
|
||||
$('#apiPathTree .projects').tree();
|
||||
$('#homePageDashboard').dashboard({draggable: true,
|
||||
$('#homePageDashboard').dashboard({draggable: false,
|
||||
// 修改排序
|
||||
afterOrdered:function(newOrders){
|
||||
/*//console.log(newOrders);
|
||||
@@ -1048,48 +1035,10 @@ function storeUserSettings() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据,异步的操作
|
||||
* 更新用户设置
|
||||
*/
|
||||
function getStorage(key, success, fail) {
|
||||
ajaxTemp("swagger-mg-ui/storage/data", "get", "json", {key: key}, function(json){
|
||||
if(json.errCode == 200) {
|
||||
if(typeof success == "function") {
|
||||
var result = deserialize(json.data);
|
||||
success(result);
|
||||
}
|
||||
} else {
|
||||
if(typeof fail == "function") {
|
||||
fail();
|
||||
}
|
||||
}
|
||||
}, function(msg){
|
||||
if(typeof fail == "function") {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储数据,异步的操作
|
||||
*/
|
||||
function setStorage(key, value, success, fail) {
|
||||
value = $.zui.store.serialize(value);
|
||||
ajaxTemp("swagger-mg-ui/storage/data", "post", "json", {key: key, value: value}, function(json){
|
||||
if(json.errCode == 200) {
|
||||
if(typeof success == "function") {
|
||||
success();
|
||||
}
|
||||
} else {
|
||||
if(typeof fail == "function") {
|
||||
fail(getNotEmptyStr(json.errMsg));
|
||||
}
|
||||
}
|
||||
}, function(msg){
|
||||
if(typeof fail == "function") {
|
||||
fail("");
|
||||
}
|
||||
console.log("存储数据到服务器失败,请检查");
|
||||
});
|
||||
function updateUserSettings(newSetting) {
|
||||
userSettings = newSetting;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,13 @@ var Toast = {
|
||||
};
|
||||
this.show(data);
|
||||
},
|
||||
success:function(msg, time){
|
||||
var data = {
|
||||
message:msg,time:time,
|
||||
icon: 'check-circle-o',type:'success',
|
||||
};
|
||||
this.show(data);
|
||||
},
|
||||
warn:function(msg, time){
|
||||
var data = {
|
||||
message:msg,time:time,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>调试数据管理</title>
|
||||
<link rel="stylesheet" type="text/css" href="../zui/css/zui.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
调试数据管理
|
||||
</div>
|
||||
</body>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/jquery-3.1.0.min.js"></script>
|
||||
<script src="../vue/vue.js"></script>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
userId: "",
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
@@ -9,27 +9,129 @@
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
文档展示配置
|
||||
<table class="table table-bordered setting-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 150px;">参数名</td>
|
||||
<td style="width: 300px;">参数值</td>
|
||||
<td>说明</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="info">目录展示方式</td>
|
||||
<td>
|
||||
<label><input type="radio" name="catalogShowType" value="1" v-model="catalogShowType">分路径展示</label>
|
||||
<label><input type="radio" name="catalogShowType" value="2" v-model="catalogShowType">分标签展示</label>
|
||||
</td>
|
||||
<td>分路径:/api/data/getDataList 分标签:/api└/data└/getDateList└post└get</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">树形菜单展示方式</td>
|
||||
<td>
|
||||
<label><input type="radio" name="treeShowType" value="1" v-model="treeShowType">直角</label>
|
||||
<label><input type="radio" name="treeShowType" value="2" v-model="treeShowType">导航</label>
|
||||
<label><input type="radio" name="treeShowType" value="3" v-model="treeShowType">加减</label>
|
||||
<label><input type="radio" name="treeShowType" value="4" v-model="treeShowType">文件夹</label>
|
||||
<label><input type="radio" name="treeShowType" value="5" v-model="treeShowType">V型</label>
|
||||
</td>
|
||||
<td>请自行修改体验</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">是否展示字段的类型</td>
|
||||
<td>
|
||||
<label><input type="radio" name="showParamType" value="1" v-model="showParamType">是</label>
|
||||
<label><input type="radio" name="showParamType" value="0" v-model="showParamType">否</label>
|
||||
</td>
|
||||
<td>文档中是否展示类型:"reference": "(boolean)"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">仅使用上次请求参数</td>
|
||||
<td>
|
||||
<label><input type="radio" name="onlyUseLastParam" value="1" v-model="onlyUseLastParam">是</label>
|
||||
<label><input type="radio" name="onlyUseLastParam" value="0" v-model="onlyUseLastParam">否</label>
|
||||
</td>
|
||||
<td>每个接口都使用最后一次请求的header、form、body参数,参数列表有但上一次请求没有使用的则不会展示在请求参数里面,从未请求过则展示所有参数</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="info">自动填充请求参数</td>
|
||||
<td>
|
||||
<label><input type="radio" name="autoFillParam" value="0" v-model="autoFillParam">否</label>
|
||||
<label><input type="radio" name="autoFillParam" value="1" v-model="autoFillParam">智能填充</label>
|
||||
<label><input type="radio" name="autoFillParam" value="2" v-model="autoFillParam">全部填充</label>
|
||||
</td>
|
||||
<td>否:不填充,智能填充:只填充flag、time等后缀的参数,全部填充:对应不上类型的使用“我是默认字符串”填充</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/jquery-3.1.0.min.js"></script>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/common.js"></script>
|
||||
<script src="../vue/vue.js"></script>
|
||||
|
||||
<script>
|
||||
var urlBase = "../../";
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
userId: "",
|
||||
catalogShowType: '',
|
||||
treeShowType: '',
|
||||
showParamType:'',
|
||||
onlyUseLastParam: '',
|
||||
autoFillParam: '',
|
||||
userSettings: {}
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
mounted: function(){
|
||||
getStorage('userSettings', function(data){
|
||||
app.userSettings = data;
|
||||
app.catalogShowType = data.catalogShowType;
|
||||
app.treeShowType = data.treeShowType;
|
||||
app.showParamType = data.showParamType;
|
||||
app.onlyUseLastParam = data.onlyUseLastParam;
|
||||
app.autoFillParam = data.autoFillParam;
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
catalogShowType: function(newVal, oldval){
|
||||
app.userSettings.catalogShowType = newVal;
|
||||
storeUserSettings();
|
||||
window.parent.window.regeneratePathTree();
|
||||
},
|
||||
treeShowType: function(newVal, oldval){
|
||||
app.userSettings.treeShowType = newVal;
|
||||
storeUserSettings();
|
||||
window.parent.window.updateTreeShowType();
|
||||
},
|
||||
showParamType: function(newVal, oldval){
|
||||
app.userSettings.showParamType = newVal;
|
||||
storeUserSettings();
|
||||
},
|
||||
onlyUseLastParam: function(newVal, oldval){
|
||||
app.userSettings.onlyUseLastParam = newVal;
|
||||
storeUserSettings();
|
||||
},
|
||||
autoFillParam: function(newVal, oldval){
|
||||
app.userSettings.autoFillParam = newVal;
|
||||
storeUserSettings();
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// 存储用户的配置信息
|
||||
function storeUserSettings(){
|
||||
setStorage('userSettings', app.userSettings, function(){
|
||||
window.parent.window.updateUserSettings(app.userSettings);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
#app{padding-top: 10px;}
|
||||
</style>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>文档地址管理</title>
|
||||
<link rel="stylesheet" type="text/css" href="../zui/css/zui.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<table class="table table-bordered setting-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width: 50px;">序号</td>
|
||||
<td>地址</td>
|
||||
<td>操作</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in swaggerResourcesList" :key="item.id" :data-id="item.id" :data-index="index" >
|
||||
<td>{{index+1}}</td>
|
||||
<td>{{item}}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" type="button" v-on:click="deleteDocUrl($event)">删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<button class="btn" type="button" v-on:click="btnRefreshList"> 刷新 </button>
|
||||
<button class="btn btn-info" type="button" v-on:click="exportDocument">导出文档</button>
|
||||
<button class="btn btn-primary" type="button" v-on:click="addNewDocument">增加文档</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- 增加文档弹出框 -->
|
||||
<div class="modal fade" id="addNewDocumentModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||
</button>
|
||||
<h4 class="modal-title">输入文档地址</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input v-model="addNewDocumentInput" type="text" class="form-control" placeholder="例:http://192.168.0.172/swagger-resources">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" v-on:click="addNewDocumentBtn">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../mg-ui/js/jquery-3.1.0.min.js"></script>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/common.js"></script>
|
||||
<script src="../vue/vue.js"></script>
|
||||
<script src="../mg-ui/js/toast.js"></script>
|
||||
|
||||
<script>
|
||||
var urlBase = "../../";
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
swaggerResourcesList: [],
|
||||
addNewDocumentInput: ''
|
||||
},
|
||||
methods: {
|
||||
btnRefreshList: function(){
|
||||
this.refreshList();
|
||||
Toast.success("刷新成功!");
|
||||
},
|
||||
refreshList: function(){
|
||||
getStorage('swagger-resources-list', function(data){
|
||||
//console.log(data);
|
||||
app.swaggerResourcesList = data;
|
||||
});
|
||||
},
|
||||
addNewDocument: function(){
|
||||
app.addNewDocumentInput = '';
|
||||
$('#addNewDocumentModal').modal({moveable:true});
|
||||
},
|
||||
addNewDocumentBtn: function(){
|
||||
var addNewDocumentInput = app.addNewDocumentInput;
|
||||
if(isEmpty(addNewDocumentInput)) {
|
||||
Toast.error("地址不可以为空");return;
|
||||
}
|
||||
ajaxTemp(urlBase + "swagger-mg-ui/document/addSwaggerResources", "post", "json", {resourcesUrl: addNewDocumentInput}, function(json){
|
||||
if(validateResult(json)) {
|
||||
//window.parent.document.location.reload();
|
||||
app.swaggerResourcesList.push(addNewDocumentInput);
|
||||
$('#addNewDocumentModal').modal('hide');
|
||||
Toast.success("保存成功,刷新后生效!");
|
||||
}
|
||||
});
|
||||
},
|
||||
exportDocument: function(){
|
||||
window.parent.window.exportDocument();
|
||||
},
|
||||
deleteDocUrl: function(event){
|
||||
if(!confirm("确定要删除吗?")) {
|
||||
return;
|
||||
}
|
||||
var tr = $(event.currentTarget).parents("tr");
|
||||
var index = tr.data("index");
|
||||
var newDocList = [];
|
||||
for(var i=0;i<app.swaggerResourcesList.length;i++){
|
||||
if(i != index) {
|
||||
newDocList.push(app.swaggerResourcesList[i]);
|
||||
}
|
||||
}
|
||||
setStorage('swagger-resources-list', newDocList, function(data){
|
||||
app.swaggerResourcesList = newDocList;
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function(){
|
||||
this.refreshList();
|
||||
},
|
||||
watch: {
|
||||
catalogShowType: function(newVal, oldval){
|
||||
app.userSettings.catalogShowType = newVal;
|
||||
storeUserSettings();
|
||||
window.parent.window.regeneratePathTree();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app{padding-top: 10px;}
|
||||
</style>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>全局参数管理</title>
|
||||
<link rel="stylesheet" type="text/css" href="../zui/css/zui.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
全局参数管理
|
||||
</div>
|
||||
</body>
|
||||
<script src="../zui/js/zui.min.js"></script>
|
||||
<script src="../mg-ui/js/jquery-3.1.0.min.js"></script>
|
||||
<script src="../vue/vue.js"></script>
|
||||
|
||||
<script>
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
userId: "",
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user