<template>
<a-card title="环境管理">
<a-row :gutter="[48,32]" type="flex" justify="center" style="margin-bottom: 38px">
<a-col :span="8" v-for="(env, index) in environments" :key="index">
<a-card :title="'环境' + (index + 1)" class="env-card hover-env-card">
<template #extra>
<a-button v-if="env.status === 'active'" class="uninstall">卸载</a-button>
<a-button type="primary" v-else>安装</a-button>
</template>
<svg t="1750909569074" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="6580" width="128" height="128">
<path :fill="env.status === 'active' ? '#005bac' : '#bfbfbf'"
d="M180.532703 507.367493c158.678976-65.355497 235.486292-30.474059 304.269865 16.21838l-79.440283 273.0447c-69.018933-46.431495-144.083559-84.635609-303.396985-18.776645l77.643358-270.088368L180.532703 507.367493zM526.399965 549.988196c68.989257 46.397726 139.539057 80.43903 301.656341 24.985044l-75.661214 263.243473c-159.14151 65.832358-235.541551 28.585035-304.439734-18.128893L526.399965 549.988196zM498.022661 474.363821c-41.512463-27.970028-86.198198-54.113455-149.667741-54.582129-41.86448-0.322341-91.709725 11.587919-155.011446 37.731346l78.410837-271.752264c159.198815-65.822125 235.701187-28.520567 304.673048 18.128893L498.022661 474.363821zM922.033677 249.996774c-158.988014 65.700351-235.394195 28.753881-304.214606-17.613146l-78.428234 271.986601c68.7672 46.62797 151.876036 84.896552 304.315914 16.685008L922.033677 249.996774z"
p-id="6581"></path>
</svg>
<a-descriptions :column="1" bordered="true" size="small">
<a-descriptions-item label="状态">
<span v-if="env.status === 'active'">🟢已激活</span>
<span v-else-if="env.status === 'inactive'">⚪未激活</span>
<span v-else>🔴主机异常</span>
</a-descriptions-item>
<a-descriptions-item label="Python版本">
{{ env.pythonVersion }}
</a-descriptions-item>
<a-descriptions-item label="物理内存总量">
{{ env.totalMemory }}
</a-descriptions-item>
<a-descriptions-item label="可用的物理内存">
{{ env.availableMemory }}
</a-descriptions-item>
<a-descriptions-item label="执行主机">
<span v-for="(host, hostIndex) in env.hosts" :key="hostIndex">
{{ host }}<br v-if="hostIndex !== env.hosts.length - 1"/>
</span>
</a-descriptions-item>
</a-descriptions>
</a-card>
</a-col>
</a-row>
</a-card>
</template>
<script>
export default {
name: "env.vue",
data() {
return {
environments: [
{
status: 'active',
pythonVersion: '3.8',
totalMemory: '16,307MB',
availableMemory: '3,578MB',
hosts: [
'10.228.73.15',
'10.228.73.15',
'10.228.73.15',
'10.228.73.15',
'10.228.73.15'
]
},
{
status: 'inactive',
pythonVersion: '',
totalMemory: '32,156MB',
availableMemory: '8,421MB',
hosts: [
'10.228.73.16',
'10.228.73.17',
'10.228.73.17',
'10.228.73.17',
'10.228.73.17'
]
},
{
status: 'active',
pythonVersion: '3.7',
totalMemory: '8,192MB',
availableMemory: '2,048MB',
hosts: [
'10.228.73.18',
'10.228.73.18',
'10.228.73.18',
'10.228.73.18',
'10.228.73.18',
]
},
{
status: 'error',
pythonVersion: '',
totalMemory: '64,512MB',
availableMemory: '16,384MB',
hosts: [
'10.228.73.19',
'10.228.73.20',
'10.228.73.21',
'10.228.73.21',
'10.228.73.21'
]
},
{
status: 'active',
pythonVersion: '3.8',
totalMemory: '16,307MB',
availableMemory: '5,120MB',
hosts: [
'10.228.73.22',
'10.228.73.23',
'10.228.73.23',
'10.228.73.23',
'10.228.73.23'
]
}
]
}
}
}
</script>
<style scoped lang="less">
.env-card {
height: 100%;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
.ant-card-head-title:before {
height: 20px !important;
margin-top: 5px;
}
.ant-btn-icon-only {
font-size: 19px;
}
}
.env-card svg {
display: block;
margin: 0 auto;
}
.hover-env-card:hover {
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); /* 更强的阴影 */
transform: translateY(-3px); /* 上移 */
transition: all 0.2s ease; /* 平滑过渡 */
}
::v-deep .ant-descriptions-item-label {
font-size: 16px !important;
text-align: center;
}
::v-deep .ant-descriptions-item-content {
font-size: 16px !important;
text-align: center;
}
.uninstall:hover{
background-color: rgba(191, 191, 191, 0.5) !important;
}
</style>
为什么我页面百分比为100%可以滚动条滑到最下面,但是放大的时候,就划不到最下面