feat(性能测试): 【性能测试】支持显示接口返回数据类型为图片

--story=1013762 --user=宋天阳 【性能测试】支持显示接口返回数据类型为图片
https://www.tapd.cn/55049933/s/1444326
This commit is contained in:
song-tianyang 2023-12-15 16:00:37 +08:00 committed by 建国
parent c30dac746f
commit 292be7150c
1 changed files with 25 additions and 2 deletions

View File

@ -7,11 +7,11 @@
class="pane" class="pane"
> >
<ms-sql-result-table <ms-sql-result-table
v-if="isSqlType && activeName === 'body'" v-if="isSqlType && activeName === 'body'&& !responseResult.contentType"
:body="responseResult.body" :body="responseResult.body"
/> />
<ms-code-edit <ms-code-edit
v-if="!isSqlType && isMsCodeEditShow && activeName === 'body'" v-if="!isSqlType && isMsCodeEditShow && activeName === 'body'&& !isPicture"
:mode="mode" :mode="mode"
:read-only="true" :read-only="true"
:modes="modes" :modes="modes"
@ -19,6 +19,11 @@
height="250px" height="250px"
ref="codeEdit" ref="codeEdit"
/> />
<el-row v-if="isPicture && activeName === 'body'">
<el-col :span="24">
<el-image :src="srcUrl" fit="contain" style="width: 100%;height: 100%;"></el-image>
</el-col>
</el-row>
</el-tab-pane> </el-tab-pane>
<el-tab-pane <el-tab-pane
@ -137,12 +142,15 @@ export default {
mode: "text", mode: "text",
isMsCodeEditShow: true, isMsCodeEditShow: true,
reqMessages: "", reqMessages: "",
contentType: ['image/png', 'image/jpeg', 'image/gif', 'image/bmp', 'image/webp', 'image/svg+xml', 'image/apng', 'image/avif'],
srcUrl: '',
}; };
}, },
watch: { watch: {
response() { response() {
this.setBodyType(); this.setBodyType();
this.setReqMessage(); this.setReqMessage();
this.showPicture();
}, },
activeName: { activeName: {
handler() { handler() {
@ -161,6 +169,13 @@ export default {
sqlModeChange(mode) { sqlModeChange(mode) {
this.mode = mode; this.mode = mode;
}, },
showPicture() {
if (this.responseResult.contentType && this.contentType.includes(this.responseResult.contentType)) {
this.modes.push('picture')
this.srcUrl = 'data:' + this.responseResult.contentType + ';base64,' + this.responseResult.imageUrl;
}
},
setBodyType() { setBodyType() {
if ( if (
this.response && this.response &&
@ -185,6 +200,13 @@ export default {
this.isMsCodeEditShow = true; this.isMsCodeEditShow = true;
}); });
}, },
isPicture() {
return (
this.responseResult.contentType &&
this.contentType.includes(this.responseResult.contentType) &&
this.mode === 'picture'
);
},
setReqMessage() { setReqMessage() {
if (this.response) { if (this.response) {
if (!this.response.url) { if (!this.response.url) {
@ -234,6 +256,7 @@ export default {
mounted() { mounted() {
this.setBodyType(); this.setBodyType();
this.setReqMessage(); this.setReqMessage();
this.showPicture();
}, },
computed: { computed: {
isSqlType() { isSqlType() {