style: update border-radius and padding values across components
- standardize border-radius from 8px to 6px for consistent styling - adjust padding values from 1rem to 0.75rem for better visual hierarchy - remove redundant overflow-y properties for cleaner code
This commit is contained in:
@@ -3,86 +3,59 @@
|
||||
<div class="demo-header">
|
||||
<span class="icon">🔐</span>
|
||||
<span class="title">IAM vs RAM 对比</span>
|
||||
<span class="subtitle">理解不同云厂商的权限管理服务</span>
|
||||
<span class="subtitle">不同云厂商权限管理服务</span>
|
||||
</div>
|
||||
|
||||
<div class="demo-content">
|
||||
<div class="comparison-container">
|
||||
<!-- AWS IAM Column -->
|
||||
<div class="platform-column aws-column">
|
||||
<div class="platform-header aws">
|
||||
<div class="logo">AWS</div>
|
||||
<h5>IAM</h5>
|
||||
<span class="subtitle">Identity and Access Management</span>
|
||||
</div>
|
||||
<div class="main-area">
|
||||
<div class="platform-col aws">
|
||||
<div class="platform-header">AWS IAM</div>
|
||||
<div
|
||||
v-for="(feature, index) in features"
|
||||
:key="index"
|
||||
class="feature-item"
|
||||
:class="{ active: selectedFeature === index }"
|
||||
@click="selectedFeature = index"
|
||||
>
|
||||
<span class="icon">{{ feature.icon }}</span>
|
||||
<span class="name">{{ feature.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="features-list">
|
||||
<div
|
||||
v-for="(feature, index) in awsFeatures"
|
||||
:key="index"
|
||||
class="feature-item"
|
||||
:class="{ active: selectedFeature === `aws-${index}` }"
|
||||
@click="selectFeature('aws', index)"
|
||||
>
|
||||
<div class="feature-icon">{{ feature.icon }}</div>
|
||||
<div class="feature-content">
|
||||
<span class="feature-name">{{ feature.name }}</span>
|
||||
<span class="feature-desc">{{ feature.desc }}</span>
|
||||
</div>
|
||||
<div class="comparison-col">
|
||||
<div class="comparison-card" v-if="selectedFeatureData">
|
||||
<div class="comp-title">{{ selectedFeatureData.name }}</div>
|
||||
<div class="comp-row">
|
||||
<div class="comp-item aws">
|
||||
<div class="comp-label">AWS IAM</div>
|
||||
<div class="comp-desc">{{ selectedFeatureData.awsDetail }}</div>
|
||||
</div>
|
||||
<div class="comp-vs">VS</div>
|
||||
<div class="comp-item ram">
|
||||
<div class="comp-label">阿里云 RAM</div>
|
||||
<div class="comp-desc">{{ selectedFeatureData.ramDetail }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Comparison Details -->
|
||||
<div class="comparison-details" v-if="selectedFeatureData">
|
||||
<div class="detail-card">
|
||||
<h6>{{ selectedFeatureData.name }}</h6>
|
||||
<div class="comparison-row">
|
||||
<div class="aws-detail">
|
||||
<span class="label">AWS IAM</span>
|
||||
<p>{{ selectedFeatureData.awsDetail }}</p>
|
||||
<code v-if="selectedFeatureData.awsExample">{{ selectedFeatureData.awsExample }}</code>
|
||||
</div>
|
||||
<div class="vs-divider">VS</div>
|
||||
<div class="ram-detail">
|
||||
<span class="label">阿里云 RAM</span>
|
||||
<p>{{ selectedFeatureData.ramDetail }}</p>
|
||||
<code v-if="selectedFeatureData.ramExample">{{ selectedFeatureData.ramExample }}</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Alibaba Cloud RAM Column -->
|
||||
<div class="platform-column ram-column">
|
||||
<div class="platform-header ram">
|
||||
<div class="logo">阿里云</div>
|
||||
<h5>RAM</h5>
|
||||
<span class="subtitle">Resource Access Management</span>
|
||||
</div>
|
||||
|
||||
<div class="features-list">
|
||||
<div
|
||||
v-for="(feature, index) in ramFeatures"
|
||||
:key="index"
|
||||
class="feature-item"
|
||||
:class="{ active: selectedFeature === `ram-${index}` }"
|
||||
@click="selectFeature('ram', index)"
|
||||
>
|
||||
<div class="feature-icon">{{ feature.icon }}</div>
|
||||
<div class="feature-content">
|
||||
<span class="feature-name">{{ feature.name }}</span>
|
||||
<span class="feature-desc">{{ feature.desc }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="platform-col ram">
|
||||
<div class="platform-header">阿里云 RAM</div>
|
||||
<div
|
||||
v-for="(feature, index) in features"
|
||||
:key="index"
|
||||
class="feature-item"
|
||||
:class="{ active: selectedFeature === index }"
|
||||
@click="selectedFeature = index"
|
||||
>
|
||||
<span class="icon">{{ feature.icon }}</span>
|
||||
<span class="name">{{ feature.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<span class="icon">💡</span>
|
||||
<strong>核心思想:</strong>IAM 和 RAM 的核心概念基本一致,只是术语和实现细节略有不同。掌握一个平台后,可以快速迁移到另一个平台。
|
||||
<strong>核心思想:</strong>IAM 和 RAM 核心概念基本一致,只是术语和实现细节略有不同。
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -90,85 +63,36 @@
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
const selectedFeature = ref(null)
|
||||
const selectedFeature = ref(0)
|
||||
|
||||
const featureDetails = [
|
||||
{
|
||||
name: '用户管理',
|
||||
awsDetail: '使用 IAM User,支持编程访问和控制台访问,可分配独立 AK/SK',
|
||||
ramDetail: '使用 RAM 用户,功能与 IAM User 类似,支持子账号登录控制台',
|
||||
awsExample: 'arn:aws:iam::123456789012:user/alice',
|
||||
ramExample: 'acs:ram::123456789012:user/alice'
|
||||
},
|
||||
{
|
||||
name: '用户组管理',
|
||||
awsDetail: 'IAM Group 用于批量管理用户权限,一个用户可属于多个组',
|
||||
ramDetail: 'RAM 用户组功能类似,支持按部门或项目分组管理',
|
||||
awsExample: 'arn:aws:iam::123456789012:group/Developers',
|
||||
ramExample: 'acs:ram::123456789012:group/Developers'
|
||||
},
|
||||
{
|
||||
name: '角色与扮演',
|
||||
awsDetail: 'IAM Role 支持跨账号访问和服务角色,使用 STS AssumeRole',
|
||||
ramDetail: 'RAM 角色支持跨云账号访问和临时授权,使用 STS AssumeRole',
|
||||
awsExample: 'arn:aws:iam::123456789012:role/CrossAccountRole',
|
||||
ramExample: 'acs:ram::123456789012:role/CrossAccountRole'
|
||||
},
|
||||
{
|
||||
name: '权限策略',
|
||||
awsDetail: 'IAM Policy 使用 JSON 格式,支持 Action/Resource/Condition',
|
||||
ramDetail: 'RAM Policy 语法类似,支持阿里云服务特定的 Action',
|
||||
awsExample: '"Action": "s3:GetObject"',
|
||||
ramExample: '"Action": "oss:GetObject"'
|
||||
},
|
||||
{
|
||||
name: '身份联合',
|
||||
awsDetail: '支持 SAML 2.0 和 OIDC,可与 AD、Okta 等 IdP 集成',
|
||||
ramDetail: '支持 SAML 2.0 和企业 AD/LDAP,支持钉钉等国内 IdP',
|
||||
awsExample: 'SAML Provider: arn:aws:iam::123:saml-provider/Okta',
|
||||
ramExample: 'SAML Provider: acs:ram::123:saml-provider/DingTalk'
|
||||
},
|
||||
{
|
||||
name: '访问密钥',
|
||||
awsDetail: 'IAM User 可创建 AK/SK,支持定期轮换和访问分析',
|
||||
ramDetail: 'RAM 用户支持 AccessKey,提供密钥使用分析和安全建议',
|
||||
awsExample: 'AKIAIOSFODNN7EXAMPLE',
|
||||
ramExample: 'LTAI...'
|
||||
}
|
||||
const features = [
|
||||
{ icon: '👤', name: '用户管理' },
|
||||
{ icon: '👥', name: '用户组' },
|
||||
{ icon: '🎭', name: '角色扮演' },
|
||||
{ icon: '📋', name: '权限策略' },
|
||||
{ icon: '🔗', name: '身份联合' },
|
||||
{ icon: '🔑', name: '访问密钥' }
|
||||
]
|
||||
|
||||
const awsFeatures = featureDetails.map((f, i) => ({
|
||||
icon: ['👤', '👥', '🎭', '📋', '🔗', '🔑'][i],
|
||||
name: f.name,
|
||||
desc: f.awsDetail.slice(0, 30) + '...'
|
||||
}))
|
||||
const featureDetails = [
|
||||
{ name: '用户管理', awsDetail: 'IAM User,支持编程访问和控制台访问', ramDetail: 'RAM 用户,功能类似,支持子账号登录' },
|
||||
{ name: '用户组管理', awsDetail: 'IAM Group 批量管理用户权限', ramDetail: 'RAM 用户组,按部门分组管理' },
|
||||
{ name: '角色与扮演', awsDetail: 'IAM Role + STS AssumeRole', ramDetail: 'RAM 角色 + STS AssumeRole' },
|
||||
{ name: '权限策略', awsDetail: 'JSON 格式 Policy', ramDetail: '语法类似的权限策略' },
|
||||
{ name: '身份联合', awsDetail: 'SAML 2.0 / OIDC,支持 AD/Okta', ramDetail: 'SAML 2.0,支持钉钉等' },
|
||||
{ name: '访问密钥', awsDetail: 'AK/SK,支持轮换和分析', ramDetail: 'AccessKey,提供安全建议' }
|
||||
]
|
||||
|
||||
const ramFeatures = featureDetails.map((f, i) => ({
|
||||
icon: ['👤', '👥', '🎭', '📋', '🔗', '🔑'][i],
|
||||
name: f.name,
|
||||
desc: f.ramDetail.slice(0, 30) + '...'
|
||||
}))
|
||||
|
||||
const selectedFeatureData = computed(() => {
|
||||
if (!selectedFeature.value) return null
|
||||
const [platform, index] = selectedFeature.value.split('-')
|
||||
return featureDetails[parseInt(index)]
|
||||
})
|
||||
|
||||
function selectFeature(platform, index) {
|
||||
selectedFeature.value = `${platform}-${index}`
|
||||
}
|
||||
const selectedFeatureData = computed(() => featureDetails[selectedFeature.value])
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.iam-ram-comparison-demo {
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
background: var(--vp-c-bg-soft);
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
margin: 1rem 0;
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
border-radius: 6px;
|
||||
padding: 0.75rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.demo-header {
|
||||
@@ -182,191 +106,110 @@ function selectFeature(platform, index) {
|
||||
.demo-header .title { font-weight: bold; font-size: 1rem; }
|
||||
.demo-header .subtitle { color: var(--vp-c-text-2); font-size: 0.85rem; margin-left: 0.5rem; }
|
||||
|
||||
.demo-content { margin-bottom: 0.75rem; }
|
||||
|
||||
.comparison-container {
|
||||
.main-area {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1.5fr 1fr;
|
||||
gap: 1rem;
|
||||
align-items: start;
|
||||
gap: 0.75rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.platform-column {
|
||||
@media (max-width: 768px) {
|
||||
.main-area { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
.platform-col {
|
||||
background: var(--vp-c-bg);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 8px;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.platform-header {
|
||||
padding: 1rem;
|
||||
padding: 0.5rem;
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
font-size: 0.85rem;
|
||||
border-bottom: 1px solid var(--vp-c-divider);
|
||||
}
|
||||
|
||||
.platform-header.aws {
|
||||
background: var(--vp-c-brand-soft);
|
||||
}
|
||||
|
||||
.platform-header.ram {
|
||||
background: var(--vp-c-bg-soft);
|
||||
}
|
||||
|
||||
.platform-header .logo {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.platform-header h5 {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.platform-header .subtitle {
|
||||
font-size: 0.7rem;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.features-list { padding: 0.75rem; }
|
||||
.platform-col.aws .platform-header { background: var(--vp-c-brand-soft); color: var(--vp-c-brand-1); }
|
||||
.platform-col.ram .platform-header { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
|
||||
|
||||
.feature-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.625rem;
|
||||
margin-bottom: 0.5rem;
|
||||
background: var(--vp-c-bg-alt);
|
||||
gap: 0.4rem;
|
||||
padding: 0.4rem 0.5rem;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
border-bottom: 1px solid var(--vp-c-divider);
|
||||
}
|
||||
|
||||
.feature-item:last-child { border-bottom: none; }
|
||||
.feature-item:hover { background: var(--vp-c-bg-alt); }
|
||||
.feature-item.active { background: var(--vp-c-brand-soft); }
|
||||
|
||||
.feature-item .icon { font-size: 1rem; }
|
||||
.feature-item .name { font-size: 0.8rem; color: var(--vp-c-text-1); }
|
||||
|
||||
.comparison-col { min-width: 0; }
|
||||
|
||||
.comparison-card {
|
||||
background: var(--vp-c-bg);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
padding: 0.75rem;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.feature-item:hover,
|
||||
.feature-item.active {
|
||||
background: var(--vp-c-brand-soft);
|
||||
border-color: var(--vp-c-brand);
|
||||
transform: translateX(4px);
|
||||
.comp-title {
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
color: var(--vp-c-brand-1);
|
||||
text-align: center;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.feature-icon { font-size: 1.2rem; }
|
||||
|
||||
.feature-content {
|
||||
.comp-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.feature-name {
|
||||
font-weight: 600;
|
||||
font-size: 0.85rem;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.feature-desc {
|
||||
font-size: 0.7rem;
|
||||
color: var(--vp-c-text-3);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.comparison-details {
|
||||
background: var(--vp-c-bg);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.detail-card { text-align: center; }
|
||||
|
||||
.detail-card h6 {
|
||||
margin: 0 0 1rem 0;
|
||||
font-size: 1rem;
|
||||
color: var(--vp-c-brand-1);
|
||||
}
|
||||
|
||||
.comparison-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.aws-detail,
|
||||
.ram-detail {
|
||||
flex: 1;
|
||||
padding: 0.75rem;
|
||||
border-radius: 6px;
|
||||
text-align: left;
|
||||
.comp-item {
|
||||
padding: 0.5rem;
|
||||
border-radius: 4px;
|
||||
background: var(--vp-c-bg-alt);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
}
|
||||
|
||||
.aws-detail .label,
|
||||
.ram-detail .label {
|
||||
display: block;
|
||||
.comp-label {
|
||||
font-weight: 600;
|
||||
font-size: 0.75rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.comp-item.aws .comp-label { color: var(--vp-c-brand-1); }
|
||||
.comp-item.ram .comp-label { color: #dc2626; }
|
||||
|
||||
.comp-desc { font-size: 0.75rem; color: var(--vp-c-text-2); line-height: 1.4; }
|
||||
|
||||
.comp-vs {
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
font-size: 0.8rem;
|
||||
margin-bottom: 0.375rem;
|
||||
color: var(--vp-c-text-1);
|
||||
}
|
||||
|
||||
.aws-detail .label { color: var(--vp-c-brand-1); }
|
||||
.ram-detail .label { color: var(--vp-c-brand-delta); }
|
||||
|
||||
.aws-detail p,
|
||||
.ram-detail p {
|
||||
margin: 0 0 0.5rem 0;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.4;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.aws-detail code,
|
||||
.ram-detail code {
|
||||
display: block;
|
||||
padding: 0.375rem;
|
||||
background: var(--vp-c-bg);
|
||||
border: 1px solid var(--vp-c-divider);
|
||||
border-radius: 4px;
|
||||
font-size: 0.6rem;
|
||||
word-break: break-all;
|
||||
color: var(--vp-c-text-2);
|
||||
}
|
||||
|
||||
.vs-divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
font-size: 0.9rem;
|
||||
color: var(--vp-c-text-3);
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
|
||||
.info-box {
|
||||
background: var(--vp-c-bg-alt);
|
||||
padding: 0.75rem;
|
||||
padding: 0.6rem;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--vp-c-text-2);
|
||||
margin-top: 0.75rem;
|
||||
display: flex;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.info-box .icon { flex-shrink: 0; }
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.comparison-container {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.comparison-details { order: -1; }
|
||||
.comparison-row { flex-direction: column; }
|
||||
.vs-divider { padding: 0.5rem 0; }
|
||||
}
|
||||
.info-box strong { color: var(--vp-c-text-1); }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user