feat(接口定义):添加协议处理

This commit is contained in:
fit2-zhao 2020-11-23 19:25:28 +08:00
parent 064735b2a4
commit 4bae9662de
4 changed files with 12 additions and 6 deletions

View File

@ -44,12 +44,12 @@
<!-- 快捷调试 --> <!-- 快捷调试 -->
<div v-else-if="item.type=== 'debug'"> <div v-else-if="item.type=== 'debug'">
<ms-debug-http-page @saveAs="editApi"/> <ms-debug-http-page :currentProtocol="currentProtocol" @saveAs="editApi"/>
</div> </div>
<!-- 测试--> <!-- 测试-->
<div v-else-if="item.type=== 'test'"> <div v-else-if="item.type=== 'test'">
<ms-run-test-http-page :api-data="runTestData" @saveAsApi="editApi" :currentProject="currentProject"/> <ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" :currentProject="currentProject"/>
</div> </div>
</el-tab-pane> </el-tab-pane>

View File

@ -54,6 +54,9 @@
export default { export default {
name: "ApiConfig", name: "ApiConfig",
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun}, components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun},
props: {
currentProtocol: String,
},
data() { data() {
return { return {
rules: { rules: {
@ -132,6 +135,7 @@
this.debugForm.request = JSON.stringify(this.request); this.debugForm.request = JSON.stringify(this.request);
this.debugForm.userId = getCurrentUser().id; this.debugForm.userId = getCurrentUser().id;
this.debugForm.status = "Underway"; this.debugForm.status = "Underway";
this.debugForm.protocol = this.currentProtocol;
this.$emit('saveAs', this.debugForm); this.$emit('saveAs', this.debugForm);
} }
else { else {

View File

@ -129,7 +129,7 @@
reportId: "", reportId: "",
} }
}, },
props: {apiData: {}, currentProject: {}}, props: {apiData: {}, currentProject: {}, currentProtocol: String,},
methods: { methods: {
handleCommand(e) { handleCommand(e) {
switch (e) { switch (e) {
@ -151,6 +151,7 @@
this.loading = true; this.loading = true;
this.api.request.name = this.api.id; this.api.request.name = this.api.id;
this.api.request.useEnvironment = this.api.environmentId; this.api.request.useEnvironment = this.api.environmentId;
this.api.protocol = this.currentProtocol;
this.runData = []; this.runData = [];
this.runData.push(this.api.request); this.runData.push(this.api.request);
/*触发执行操作*/ /*触发执行操作*/
@ -278,6 +279,7 @@
}, },
created() { created() {
this.api = this.apiData; this.api = this.apiData;
this.api.protocol = this.currentProtocol;
this.currentRequest = this.api.request; this.currentRequest = this.api.request;
this.getEnvironments(); this.getEnvironments();
this.getResult(); this.getResult();

View File

@ -94,9 +94,9 @@ export default {
beforeCreate() { beforeCreate() {
this.result = this.$get("/isLogin").then(response => { this.result = this.$get("/isLogin").then(response => {
if (display.default !== undefined) { // if (display.default !== undefined) {
display.default.valid(this); // display.default.valid(this);
} // }
if (!response.data.success) { if (!response.data.success) {
if (response.data.message === 'sso') { if (response.data.message === 'sso') {