fix(接口测试): 修复导入页面保留swagger上次配置参数记录问题

--bug=1021412--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001021412
This commit is contained in:
guoyuqi 2022-12-30 15:15:46 +08:00 committed by xiaomeinvG
parent b15910316e
commit 648cc80439
1 changed files with 11 additions and 5 deletions

View File

@ -10,7 +10,7 @@
:destroy-on-close="true"> :destroy-on-close="true">
<div class="header-bar"> <div class="header-bar">
<div>{{ $t('api_test.api_import.data_format') }}</div> <div>{{ $t('api_test.api_import.data_format') }}</div>
<el-radio-group v-model="selectedPlatformValue"> <el-radio-group v-model="selectedPlatformValue" @input="clearUrParameter">
<span v-for="(item, index) in platforms" :key="index"> <span v-for="(item, index) in platforms" :key="index">
<el-radio v-if="!isScenarioModel || item.name != 'Swagger'" :label="item.value">{{ item.name }}</el-radio> <el-radio v-if="!isScenarioModel || item.name != 'Swagger'" :label="item.value">{{ item.name }}</el-radio>
</span> </span>
@ -106,7 +106,7 @@
:show-desc="true" :show-desc="true"
:isShowEnable="isShowEnable" :isShowEnable="isShowEnable"
:suggestions="headerSuggestions" :suggestions="headerSuggestions"
:items="headers" /> :items="headers"/>
<!--query 参数--> <!--query 参数-->
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<span>{{ $t('api_test.definition.request.query_param') }}{{ $t('api_test.api_import.optional') }}</span> <span>{{ $t('api_test.definition.request.query_param') }}{{ $t('api_test.api_import.optional') }}</span>
@ -466,9 +466,9 @@ export default {
clearAuthInfo() { clearAuthInfo() {
this.headers = []; this.headers = [];
this.queryArguments = []; this.queryArguments = [];
this.headers.push(new KeyValue({ enable: true })); this.headers.push(new KeyValue({enable: true}));
this.queryArguments.push(new KeyValue({ enable: true })); this.queryArguments.push(new KeyValue({enable: true}));
this.authConfig = { hashTree: [], authManager: {} }; this.authConfig = {hashTree: [], authManager: {}};
this.$refs.importAuth.initData(); this.$refs.importAuth.initData();
}, },
changeAuthEnable() { changeAuthEnable() {
@ -476,6 +476,12 @@ export default {
this.clearAuthInfo(); this.clearAuthInfo();
} }
}, },
clearUrParameter(value) {
if (value !== 'Swagger2') {
this.clearAuthInfo();
this.authEnable = false;
}
},
buildParam() { buildParam() {
let param = {}; let param = {};
Object.assign(param, this.formData); Object.assign(param, this.formData);