- 执行队列:多任务串行排队,可单独取消,超时自动放弃,异常退出后标记已中断 - 流程编排:画布多场景依赖图,内置确保登录/等待/通知/人工确认节点 - 流程定时:场景与流程统一配置定时(每天/工作日/每周/每月/每隔N小时) - 流程版本历史:自动留档 20 版,画布一键回滚且回滚可撤销 - 流程配置云备份:随定时任务备份到中心机,换机自动恢复 - 总览页/场景库布局调整,通知浮窗右下角堆叠显示
124 lines
5.9 KiB
Vue
124 lines
5.9 KiB
Vue
<template>
|
|
<button class="scene-card card" :class="{ running, compact }" @click="$emit('open', plugin.id)">
|
|
<span v-if="compact" class="sc-dot" :style="{ background: dotColor }"></span>
|
|
<span v-else class="sc-ic" :style="{ color: dotColor, background: tileBg }">{{ initial }}</span>
|
|
<span class="sc-body">
|
|
<span class="sc-head">
|
|
<b class="sc-name">{{ plugin.name }}</b>
|
|
<em v-if="!compact && plugin.category" class="sc-cat">{{ plugin.category }}</em>
|
|
</span>
|
|
<span v-if="!compact" class="sc-desc">{{ plugin.description || '暂无描述' }}</span>
|
|
<span class="sc-meta">
|
|
<em class="ver">v{{ plugin.version }}</em>
|
|
<span v-if="plugin.platform" class="plat" :class="platformOnline ? 'on' : 'off'"
|
|
:title="`${platformLabel} ${platformOnline ? '已登录' : '未登录,请先在运行台登录'}`">
|
|
<i class="dot"></i>{{ platformLabel }} · {{ platformOnline ? '已登录' : '未登录' }}
|
|
</span>
|
|
</span>
|
|
</span>
|
|
<span class="sc-go" :class="{ busy: running }">
|
|
<template v-if="running">{{ store.progress }}%</template>
|
|
<svg v-else width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
<path d="M4 12h16" /><path d="m13 5 7 7-7 7" />
|
|
</svg>
|
|
</span>
|
|
</button>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import { store } from '../store'
|
|
import { sceneDotColor } from '../utils/theme'
|
|
|
|
// 场景卡:首页「常用场景」(compact,无描述)与场景库共用。
|
|
// 色点按插件在总清单中的位置取色,搜索/筛选/分组后颜色仍稳定。
|
|
const props = defineProps({
|
|
plugin: { type: Object, required: true },
|
|
compact: { type: Boolean, default: false },
|
|
})
|
|
defineEmits(['open'])
|
|
|
|
const dotColor = computed(() => sceneDotColor(store.plugins.findIndex((p) => p.id === props.plugin.id)))
|
|
const tileBg = computed(() => `color-mix(in srgb, ${dotColor.value} 13%, var(--surface))`)
|
|
const initial = computed(() => (props.plugin.name || '·').trim().slice(0, 1))
|
|
const platform = computed(() => store.platforms.find((p) => p.id === props.plugin.platform) || null)
|
|
const platformLabel = computed(() => platform.value?.label || props.plugin.platform || '')
|
|
const platformOnline = computed(() => !!platform.value?.online)
|
|
const running = computed(() => store.running && store.selectedId === props.plugin.id)
|
|
</script>
|
|
|
|
<style scoped>
|
|
.scene-card {
|
|
position: relative;
|
|
display: flex; align-items: center; gap: var(--space-3);
|
|
padding: var(--space-4); min-height: 104px; text-align: left;
|
|
cursor: pointer; font-family: inherit;
|
|
background: linear-gradient(160deg, var(--subtle) 0%, var(--surface) 58%);
|
|
transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
|
|
}
|
|
.scene-card:hover { border-color: var(--brand-track); box-shadow: var(--sh-float); transform: translateY(-2px); }
|
|
.scene-card:active { transform: translateY(0) scale(.995); }
|
|
.scene-card.running {
|
|
border-color: var(--brand-track);
|
|
background: linear-gradient(160deg, var(--brand-soft) 0%, var(--surface) 70%);
|
|
}
|
|
.scene-card.compact {
|
|
background: var(--surface);
|
|
padding: var(--space-2-5) var(--space-3); gap: var(--space-2); min-height: 0;
|
|
}
|
|
.scene-card.compact:hover { transform: none; box-shadow: var(--sh-card); }
|
|
|
|
.sc-dot { width: 6px; height: 6px; border-radius: 3px; flex-shrink: 0; }
|
|
.sc-ic {
|
|
width: 42px; height: 42px; border-radius: var(--r-sub); flex-shrink: 0;
|
|
display: grid; place-items: center; background: var(--brand-soft);
|
|
font: 600 16px/1 var(--f-cn);
|
|
}
|
|
.sc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
|
|
.sc-head { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
|
|
.sc-name {
|
|
min-width: 0; font: 600 13px/18px var(--f-cn); color: var(--t1);
|
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
}
|
|
/* 场景库(非 compact):标题更大、描述两行,卡片撑起来后一页不会半屏空 */
|
|
.scene-card:not(.compact) .sc-name { font: 600 14.5px/21px var(--f-cn); }
|
|
.sc-cat {
|
|
flex-shrink: 0; font-style: normal; font: 500 9.5px/15px var(--f-cn);
|
|
color: var(--brand-ink); background: var(--brand-soft);
|
|
border: 1px solid var(--brand-track); border-radius: var(--r-pill);
|
|
padding: 0 var(--space-2);
|
|
}
|
|
.sc-desc {
|
|
font-size: 12px; line-height: 17px; color: var(--t4);
|
|
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
|
|
overflow: hidden; white-space: normal;
|
|
}
|
|
.sc-meta { display: flex; align-items: center; gap: var(--space-2); margin-top: 1px; }
|
|
.scene-card:not(.compact) .sc-meta { margin-top: auto; }
|
|
.ver { font-style: normal; font: 400 10.5px/15px var(--f-num); color: var(--t4); flex-shrink: 0; }
|
|
.plat {
|
|
display: inline-flex; align-items: center; gap: 5px;
|
|
font-size: 10.5px; color: var(--t3);
|
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
}
|
|
.plat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t5); flex-shrink: 0; }
|
|
.plat.on { color: var(--good-ink); }
|
|
.plat.on .dot { background: var(--good); }
|
|
.plat.off { color: var(--warn-ink); }
|
|
.plat.off .dot { background: var(--warn); }
|
|
|
|
.sc-go {
|
|
flex-shrink: 0; width: 26px; height: 26px; display: grid; place-items: center;
|
|
font: 600 12px/1 var(--f-num); color: var(--t3);
|
|
background: var(--field); border: 1px solid var(--line-btn);
|
|
border-radius: 50%; transition: all var(--dur);
|
|
}
|
|
.sc-go svg { display: block; }
|
|
.sc-go.busy { font-size: 9.5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
|
|
.scene-card.compact .sc-go { width: 22px; height: 22px; font-size: 11px; }
|
|
.scene-card.compact .sc-go.busy { font-size: 8.5px; }
|
|
.scene-card:hover .sc-go { background: var(--brand); color: var(--on-primary); border-color: transparent; box-shadow: var(--sh-brand-sm); }
|
|
.scene-card.running .sc-go { background: var(--brand); color: var(--on-primary); border-color: transparent; }
|
|
</style>
|