fix cards ui and data extract

This commit is contained in:
Julian Freeman
2026-03-14 17:02:58 -04:00
parent 375b6fdb11
commit d5800acab4
6 changed files with 235 additions and 173 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="software-card">
<div class="card-header">
<div class="card-left">
<div class="icon-container">
<img v-if="software.icon_url" :src="software.icon_url" :alt="software.name" class="software-icon" />
<div v-else class="icon-placeholder" :style="{ backgroundColor: placeholderColor }">
@@ -8,46 +8,49 @@
</div>
</div>
<div class="info">
<h3 class="name">{{ software.name }}</h3>
<p class="id">{{ software.id }}</p>
</div>
</div>
<div class="card-body">
<p class="description" v-if="software.description">{{ software.description }}</p>
<div class="version-info">
<span class="version">当前: {{ software.version || '--' }}</span>
<span class="available" v-if="software.available_version">可用: {{ software.available_version }}</span>
</div>
</div>
<div class="card-actions">
<button
v-if="software.status === 'idle'"
@click="$emit('install', software.id)"
class="install-btn"
>
{{ actionLabel }}
</button>
<div v-else-if="software.status === 'installing' || software.status === 'pending'" class="progress-container">
<div class="progress-ring">
<svg viewBox="0 0 32 32">
<circle class="bg" cx="16" cy="16" r="14" fill="none" stroke-width="4" />
<circle class="fg" cx="16" cy="16" r="14" fill="none" stroke-width="4"
:style="{ strokeDasharray: 88, strokeDashoffset: 88 - (88 * (software.progress || 0.5)) }"
/>
</svg>
<div class="title-row">
<h3 class="name">{{ software.name }}</h3>
<span class="id-badge">{{ software.id }}</span>
</div>
<p class="description" v-if="software.description">{{ software.description }}</p>
<div class="version-info">
<span class="version-tag">当前: {{ software.version || '--' }}</span>
<span class="version-tag available" v-if="software.available_version">
最新: {{ software.available_version }}
</span>
</div>
<span class="status-text">安装中...</span>
</div>
</div>
<div v-else-if="software.status === 'success'" class="status-success">
<span class="check-icon"></span> 已完成
</div>
<div class="card-right" v-if="actionLabel || software.status !== 'idle'">
<div class="action-wrapper">
<button
v-if="software.status === 'idle'"
@click="$emit('install', software.id)"
class="install-btn"
>
{{ actionLabel }}
</button>
<div v-else-if="software.status === 'installing' || software.status === 'pending'" class="progress-status">
<div class="progress-ring">
<svg viewBox="0 0 32 32">
<circle class="bg" cx="16" cy="16" r="14" fill="none" stroke-width="4" />
<circle class="fg" cx="16" cy="16" r="14" fill="none" stroke-width="4"
:style="{ strokeDasharray: 88, strokeDashoffset: 88 - (88 * (software.progress || 0.5)) }"
/>
</svg>
</div>
<span class="status-text">{{ software.status === 'pending' ? '等待中...' : '安装中...' }}</span>
</div>
<div v-else-if="software.status === 'error'" class="status-error">
失败
<div v-else-if="software.status === 'success'" class="status-success">
<span class="check-icon"></span> 已完成
</div>
<div v-else-if="software.status === 'error'" class="status-error">
失败
</div>
</div>
</div>
</div>
@@ -83,33 +86,36 @@ const placeholderColor = computed(() => {
<style scoped>
.software-card {
background: white;
border-radius: var(--radius-card);
padding: 24px;
border-radius: 20px;
padding: 16px 24px;
box-shadow: var(--card-shadow);
transition: transform 0.2s ease, box-shadow 0.2s ease;
transition: all 0.2s ease;
display: flex;
flex-direction: column;
gap: 16px;
align-items: center;
justify-content: space-between;
border: 1px solid rgba(0, 0, 0, 0.02);
margin-bottom: 12px;
}
.software-card:hover {
transform: translateY(-4px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
transform: scale(1.01);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}
.card-header {
.card-left {
display: flex;
align-items: center;
gap: 16px;
gap: 20px;
flex: 1;
}
.icon-container {
width: 56px;
height: 56px;
border-radius: 14px;
width: 48px;
height: 48px;
border-radius: 12px;
overflow: hidden;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.software-icon {
@@ -125,51 +131,81 @@ const placeholderColor = computed(() => {
align-items: center;
justify-content: center;
color: white;
font-size: 24px;
font-size: 20px;
font-weight: 700;
}
.info .name {
font-size: 17px;
.info {
display: flex;
flex-direction: column;
gap: 4px;
}
.title-row {
display: flex;
align-items: center;
gap: 12px;
}
.name {
font-size: 16px;
font-weight: 600;
color: var(--text-main);
}
.info .id {
font-size: 13px;
.id-badge {
font-size: 11px;
color: var(--text-sec);
}
.card-body {
flex-grow: 1;
background: var(--bg-light);
padding: 2px 8px;
border-radius: 6px;
font-family: monospace;
}
.description {
font-size: 14px;
font-size: 13px;
color: var(--text-sec);
line-height: 1.5;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
margin-bottom: 8px;
max-width: 500px;
}
.version-info {
display: flex;
gap: 12px;
font-size: 12px;
gap: 8px;
}
.version-tag {
font-size: 11px;
color: var(--text-sec);
font-weight: 500;
}
.version-tag.available {
color: var(--primary-color);
background: rgba(0, 122, 255, 0.08);
padding: 0 6px;
border-radius: 4px;
}
.card-right {
margin-left: 20px;
min-width: 120px;
display: flex;
justify-content: flex-end;
}
.install-btn {
width: 100%;
padding: 10px;
padding: 8px 24px;
background-color: var(--bg-light);
border: none;
border-radius: var(--radius-btn);
border-radius: 20px;
color: var(--primary-color);
font-weight: 600;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
}
@@ -179,16 +215,15 @@ const placeholderColor = computed(() => {
color: white;
}
.progress-container {
.progress-status {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
gap: 10px;
}
.progress-ring {
width: 24px;
height: 24px;
width: 20px;
height: 20px;
}
.progress-ring svg {
@@ -201,24 +236,25 @@ const placeholderColor = computed(() => {
.progress-ring .fg {
stroke: var(--primary-color);
stroke-linecap: round;
transition: stroke-dashoffset 0.3s ease;
}
.status-text {
font-size: 14px;
font-size: 13px;
font-weight: 500;
color: var(--primary-color);
}
.status-success {
text-align: center;
color: #34C759;
font-weight: 600;
font-size: 14px;
}
.status-error {
text-align: center;
color: #FF3B30;
font-weight: 600;
font-size: 14px;
}
</style>