Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc41ebdac1 |
@@ -255,6 +255,13 @@ function getCookie(name) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getQueryString(name) {
|
||||||
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||||
|
var r = window.location.search.substr(1).match(reg);
|
||||||
|
if (r != null) return unescape(r[2]);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字符串格式化
|
* 字符串格式化
|
||||||
*/
|
*/
|
||||||
@@ -280,7 +287,7 @@ String.prototype.format = function(args) {
|
|||||||
} else {
|
} else {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
String.prototype.endWith = function(str) {
|
String.prototype.endWith = function(str) {
|
||||||
if (str == null || str == "" || this.length == 0 || str.length > this.length) {
|
if (str == null || str == "" || this.length == 0 || str.length > this.length) {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ $(document).ready(function(){
|
|||||||
var afterSendTime = new Date().getTime();
|
var afterSendTime = new Date().getTime();
|
||||||
//console.log(result);
|
//console.log(result);
|
||||||
var requestObj = result.data;
|
var requestObj = result.data;
|
||||||
setStorage(cacheKeys.pRequestObjStart + docUrl, storeRequestParam);
|
// open-doc:去掉存储
|
||||||
$("#httpRequestStatus").text(requestObj.status);
|
$("#httpRequestStatus").text(requestObj.status);
|
||||||
$("#httpRequestTime").text((afterSendTime - beforeSendTime) + "ms");
|
$("#httpRequestTime").text((afterSendTime - beforeSendTime) + "ms");
|
||||||
try {
|
try {
|
||||||
@@ -224,23 +224,13 @@ $(document).ready(function(){
|
|||||||
* 提交模拟返回值
|
* 提交模拟返回值
|
||||||
*/
|
*/
|
||||||
$("#simulationResultSubmit").click(function(){
|
$("#simulationResultSubmit").click(function(){
|
||||||
var value = $("#simulationResultText").val();
|
// open-doc:去掉存储
|
||||||
value = getNotEmptyStr(value, "");
|
|
||||||
var docUrl = $("#simulationResultUrl").text();
|
|
||||||
setStorage(cacheKeys.pSimulationResponse + docUrl, value, function() {
|
|
||||||
Toast.warn("提交成功!");
|
|
||||||
}, function(msg) {
|
|
||||||
Toast.error("提交失败!" + msg);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* 获取模拟返回值
|
* 获取模拟返回值
|
||||||
*/
|
*/
|
||||||
$("#simulationResultGet").click(function(){
|
$("#simulationResultGet").click(function(){
|
||||||
var docUrl = $("#simulationResultUrl").text();
|
// open-doc:去掉获取存储
|
||||||
getStorage(cacheKeys.pSimulationResponse + docUrl, function(data){
|
|
||||||
$("#simulationResultText").val(data);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -272,10 +262,8 @@ function createOnlineDebugParamTable() {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function createOnlineDebugRequestParam(requestParamObj, url) {
|
function createOnlineDebugRequestParam(requestParamObj, url) {
|
||||||
// 查询之前的调试参数信息
|
// open-doc:去掉获取存储
|
||||||
getStorage(cacheKeys.pRequestObjStart + url, function(data) {
|
createOnlineDebugRequestParamFun({}, requestParamObj, url);
|
||||||
createOnlineDebugRequestParamFun(data, requestParamObj, url);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -63,12 +63,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// 定义配置的标签页
|
// open-doc:去掉定义配置的标签页
|
||||||
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');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,34 +71,10 @@ $(document).ready(function(){
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function getDocumentListByService() {
|
function getDocumentListByService() {
|
||||||
$("#choiseDocListUl").empty();
|
// open-doc:整个方法不同
|
||||||
showGlobalLoadingMessage('获取文档列表中,请稍候...', true);
|
showGlobalLoadingMessage('获取文档列表中,请稍候...', true);
|
||||||
// ajaxTemp("swagger-mg-ui/document/resourcesList", "post", "json", {}, function(json){
|
var doc = getQueryString("doc");
|
||||||
// if(validateResult(json) && json.data.length > 1) {
|
addDocumentByLocationService(doc);
|
||||||
// showGlobalLoadingMessage('等待选择需展示的文档,请选择...', true);
|
|
||||||
// for (var i = 0; i < json.data.length; i++) {
|
|
||||||
// var item = json.data[i];
|
|
||||||
// $("#choiseDocListUl").append('<li value="'+item.url+'">'+item.url+'</li>');
|
|
||||||
// }
|
|
||||||
// $('#choiseDocModal').modal({moveable:true, backdrop:'static', keyboard: false});
|
|
||||||
// } else {
|
|
||||||
// addDocumentByService();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
ajaxTemp("swagger-mg-ui/document/getLocationList", "post", "json", {}, function (json) {
|
|
||||||
if (validateResult(json) && json.data.length >= 1) {
|
|
||||||
for (var i = 0; i < json.data.length; i++) {
|
|
||||||
var item = json.data[i];
|
|
||||||
$("#choiceLocationList .dropdown-menu").append('<li><a href="javascript:void(0);" data-location="' + item.location + '">' + item.name + '</a></li>');
|
|
||||||
}
|
|
||||||
$("#choiceLocationList .choice-text").text(json.data[0].name);
|
|
||||||
addDocumentByLocationService(json.data[0].location);
|
|
||||||
} else {
|
|
||||||
initDashboard();
|
|
||||||
documentLoadFinish();
|
|
||||||
$("#choiceLocationList .choice-text").text("请先至 文档地址管理 处增加文档");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,7 +120,8 @@ function addDocumentByLocationService(choiceDocList) {
|
|||||||
// 获取原始的swagger的json对象
|
// 获取原始的swagger的json对象
|
||||||
globalLoadingMessager.show();
|
globalLoadingMessager.show();
|
||||||
showGlobalLoadingMessage('通过服务器端获取文档中,请稍候...', true);
|
showGlobalLoadingMessage('通过服务器端获取文档中,请稍候...', true);
|
||||||
ajaxTemp("swagger-mg-ui/document/docs", "post", "json", {choiceLocationList: choiceDocList}, function(json){
|
// open-doc:请求地址不同
|
||||||
|
ajaxTemp("swagger-mg-ui/open-doc/docs", "post", "json", {choiceLocationList: choiceDocList}, function(json){
|
||||||
//console.log(json);
|
//console.log(json);
|
||||||
showGlobalLoadingMessage('文档获取成功,解析中,请稍候...', true);
|
showGlobalLoadingMessage('文档获取成功,解析中,请稍候...', true);
|
||||||
if(isEmptyObject(json) || json.errCode !== 200) {
|
if(isEmptyObject(json) || json.errCode !== 200) {
|
||||||
@@ -412,11 +384,7 @@ $("#apiPathTree").on("click", ".show-doc", function(){
|
|||||||
$("#simulationResultUrlTest").text(data.domain + docUrl + "?zyplayerApiTest=1");
|
$("#simulationResultUrlTest").text(data.domain + docUrl + "?zyplayerApiTest=1");
|
||||||
$("#simulationResultUrlTest").attr("href", data.domain + docUrl + "?zyplayerApiTest=1");
|
$("#simulationResultUrlTest").attr("href", data.domain + docUrl + "?zyplayerApiTest=1");
|
||||||
$("#simulationResultText").val("");
|
$("#simulationResultText").val("");
|
||||||
getStorage('p-simulation-response-' + docUrl, function(data){
|
// open-doc:去掉了模拟返回
|
||||||
var resultText = getNotEmptyStr(data);
|
|
||||||
resultText = (typeof resultText == 'string') ? resultText : JSON.stringify(resultText, null, 4);
|
|
||||||
$("#simulationResultText").val(resultText);
|
|
||||||
});
|
|
||||||
// 处理在线文档
|
// 处理在线文档
|
||||||
$("#docUrl").text(docUrl);
|
$("#docUrl").text(docUrl);
|
||||||
$("#docRequestMethod").text(getNotEmptyStr(data.method));
|
$("#docRequestMethod").text(getNotEmptyStr(data.method));
|
||||||
@@ -1004,7 +972,7 @@ function documentLoadFinish() {
|
|||||||
* 存储用户设置
|
* 存储用户设置
|
||||||
*/
|
*/
|
||||||
function storeUserSettings() {
|
function storeUserSettings() {
|
||||||
setStorage(cacheKeys.userSettings, userSettings);
|
// open-doc:去掉存储设置
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1020,19 +988,12 @@ function updateUserSettings(newSetting) {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function initUserSettings() {
|
function initUserSettings() {
|
||||||
getStorage(cacheKeys.userSettings, function(data) {
|
// open-doc:去掉了获取配置和全局参数
|
||||||
userSettings = data;
|
|
||||||
if(isEmpty(userSettings) || isEmptyObject(userSettings)) {
|
|
||||||
userSettings = defaultUserSettings;
|
userSettings = defaultUserSettings;
|
||||||
}
|
|
||||||
changeContentWidth(userSettings.prevWNow);
|
changeContentWidth(userSettings.prevWNow);
|
||||||
updateTreeShowType();
|
updateTreeShowType();
|
||||||
// 增加文档
|
// 增加文档
|
||||||
getDocumentListByService();
|
getDocumentListByService();
|
||||||
});
|
|
||||||
getStorage(cacheKeys.globalParamList, function(data) {
|
|
||||||
debugGlobalParam = data;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showGlobalLoadingMessage(text, loading) {
|
function showGlobalLoadingMessage(text, loading) {
|
||||||
|
|||||||
Reference in New Issue
Block a user