fix(接口测试): 修复推荐提取数字显示精确度错误问题

--bug=1009465 --user=赵勇 [github#9090]JSONPath提取器数据精度丢失 https://www.tapd.cn/55049933/s/1090126
This commit is contained in:
fit2-zhao 2022-01-10 18:29:53 +08:00 committed by 刘瑞斌
parent 09a4129dd6
commit 9d085402f1
2 changed files with 108 additions and 106 deletions

View File

@ -125,6 +125,7 @@ export default {
this.fullTreeNodes = []; this.fullTreeNodes = [];
this.failsTreeNodes = []; this.failsTreeNodes = [];
this.isRequestResult = false; this.isRequestResult = false;
this.activeName = "total";
}, },
handleClick(tab, event) { handleClick(tab, event) {
this.isRequestResult = false; this.isRequestResult = false;

View File

@ -2,7 +2,7 @@
<ms-drawer class="json-path-picker" :visible="visible" :size="30" @close="close" direction="right" v-clickoutside="close"> <ms-drawer class="json-path-picker" :visible="visible" :size="30" @close="close" direction="right" v-clickoutside="close">
<template v-slot:header> <template v-slot:header>
<ms-instructions-icon :content="tip"/> <ms-instructions-icon :content="tip"/>
{{tip}} {{ tip }}
</template> </template>
<jsonpath-picker :code="data" v-on:path="pathChangeHandler" ref="jsonpathPicker"/> <jsonpath-picker :code="data" v-on:path="pathChangeHandler" ref="jsonpathPicker"/>
</ms-drawer> </ms-drawer>
@ -16,8 +16,8 @@ let dotReplace = "#DOT_MASK#";
const clickoutside = { const clickoutside = {
// //
bind (el, binding, vnode) { bind(el, binding, vnode) {
function documentHandler (e) { function documentHandler(e) {
// //
if (el.contains(e.target)) { if (el.contains(e.target)) {
return false return false
@ -28,12 +28,14 @@ const clickoutside = {
binding.value(e) binding.value(e)
} }
} }
// 便unbind // 便unbind
el.__vueClickOutside__ = documentHandler el.__vueClickOutside__ = documentHandler
document.addEventListener('click', documentHandler) document.addEventListener('click', documentHandler)
}, },
update () { }, update() {
unbind (el, binding) { },
unbind(el, binding) {
// //
document.removeEventListener('click', el.__vueClickOutside__) document.removeEventListener('click', el.__vueClickOutside__)
delete el.__vueClickOutside__ delete el.__vueClickOutside__
@ -43,7 +45,7 @@ const clickoutside = {
export default { export default {
name: "MsApiJsonpathSuggest", name: "MsApiJsonpathSuggest",
components: {MsInstructionsIcon, MsDrawer}, components: {MsInstructionsIcon, MsDrawer},
directives: { clickoutside }, directives: {clickoutside},
data() { data() {
return { return {
visible: false, visible: false,
@ -67,9 +69,8 @@ export default {
this.data = {}; this.data = {};
try { try {
// //
// let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"'); let JSONBig = require('json-bigint')({"storeAsString": true});
// let param = JSON.parse(JSON.stringify(JSONBig.parse(objStr)));
let param = JSON.parse(objStr);
if (param instanceof Array) { if (param instanceof Array) {
this.$warning('不支持解析JSON数组'); this.$warning('不支持解析JSON数组');
return; return;
@ -152,23 +153,23 @@ export default {
return this.getParamValue(childObj, index, params); return this.getParamValue(childObj, index, params);
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.json-path-picker { .json-path-picker {
padding: 10px 13px; padding: 10px 13px;
} }
.json-path-picker >>> .json-tree { .json-path-picker >>> .json-tree {
margin-top: 0px; margin-top: 0px;
margin-left: 6px; margin-left: 6px;
} }
/deep/ .el-icon-close:hover { /deep/ .el-icon-close:hover {
font-size: 30px; font-size: 30px;
font-weight: bold; font-weight: bold;
} }
</style> </style>