xtraderClient/src/views/ApiKey.vue

151 lines
2.8 KiB
Vue

<template>
<div class="api-key-page">
<div class="api-key-screen">
<header class="api-key-header">
<h1 class="api-key-title">API Key 管理</h1>
<button class="create-btn" type="button">创建 Key</button>
</header>
<section class="api-key-list">
<article v-for="item in apiKeys" :key="item.id" class="api-key-item">
<p class="item-name">{{ item.name }}</p>
<p class="item-value">{{ item.key }}</p>
<div class="item-actions">
<button class="action-btn action-copy" type="button">复制</button>
<button class="action-btn action-delete" type="button">删除</button>
</div>
</article>
</section>
</div>
</div>
</template>
<script setup lang="ts">
interface ApiKeyItem {
id: string
name: string
key: string
}
const apiKeys: ApiKeyItem[] = [
{ id: '1', name: 'Key #1', key: 'pk_live_8f2a9d1c5e7b44a8b1c2d3e4f5a6b7c8' },
{ id: '2', name: 'Key #2', key: 'pk_test_4d8f8a0c2e49f6h0j2k4m8n6p0r2i4v6' },
{ id: '3', name: 'Key #3', key: 'pk_live_1a3c5e7g8i1k3m5o7q9s1u8w5y7z9b1d' },
]
</script>
<style scoped>
.api-key-page {
min-height: 100vh;
background: #fcfcfc;
display: flex;
justify-content: center;
padding: 0;
}
.api-key-screen {
width: 100%;
max-width: 100%;
min-height: 980px;
padding: 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 16px;
font-family: Inter, sans-serif;
}
.api-key-header {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.api-key-title {
margin: 0;
color: #111827;
font-size: 24px;
font-weight: 700;
line-height: 1.2;
}
.create-btn {
height: 34px;
padding: 0 12px;
border: 0;
border-radius: 12px;
background: #5b5bd6;
color: #ffffff;
font-size: 12px;
font-weight: 600;
line-height: 1;
cursor: pointer;
}
.api-key-list {
width: 100%;
display: flex;
flex-direction: column;
gap: 12px;
}
.api-key-item {
width: 100%;
border-radius: 16px;
border: 1px solid #e5e7eb;
background: #ffffff;
padding: 14px;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 10px;
}
.item-name {
margin: 0;
color: #6b7280;
font-size: 12px;
font-weight: 600;
line-height: 1.2;
}
.item-value {
margin: 0;
color: #111827;
font-size: 13px;
font-weight: 500;
line-height: 1.2;
overflow-wrap: anywhere;
}
.item-actions {
width: 100%;
display: flex;
justify-content: flex-end;
gap: 8px;
}
.action-btn {
height: 30px;
border-radius: 8px;
padding: 0 10px;
font-size: 11px;
font-weight: 600;
line-height: 1;
cursor: pointer;
}
.action-copy {
border: 1px solid #e5e7eb;
background: #fcfcfc;
color: #111827;
}
.action-delete {
border: 0;
background: #fee2e2;
color: #dc2626;
}
</style>