Commit cfc87cb3 by 无尘

fix: 修改本地数据属性

parent 1ed605ac
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.2b00d5c727966d90b5b44417d78e1289.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.46796dcc61179f1f037f.js></script><script type=text/javascript src=./static/js/vendor.71dc162eb690bf6a36a0.js></script><script type=text/javascript src=./static/js/app.80268ec4d989f50283bc.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><link rel="shortcut icon" href=./favicon.ico><title>API网关管理平台</title><link href=./static/css/app.0615b1f6b299caabd6c18f636d51d219.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.5789b77cab8ed6fbb9ca.js></script><script type=text/javascript src=./static/js/vendor.71dc162eb690bf6a36a0.js></script><script type=text/javascript src=./static/js/app.80268ec4d989f50283bc.js></script></body></html>
\ 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,o,c){for(var f,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(n&&n(r,o,c);b.length;)b.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:"52863aa1d72d31066413",1:"0ebe3ead93207dc78a78",2:"d023aeaa24913addda1f",3:"ee2db5932cf0c94dec20",4:"42639b6df28493f31a16",5:"842d518baa251c8fedc4",6:"52e14b1f79af7d86f42f",7:"b2a85a42ddd430235a63",8:"81460c8c66d06cfea732",9:"c98145195e68a6e13faf",10:"638039a7b39908980436",11:"f27d1de28264fbbe30ff",12:"ccbc18453e41490e2dba",13:"b109164d2be44afb7733",14:"9825bb69e60b8030c230",15:"6700988b665e14f99d41",16:"6e70f43452cbef826036",17:"8354f7b686256ddf47fb",18:"e7685f45ec4dd5b70ae4",19:"40fd9824f7542ed7f56d",20:"c163ea91d150e0ca1cb1",21:"55879284ad4d1f03fbe0"}[e]+".js";var f=setTimeout(d,12e4);function d(){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=d,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
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var f,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(r,c,a);b.length;)b.shift()();if(a)for(u=0;u<a.length;u++)i=o(o.s=a[u]);return i};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 c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+e+"."+{0:"52863aa1d72d31066413",1:"0ebe3ead93207dc78a78",2:"f71d924e7cc4d6ef7696",3:"ee2db5932cf0c94dec20",4:"42639b6df28493f31a16",5:"842d518baa251c8fedc4",6:"52e14b1f79af7d86f42f",7:"b2a85a42ddd430235a63",8:"81460c8c66d06cfea732",9:"c98145195e68a6e13faf",10:"638039a7b39908980436",11:"f27d1de28264fbbe30ff",12:"ccbc18453e41490e2dba",13:"b109164d2be44afb7733",14:"9825bb69e60b8030c230",15:"6700988b665e14f99d41",16:"6e70f43452cbef826036",17:"8354f7b686256ddf47fb",18:"e7685f45ec4dd5b70ae4",19:"40fd9824f7542ed7f56d",20:"c163ea91d150e0ca1cb1",21:"55879284ad4d1f03fbe0"}[e]+".js";var f=setTimeout(d,12e4);function d(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=d,c.appendChild(a),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
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2019-08-07 17:17:50
* @LastEditors : 无尘
* @LastEditTime : 2020-01-13 11:43:43
* @LastEditTime : 2020-01-13 14:41:40
-->
<!--
<create-base></create-base>
......@@ -297,6 +297,24 @@ export default {
}
},
/**
* 处理properties
*/
async handleProperties(item) {
const that = this;
for (let childKey in item) {
// 为了以后切换type可以监听到属性,需要预制属性
if (item[childKey].type != 'array' && item[childKey].type != 'object') {
item[childKey].properties = {};
}
if (item[childKey].type == 'array' && Object.keys(item[childKey].items.properties).length) {
await that.handleProperties(item[childKey].items.properties, item[childKey]);
}
if (item[childKey].type == 'object' && Object.keys(item[childKey].properties).length) {
await that.handleProperties(item[childKey].properties, item[childKey]);
}
}
},
/**
* 处理 isRootKey
*/
async handleArrObjData(item, parentKey) {
......@@ -535,7 +553,7 @@ export default {
/**
* 处理状态中的前端数据
*/
handleStoreData() {
async handleStoreData() {
const that = this;
that.apiInfoData = JSON.parse(JSON.stringify(that.$store.state.frontInfo));
that.headerData = that.apiInfoData.headerData;
......@@ -588,6 +606,20 @@ export default {
},
required: []
};
// 为了处理修改 type 后添加子属性响应问题
if (Object.keys(that.apiInfoData.bodyJsonData).length) {
for (const key in that.apiInfoData.bodyJsonData.properties.bodyRoot.properties) {
if (that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].type != 'array' && that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].type != 'object' ){
that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].properties = {};
}
if (that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].type == 'array' && Object.keys(that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].items.properties).length) {
await that.handleProperties(that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].items.properties);
}
if (that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].type == 'object' && Object.keys(that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].properties).length) {
await that.handleProperties(that.apiInfoData.bodyJsonData.properties.bodyRoot.properties[key].properties);
}
}
}
// console.log('状态中:json//',JSON.stringify(that.apiInfoData.bodyJsonData));
that.bodyJsonData = Object.keys(that.apiInfoData.bodyJsonData).length ? that.apiInfoData.bodyJsonData : bodyJsonData;
that.bodyFormData = Object.keys(that.apiInfoData.bodyFormData).length ? that.apiInfoData.bodyFormData : bodyFormData;
......
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