#I4MKKW api接口调试支持文件上传,全局参数控制优化

This commit is contained in:
暮光:城中城
2021-12-15 23:20:17 +08:00
parent c176bd7577
commit e2a8c46afb
16 changed files with 206 additions and 61 deletions

View File

@@ -36,7 +36,6 @@
let treeData = ref([]);
let expandedKeys = ref([]);
let choiceDocId = ref('');
let searchKeywords = ref('');
const docChecked = (val, node) => {
if (node.node.isLeaf) {
@@ -46,11 +45,11 @@
};
const loadDoc = (docId, keyword, callback) => {
choiceDocId.value = docId;
searchKeywords.value = keyword;
zyplayerApi.apiShareDocApisDetail({shareUuid: docId}).then(res => {
let v2Doc = toJsonObj(res.data);
// osdoc.swagger 和 doc.openapi 的区别
if (typeof v2Doc !== 'object' || !v2Doc.openapi) {
callback(false);
message.error('获取文档数据失败请检查文档是否为标准的OpenApi文档格式');
return;
}
@@ -60,13 +59,15 @@
store.commit('setOpenApiUrlMethodMap', treeData.urlMethodMap);
store.commit('setOpenApiMethodStatistic', treeData.methodStatistic);
tagPathMap.value = treeData.tagPathMap;
loadTreeData();
callback();
loadTreeData(keyword);
callback(true);
}).catch(() => {
callback(false);
});
};
const loadTreeData = async () => {
const loadTreeData = async (keyword) => {
let metaInfo = {uuid: choiceDocId.value};
treeData.value = getTreeDataForTag(openApiDoc.value, tagPathMap.value, searchKeywords.value, metaInfo);
treeData.value = getTreeDataForTag(openApiDoc.value, tagPathMap.value, keyword, metaInfo);
await nextTick();
expandedKeys.value = ['main'];
};
@@ -89,6 +90,7 @@
expandedKeys,
docChecked,
loadDoc,
loadTreeData,
treeData,
};
},

View File

@@ -36,7 +36,6 @@
let treeData = ref([]);
let expandedKeys = ref([]);
let choiceDocId = ref('');
let searchKeywords = ref('');
const docChecked = (val, node) => {
if (node.node.isLeaf) {
@@ -46,7 +45,6 @@
};
const loadDoc = (docId, keyword, callback) => {
choiceDocId.value = docId;
searchKeywords.value = keyword;
zyplayerApi.apiShareDocApisDetail({shareUuid: docId}).then(res => {
let v2Doc = toJsonObj(res.data);
if (typeof v2Doc !== 'object' || !v2Doc.swagger) {
@@ -60,13 +58,15 @@
store.commit('setSwaggerUrlMethodMap', treeData.urlMethodMap);
store.commit('setSwaggerMethodStatistic', treeData.methodStatistic);
tagPathMap.value = treeData.tagPathMap;
loadTreeData();
loadTreeData(keyword);
callback(true);
}).catch(() => {
callback(false);
});
};
const loadTreeData = async () => {
const loadTreeData = async (keyword) => {
let metaInfo = {uuid: choiceDocId.value};
treeData.value = getTreeDataForTag(swaggerDoc.value, tagPathMap.value, searchKeywords.value, metaInfo);
treeData.value = getTreeDataForTag(swaggerDoc.value, tagPathMap.value, keyword, metaInfo);
await nextTick();
expandedKeys.value = ['main'];
};
@@ -89,6 +89,7 @@
expandedKeys,
docChecked,
loadDoc,
loadTreeData,
treeData,
};
},