Commit 0155043a by 无尘

fix: 修改创建API

parent d2ca4187
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.e3ec8c9ab37b0a34b2f442e4ac008f88.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script src=//web-1251519181.file.myqcloud.com/components/input.2.0.15.js></script><script src=//web-1251519181.file.myqcloud.com/components/delete.2.0.01.js></script><script type=text/javascript src=./static/js/manifest.2a0c6038ef0501bb9a6e.js></script><script type=text/javascript src=./static/js/vendor.71dc162eb690bf6a36a0.js></script><script type=text/javascript src=./static/js/app.8c17e0f45e015cda57f6.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.f7be81ab87dd09772c4e87f95d6ac38c.css rel=stylesheet></head><body style="min-width: 1400px;"><div id=app></div><script src=//web-1251519181.file.myqcloud.com/lib/vue/2.6.6/vue.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vue-router/3.0.2/vue-router.min.js></script><script src=//web-1251519181.file.myqcloud.com/lib/vuex/3.1.0/vuex.min.js></script><script src=//web-1251519181.file.myqcloud.com/components/img-preview.2.0.00.js></script><script>// Raven.config('https://3715a345910d4c768e7a1ec14619c2d5@sentry.io/1413672').install();</script><script src=//web-1251519181.file.myqcloud.com/components/input.2.0.15.js></script><script src=//web-1251519181.file.myqcloud.com/components/delete.2.0.01.js></script><script type=text/javascript src=./static/js/manifest.c37374e13c14f75e275e.js></script><script type=text/javascript src=./static/js/vendor.71dc162eb690bf6a36a0.js></script><script type=text/javascript src=./static/js/app.8c17e0f45e015cda57f6.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,c){for(var f,b,d,i=0,u=[];i<r.length;i++)b=r[i],t[b]&&u.push(t[b][0]),t[b]=0;for(f in a)Object.prototype.hasOwnProperty.call(a,f)&&(e[f]=a[f]);for(n&&n(r,a,c);u.length;)u.shift()();if(c)for(i=0;i<c.length;i++)d=o(o.s=c[i]);return d};var r={},t={24:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var a=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,o.nc&&c.setAttribute("nonce",o.nc),c.src=o.p+"static/js/"+e+"."+{0:"63d3650fda518fa5d91a",1:"0ebe3ead93207dc78a78",2:"a6c5cd1583619d785e31",3:"37b099013ab5b86e6b1a",4:"83b134741cef8a1fc258",5:"61455822347fda4022ec",6:"7a4f7f41cea5405e209f",7:"b2a85a42ddd430235a63",8:"81460c8c66d06cfea732",9:"9c96ae683c51b04359d0",10:"638039a7b39908980436",11:"f27d1de28264fbbe30ff",12:"ccbc18453e41490e2dba",13:"b109164d2be44afb7733",14:"9825bb69e60b8030c230",15:"ffd723714f3c604ae809",16:"825722b083bcf8e5877e",17:"4786e13164b8fb55cf3b",18:"ebf8edd37453b58275c4",19:"237102ab58f0569908b0",20:"106676f1ed05cab7702b",21:"9811614945523e2ab002"}[e]+".js";var f=setTimeout(b,12e4);function b(){c.onerror=c.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return c.onerror=c.onload=b,a.appendChild(c),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="./",o.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,o,c){for(var f,b,i,u=0,d=[];u<r.length;u++)b=r[u],t[b]&&d.push(t[b][0]),t[b]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(n&&n(r,o,c);d.length;)d.shift()();if(c)for(u=0;u<c.length;u++)i=a(a.s=c[u]);return i};var r={},t={24:0};function a(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,a){n=t[e]=[r,a]});n[2]=r;var o=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,a.nc&&c.setAttribute("nonce",a.nc),c.src=a.p+"static/js/"+e+"."+{0:"63d3650fda518fa5d91a",1:"0ebe3ead93207dc78a78",2:"b41a8eb9f6af60fe87bc",3:"37b099013ab5b86e6b1a",4:"83b134741cef8a1fc258",5:"61455822347fda4022ec",6:"7a4f7f41cea5405e209f",7:"b2a85a42ddd430235a63",8:"81460c8c66d06cfea732",9:"9c96ae683c51b04359d0",10:"638039a7b39908980436",11:"f27d1de28264fbbe30ff",12:"ccbc18453e41490e2dba",13:"b109164d2be44afb7733",14:"9825bb69e60b8030c230",15:"ffd723714f3c604ae809",16:"825722b083bcf8e5877e",17:"4786e13164b8fb55cf3b",18:"ebf8edd37453b58275c4",19:"237102ab58f0569908b0",20:"106676f1ed05cab7702b",21:"9811614945523e2ab002"}[e]+".js";var f=setTimeout(b,12e4);function b(){c.onerror=c.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return c.onerror=c.onload=b,o.appendChild(c),r},a.m=e,a.c=r,a.d=function(e,n,r){a.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},a.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(n,"a",n),n},a.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},a.p="./",a.oe=function(e){throw console.error(e),e}}([]);
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-07 18:01:05 * @Date: 2019-08-07 18:01:05
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-10-12 17:10:32 * @LastEditTime: 2019-10-14 15:51:52
--> -->
<!-- <!--
<create-backend></create-backend> <create-backend></create-backend>
...@@ -480,7 +480,7 @@ export default { ...@@ -480,7 +480,7 @@ export default {
} }
that.backBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData)); that.backBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData));
that.frontBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData)); that.frontBodyJsonData = JSON.parse(JSON.stringify(frontInfo.bodyJsonData));
console.log(that.backBodyFormData, that.backBodyJsonData) // console.log(that.backBodyFormData, that.backBodyJsonData)
} }
that.$forceUpdate(); that.$forceUpdate();
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-07 15:46:43 * @Date: 2019-08-07 15:46:43
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-10-12 10:43:15 * @LastEditTime: 2019-10-14 11:33:47
--> -->
<!-- <!--
<create-base></create-base> <create-base></create-base>
...@@ -118,41 +118,52 @@ export default { ...@@ -118,41 +118,52 @@ export default {
}); });
}, },
/** /**
* 处理 isRootKey
*/
async handleArrObjData(item) {
const that = this;
for (let childKey in item) {
item[childKey]['isRootKey'] = !item[childKey]['isRootKey'] || item[childKey]['isRootKey'] == '' || item[childKey]['isRootKey'] == 0 ? false : true; // 是否是后端参数字段
if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) {
await that.handleArrObjData(item[childKey].items.properties);
}
if (item[childKey].type == 'object' && Object.keys(item[childKey].properties).length) {
await that.handleArrObjData(item[childKey].properties);
}
}
return item;
},
/**
* 处理数据存入 store * 处理数据存入 store
*/ */
// 前端通用数据处理 // 前端通用数据处理
handleQuery(front, allData, type) { async handleQuery(front, allData, type) {
const that = this; const that = this;
let newObj = { let newObj = {
type: 'object', type: 'object',
level: 1, level: 1,
properties: {} properties: {}
}; };
// 最开始处理的时候, frontParams 和 endParams是同一份数据,所有前后端公用一份参数数据
for (let key in allData.frontParams.properties) { for (let key in allData.frontParams.properties) {
if (allData.frontParams.properties[key].frontOriginType == type && !allData.endParams.properties[key].constFlag) { if (allData.frontParams.properties[key].frontOriginType == type && !allData.endParams.properties[key].constFlag) {
allData.frontParams.properties[key].isRootKey = allData.frontParams.properties[key].isRootKey == 1 || allData.frontParams.properties[key].isRootKey == true ? true : false; allData.frontParams.properties[key].isRootKey = allData.frontParams.properties[key].isRootKey == 1 || allData.frontParams.properties[key].isRootKey == true ? true : false;
that.$set(newObj.properties, allData.frontParams.properties[key].currentKey, allData.frontParams.properties[key]); that.$set(newObj.properties, allData.frontParams.properties[key].currentKey, allData.frontParams.properties[key]);
} }
// 如果有数组出现
if (allData.frontParams.properties[key].type == 'array' && Object.keys(allData.frontParams.properties[key].items.properties).length) {
await that.handleArrObjData(allData.frontParams.properties[key].items.properties, allData.frontParams.properties[key].isRootKey);
}
// 如果有对象出现
if (allData.frontParams.properties[key].type == 'object' && Object.keys(allData.frontParams.properties[key].properties).length) {
await that.handleArrObjData(allData.frontParams.properties[key].properties, allData.frontParams.properties[key].isRootKey);
}
} }
return newObj; return newObj;
}, },
/** /**
* 后端的数据处理 * 处理常量参数
*/ */
handleBack(back, allData, type) {
const that = this;
let newObj = {
type: 'object',
level: 1,
properties: {}
};
for (let key in allData.endParams.properties) {
if (allData.endParams.properties[key].backendOriginType == type && !allData.endParams.properties[key].constFlag) {
that.$set(newObj.properties, allData.endParams.properties[key].rootKey, allData.endParams.properties[key]);
}
}
return newObj;
},
handleConst(back, allData) { handleConst(back, allData) {
const that = this; const that = this;
let newObj = { let newObj = {
...@@ -167,7 +178,9 @@ export default { ...@@ -167,7 +178,9 @@ export default {
} }
return newObj; return newObj;
}, },
/**
* 获取已经保存的数据,处理前端数据
*/
async handleFrontData(data) { async handleFrontData(data) {
const that = this; const that = this;
let allData = JSON.parse(JSON.stringify(data)); let allData = JSON.parse(JSON.stringify(data));
...@@ -193,6 +206,9 @@ export default { ...@@ -193,6 +206,9 @@ export default {
// console.log('base:', allData.requestType, allData.frontBodyType, front); // console.log('base:', allData.requestType, allData.frontBodyType, front);
that.$store.dispatch('saveFrontInfo', front); that.$store.dispatch('saveFrontInfo', front);
}, },
/**
* 获取已经保存的数据,处理前端数据
*/
async handleBackData(data) { async handleBackData(data) {
const that = this; const that = this;
let allData = JSON.parse(JSON.stringify(data)); let allData = JSON.parse(JSON.stringify(data));
...@@ -285,7 +301,6 @@ export default { ...@@ -285,7 +301,6 @@ export default {
mounted() { mounted() {
const that = this; const that = this;
/* eslint-disable */ /* eslint-disable */
// console.log(that.$store);
if (that.$route.query.interfaceId && !Object.keys(that.$store.state.baseInfo).length) { if (that.$route.query.interfaceId && !Object.keys(that.$store.state.baseInfo).length) {
that.getData(); that.getData();
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2019-08-07 17:17:50 * @Date: 2019-08-07 17:17:50
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2019-10-14 10:24:50 * @LastEditTime: 2019-10-14 14:49:20
--> -->
<!-- <!--
<create-base></create-base> <create-base></create-base>
...@@ -302,8 +302,8 @@ export default { ...@@ -302,8 +302,8 @@ export default {
async handleArrObjData(item, parentIsRootKey) { async handleArrObjData(item, parentIsRootKey) {
const that = this; const that = this;
for (let childKey in item) { for (let childKey in item) {
item[childKey]['isRootKey'] = item[childKey]['isRootKey'] == '' || item[childKey]['isRootKey'] == 0 ? false : true; // 是否是后端参数字段 item[childKey]['isRootKey'] = !item[childKey]['isRootKey'] || item[childKey]['isRootKey'] == '' || item[childKey]['isRootKey'] == 0 ? false : true; // 是否是后端参数字段
// 是否禁用,不能选择 // 是否禁用,不能选择,这里暂时设置一下,后面后端配置中会去重新设置 isRootKeyFlag 这个字段值
item[childKey]['isRootKeyFlag'] = !parentIsRootKey || item[childKey]['isRootKey'] ? false : true; item[childKey]['isRootKeyFlag'] = !parentIsRootKey || item[childKey]['isRootKey'] ? false : true;
if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) { if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) {
await that.handleArrObjData(item[childKey].items.properties, item[childKey].isRootKey); await that.handleArrObjData(item[childKey].items.properties, item[childKey].isRootKey);
...@@ -414,7 +414,7 @@ export default { ...@@ -414,7 +414,7 @@ export default {
async handleRootKey(item) { async handleRootKey(item) {
const that = this; const that = this;
for (let childKey in item) { for (let childKey in item) {
item[childKey]['isRootKey'] = item[childKey]['isRootKey'] == '' || item[childKey]['isRootKey'] == 0 ? false : true; // 是否是后端参数字段 item[childKey]['isRootKey'] = !item[childKey]['isRootKey'] || item[childKey]['isRootKey'] == '' || item[childKey]['isRootKey'] == 0 ? false : true; // 是否是后端参数字段
if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) { if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) {
await that.handleRootKey(item[childKey].items.properties); await that.handleRootKey(item[childKey].items.properties);
} }
...@@ -424,7 +424,9 @@ export default { ...@@ -424,7 +424,9 @@ export default {
} }
return item; return item;
}, },
/**
* 下一步之前处理数据
*/
/* eslint-disable */ /* eslint-disable */
async handleData() { async handleData() {
const that = this; const that = this;
...@@ -438,7 +440,7 @@ export default { ...@@ -438,7 +440,7 @@ export default {
showMsg.showmsg('参数名重复', 'warning'); showMsg.showmsg('参数名重复', 'warning');
return false; return false;
} }
// 如果有选导入 dubbo 数据 // 如果有选导入 dubbo 数据,修改后端配置数据
if (that.importType == 2 && that.dubboData.apiPackage != '' && that.dubboData.method != '') { if (that.importType == 2 && that.dubboData.apiPackage != '' && that.dubboData.method != '') {
let apiBack = JSON.parse(JSON.stringify(that.$store.state.backInfo)); let apiBack = JSON.parse(JSON.stringify(that.$store.state.backInfo));
apiBack.dubboInterface = that.dubboData.apiPackage; apiBack.dubboInterface = that.dubboData.apiPackage;
...@@ -446,7 +448,6 @@ export default { ...@@ -446,7 +448,6 @@ export default {
apiBack.interfaceType = '1'; apiBack.interfaceType = '1';
that.$store.dispatch('saveBackInfo', apiBack); that.$store.dispatch('saveBackInfo', apiBack);
} }
if (that.apiInfoData.requestType == 'POST' && that.apiInfoData.frontBodyType == 'json') { if (that.apiInfoData.requestType == 'POST' && that.apiInfoData.frontBodyType == 'json') {
if (Object.keys(that.bodyJsonData.properties.bodyRoot.properties).length) { if (Object.keys(that.bodyJsonData.properties.bodyRoot.properties).length) {
that.bodyJsonData.properties.bodyRoot.required = []; that.bodyJsonData.properties.bodyRoot.required = [];
...@@ -505,6 +506,9 @@ export default { ...@@ -505,6 +506,9 @@ export default {
that.$emit('submitNext', that.apiInfoData); that.$emit('submitNext', that.apiInfoData);
console.log('front:', that.apiInfoData); console.log('front:', that.apiInfoData);
}, },
/**
* 处理状态中的前端数据
*/
handleStoreData() { handleStoreData() {
const that = this; const that = this;
that.apiInfoData = JSON.parse(JSON.stringify(that.$store.state.frontInfo)); that.apiInfoData = JSON.parse(JSON.stringify(that.$store.state.frontInfo));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment