style(接口测试): 定义预览-基本信息和按钮样式修改

This commit is contained in:
teukkk 2024-08-06 15:28:36 +08:00 committed by 刘瑞斌
parent 5c9162f898
commit 059effe8d9
6 changed files with 57 additions and 42 deletions

View File

@ -3,13 +3,14 @@
<a-select <a-select
v-model:model-value="currentEnv" v-model:model-value="currentEnv"
:options="envOptions" :options="envOptions"
class="!w-[200px] pl-0 pr-[8px]" :class="[`${props.size === 'mini' ? '!w-[113px]' : '!w-[200px]'} pl-0 pr-[8px]`]"
:loading="envLoading" :loading="envLoading"
allow-search allow-search
:size="props.size"
@popup-visible-change="popupVisibleChange" @popup-visible-change="popupVisibleChange"
> >
<template #prefix> <template #prefix>
<div class="flex cursor-pointer p-[8px]" @click.stop="goEnv"> <div :class="[`flex cursor-pointer ${props.size === 'mini' ? 'p-[4px]' : 'p-[8px]'}`]" @click.stop="goEnv">
<svg-icon width="14px" height="14px" :name="'icon_env'" class="text-[var(--color-text-4)]" /> <svg-icon width="14px" height="14px" :name="'icon_env'" class="text-[var(--color-text-4)]" />
</div> </div>
</template> </template>
@ -27,6 +28,7 @@
const props = defineProps<{ const props = defineProps<{
env?: string; env?: string;
size?: 'mini' | 'small' | 'medium' | 'large';
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();

View File

@ -138,6 +138,7 @@
<style lang="less"> <style lang="less">
.arco-tag { .arco-tag {
display: flex;
.arco-icon { .arco-icon {
font-size: 14px !important; font-size: 14px !important;
} }

View File

@ -1,6 +1,7 @@
<template> <template>
<a-dropdown-button <a-dropdown-button
v-if="hasLocalExec && !props.executeLoading" v-if="hasLocalExec && !props.executeLoading"
:size="props.size"
type="primary" type="primary"
@click="() => execute(isPriorityLocalExec ? 'localExec' : 'serverExec')" @click="() => execute(isPriorityLocalExec ? 'localExec' : 'serverExec')"
@select="execute" @select="execute"
@ -15,7 +16,12 @@
</a-doption> </a-doption>
</template> </template>
</a-dropdown-button> </a-dropdown-button>
<a-button v-else-if="!hasLocalExec && !props.executeLoading" type="primary" @click="() => execute('serverExec')"> <a-button
v-else-if="!hasLocalExec && !props.executeLoading"
:size="props.size"
type="primary"
@click="() => execute('serverExec')"
>
{{ t('apiTestDebug.serverExec') }} {{ t('apiTestDebug.serverExec') }}
</a-button> </a-button>
<a-button v-else type="primary" @click="emit('stopDebug')"> <a-button v-else type="primary" @click="emit('stopDebug')">
@ -30,6 +36,7 @@
const props = defineProps<{ const props = defineProps<{
executeLoading?: boolean; executeLoading?: boolean;
size?: 'mini' | 'small' | 'medium' | 'large';
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{

View File

@ -24,28 +24,28 @@
> >
<template v-if="activeApiTab.definitionActiveKey === 'preview'" #extra> <template v-if="activeApiTab.definitionActiveKey === 'preview'" #extra>
<div class="flex gap-[12px] pr-[16px]"> <div class="flex gap-[12px] pr-[16px]">
<executeButton v-permission="['PROJECT_API_DEFINITION:READ+EXECUTE']" @execute="toExecuteDefinition" /> <a-button
<a-dropdown-button v-permission="['PROJECT_API_DEFINITION:READ+DELETE']"
type="outline"
class="arco-btn-outline--secondary"
size="small"
@click="handleDelete"
>
{{ t('common.delete') }}
</a-button>
<a-button
v-permission="['PROJECT_API_DEFINITION:READ+UPDATE']" v-permission="['PROJECT_API_DEFINITION:READ+UPDATE']"
type="outline" type="outline"
size="small"
@click="toEditDefinition" @click="toEditDefinition"
> >
{{ t('common.edit') }} {{ t('common.edit') }}
<template #icon> </a-button>
<icon-down /> <executeButton
</template> v-permission="['PROJECT_API_DEFINITION:READ+EXECUTE']"
<template #content> size="small"
<a-doption @execute="toExecuteDefinition"
v-permission="['PROJECT_API_DEFINITION:READ+DELETE']" />
value="delete"
class="error-6 text-[rgb(var(--danger-6))]"
@click="handleDelete"
>
<MsIcon type="icon-icon_delete-trash_outlined1" class="text-[rgb(var(--danger-6))]" />
{{ t('common.delete') }}
</a-doption>
</template>
</a-dropdown-button>
</div> </div>
</template> </template>
<a-tab-pane <a-tab-pane
@ -578,12 +578,6 @@
} }
:deep(.ms-api-tab-nav) { :deep(.ms-api-tab-nav) {
@apply h-full; @apply h-full;
.arco-tabs {
@apply border-b-0;
}
.arco-tabs-nav {
border-bottom: 1px solid var(--color-text-n8);
}
.arco-tabs-content { .arco-tabs-content {
@apply pt-0; @apply pt-0;

View File

@ -1,11 +1,11 @@
<template> <template>
<div class="preview"> <div class="preview">
<div class="px-[18px] pt-[16px]"> <div class="px-[18px] pt-[16px]">
<MsDetailCard <MsDetailCard :title="`[${previewDetail.num}] ${previewDetail.name}`" :description="description">
:title="`【${previewDetail.num}】${previewDetail.name}`" <template #titlePrefix>
:description="description" <apiStatus :status="previewDetail.status" size="small" />
:simple-show-count="4" <apiMethodName :method="previewDetail.method as RequestMethods" tag-size="small" is-tag />
> </template>
<template #titleAppend> <template #titleAppend>
<a-tooltip :content="t(previewDetail.follow ? 'common.forked' : 'common.notForked')"> <a-tooltip :content="t(previewDetail.follow ? 'common.forked' : 'common.notForked')">
<MsIcon <MsIcon
@ -26,10 +26,6 @@
@click="share" @click="share"
/> />
</a-tooltip> </a-tooltip>
<apiStatus :status="previewDetail.status" size="small" />
</template>
<template #type="{ value }">
<apiMethodName :method="value as RequestMethods" tag-size="small" is-tag />
</template> </template>
</MsDetailCard> </MsDetailCard>
</div> </div>
@ -111,11 +107,6 @@
); );
const description = computed(() => [ const description = computed(() => [
{
key: 'type',
locale: 'apiTestManagement.apiType',
value: previewDetail.value.method,
},
{ {
key: 'path', key: 'path',
locale: 'apiTestManagement.path', locale: 'apiTestManagement.path',
@ -130,7 +121,6 @@
key: 'description', key: 'description',
locale: 'common.desc', locale: 'common.desc',
value: previewDetail.value.description, value: previewDetail.value.description,
width: '100%',
}, },
{ {
key: 'belongModule', key: 'belongModule',
@ -190,8 +180,22 @@
.preview { .preview {
@apply h-full w-full overflow-y-auto overflow-x-hidden; @apply h-full w-full overflow-y-auto overflow-x-hidden;
.ms-scroll-bar(); .ms-scroll-bar();
:deep(.arco-tabs-nav) {
border-bottom: 1px solid var(--color-text-n8);
}
:deep(.arco-tabs-pane) { :deep(.arco-tabs-pane) {
@apply h-auto; @apply h-auto;
} }
} }
:deep(.ms-detail-card) {
gap: 12px;
.ms-detail-card-desc {
column-gap: 24px;
row-gap: 8px;
& > div:nth-of-type(n) {
width: auto;
max-width: 300px;
}
}
}
</style> </style>

View File

@ -1,6 +1,12 @@
<template> <template>
<div class="flex gap-[8px] px-[16px] pt-[16px]"> <div class="flex gap-[8px] px-[16px] pt-[16px]">
<a-select v-model:model-value="currentTab" class="w-[80px]" :options="tabOptions" @change="currentTabChange" /> <a-select
v-model:model-value="currentTab"
class="w-[80px] focus-within:!bg-[var(--color-text-n8)] hover:!bg-[var(--color-text-n8)]"
:bordered="false"
:options="tabOptions"
@change="currentTabChange"
/>
<MsEditableTab <MsEditableTab
v-model:active-tab="activeApiTab" v-model:active-tab="activeApiTab"
v-model:tabs="apiTabs" v-model:tabs="apiTabs"
@ -33,6 +39,7 @@
v-show="activeApiTab.id !== 'all'" v-show="activeApiTab.id !== 'all'"
ref="environmentSelectRef" ref="environmentSelectRef"
:env="activeApiTab.environmentId" :env="activeApiTab.environmentId"
size="mini"
/> />
</div> </div>
<api <api