refactor(接口测试): 添加案例或mock期望时弹出框默认全屏

添加案例或mock期望时弹出框默认全屏
This commit is contained in:
song-tianyang 2022-02-08 11:16:20 +08:00 committed by CountryBuilder
parent 82da159c12
commit 4cb1e8d646
4 changed files with 51 additions and 34 deletions

View File

@ -1,6 +1,6 @@
<template>
<div v-if="visible">
<ms-drawer :size="60" @close="apiCaseClose" direction="bottom">
<ms-drawer :size="60" @close="apiCaseClose" direction="bottom" ref="testCaseDrawer">
<template v-slot:header>
<api-case-header
:api="api"
@ -147,6 +147,9 @@ export default {
this.condition = {components: API_CASE_CONFIGS};
this.sysAddition();
this.visible = true;
this.$nextTick(() => {
this.$refs.testCaseDrawer.setfullScreen();
});
},
copy(apiCase) {
this.api.id = apiCase.apiDefinitionId;
@ -178,8 +181,8 @@ export default {
}
this.visible = true;
},
saveCase(item , hideAlert) {
this.$refs.apiCaseItem.saveTestCase(item ,hideAlert);
saveCase(item, hideAlert) {
this.$refs.apiCaseItem.saveTestCase(item, hideAlert);
},
saveApiAndCase(api) {
if (api && api.url) {
@ -323,9 +326,17 @@ export default {
if (request.backScript) {
request.hashTree.push(request.backScript);
}
let uuid = getUUID();
let newUuid = getUUID();
request.id = uuid;
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: true, tags: [], uuid: uuid, caseStatus: "Underway"};
let obj = {
apiDefinitionId: this.api.id,
name: '',
priority: 'P0',
active: true,
tags: [],
uuid: newUuid,
caseStatus: "Underway"
};
obj.request = request;
this.apiCaseList.unshift(obj);
}

View File

@ -5,15 +5,21 @@
<el-col :span="1">
{{$t('commons.name')}}
</el-col>
<el-col :span="11">
<el-col :span="10">
<el-input class="ms-http-input" style="width: 80%" size="small" v-model="mockExpectConfig.name"/>
</el-col>
<el-col :span="1">
{{$t('commons.tag')}}
</el-col>
<el-col :span="11">
<el-col :span="10">
<ms-input-tag :currentScenario="mockExpectConfig" style="width: 80%;height: 100%;white-space: nowrap;overflow: hidden" v-if="showHeadTable" ref="tag"/>
</el-col>
<el-col :span="2">
<el-button type="primary" size="small" @click="saveMockExpectConfig" title="ctrl + s">{{
$t('commons.save')
}}
</el-button>
</el-col>
</el-row>
</el-card>
</el-header>
@ -39,6 +45,9 @@ export default {
watch: {
},
methods: {
saveMockExpectConfig(){
this.$emit("saveMockExpectConfig");
}
}
}
</script>

View File

@ -1,9 +1,10 @@
<template>
<ms-drawer :size="60" @close="close" :visible="showDrawer" direction="bottom">
<ms-drawer :size="60" @close="close" :visible="showDrawer" direction="bottom" ref="mockDrawer">
<template v-slot:header>
<mock-config-header
:mock-expect-config="mockExpectConfig"
:show-head-table="showHeadTable"
@saveMockExpectConfig="saveMockExpectConfig"
/>
</template>
<el-container>
@ -34,14 +35,6 @@
<mock-response-param :api-id="apiId" :is-tcp="isTcp"
:response="mockExpectConfig.response.responseResult"/>
</el-row>
<el-row>
<div style="float: right;margin-right: 20px">
<el-button type="primary" size="small" @click="saveMockExpectConfig" title="ctrl + s">{{
$t('commons.save')
}}
</el-button>
</div>
</el-row>
</div>
</div>
</el-form>
@ -215,6 +208,7 @@ export default {
}
}
this.showDrawer = true;
this.$refs.mockDrawer.setfullScreen();
},
close(){
this.showDrawer = false;

View File

@ -87,6 +87,9 @@
}
},
methods: {
setfullScreen(){
this.isFullScreen = true;
},
init() {
window.addEventListener("resize", this.listenScreenChange,false);
// todo