fix(全局): bugFix

This commit is contained in:
baiqi 2024-06-28 18:08:23 +08:00 committed by 刘瑞斌
parent 17a955b2e0
commit b8914a77c4
6 changed files with 24 additions and 14 deletions

View File

@ -21,5 +21,5 @@ export default {
'ms.case.associate.gotIt': '知道了',
'ms.case.associate.switchProject': '切换项目?',
'ms.case.associate.switchProjectPopTip': '切换后,已选数据将清空',
'ms.case.associate.apiSearchPlaceholder': '支持 ID/名称/标签/路径搜索',
'ms.case.associate.apiSearchPlaceholder': '通过 ID/名称/标签/路径搜索',
};

View File

@ -195,4 +195,5 @@ export default {
'common.expandAllSubModule': 'Expand all submodules',
'common.collapseAllSubModule': 'Collapse all submodules',
'common.selectedCount': '{count} data selected',
'common.advancedSettings': 'Advanced settings',
};

View File

@ -194,4 +194,5 @@ export default {
'common.expandAllSubModule': '展开全部子模块',
'common.collapseAllSubModule': '收起全部子模块',
'common.selectedCount': '(已选 {count} 项数据)',
'common.advancedSettings': '高级设置',
};

View File

@ -416,7 +416,7 @@
type="icon-icon_flashlamp"
:size="15"
:class="!props.response ? 'ms-params-input-suffix-icon--disabled' : 'ms-params-input-suffix-icon'"
@click.stop="() => showFastExtraction(record)"
@click.stop="() => showFastExtraction(record as ExpressionConfig)"
/>
</a-tooltip>
</template>
@ -437,7 +437,7 @@
<a-button type="secondary" size="mini" @click="record.moreSettingPopoverVisible = false">
{{ t('common.cancel') }}
</a-button>
<a-button type="primary" size="mini" @click="() => applyMoreSetting(record)">
<a-button type="primary" size="mini" @click="() => applyMoreSetting(record as ExpressionConfig)">
{{ t('common.confirm') }}
</a-button>
</div>

View File

@ -119,7 +119,12 @@
</div>
<div class="match-result">
<div v-if="isMatched && matchResult.length === 0">{{ t('apiTestDebug.noMatchResult') }}</div>
<pre v-for="(e, i) of matchResult" :key="i">{{ `${e}` }}</pre>
<template v-if="props.config.extractType === RequestExtractExpressionEnum.JSON_PATH">
<pre>{{ matchResult }}</pre>
</template>
<template v-else>
<pre v-for="(e, i) of matchResult" :key="i">{{ `${e}` }}</pre>
</template>
</div>
</div>
<a-collapse
@ -248,15 +253,18 @@
break;
case RequestExtractExpressionEnum.JSON_PATH:
try {
matchResult.value =
JSONPath({
json: parseJson.value,
path: expressionForm.value.expression,
})?.map((e: any) =>
JSON.stringify(e)
.replace(/Number\(([^)]+)\)/g, '$1')
.replace(/^"|"$/g, '')
) || [];
const results = JSONPath({
json: parseJson.value,
path: expressionForm.value.expression,
wrap: false,
});
matchResult.value = Array.isArray(results)
? results.map((e: any) =>
JSON.stringify(e)
.replace(/Number\(([^)]+)\)/g, '$1')
.replace(/^"|"$/g, '')
)
: results;
} catch (error) {
matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }) || [];
}

View File

@ -6,7 +6,7 @@
color: type.color,
}"
>
{{ type.label }}
{{ t(type.label) }}
</div>
</template>