feat(electron-shell): 补录壳子源码(排除运行环境与构建产物)
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div class="scenes-page">
|
||||
<div class="head">
|
||||
<div class="ident">
|
||||
<span class="avatar"><el-icon><Collection /></el-icon></span>
|
||||
<div class="ident-meta">
|
||||
<h2>全部场景</h2>
|
||||
<p>当前账号可用的 {{ store.plugins.length }} 个场景,点击行进入运行台</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="sc-list card">
|
||||
<button
|
||||
v-for="(p, i) in store.plugins" :key="p.id" class="sc-row"
|
||||
:class="{ running: store.running && store.selectedId === p.id }"
|
||||
@click="open(p.id)"
|
||||
>
|
||||
<span class="sc-ic" :style="{ background: grad(i) }">{{ p.name.slice(0, 1) }}</span>
|
||||
<span class="sc-body">
|
||||
<span class="sc-title">
|
||||
<b>{{ p.name }}</b>
|
||||
<em>v{{ p.version }}</em>
|
||||
</span>
|
||||
<span class="sc-desc">{{ p.description || '暂无描述' }}</span>
|
||||
<span v-if="p.platform" class="sc-meta">
|
||||
{{ platformLabel(p.platform) }}
|
||||
<i class="sep-dot"></i>
|
||||
<em class="plat-state" :class="{ on: platformOnline(p.platform) }">
|
||||
{{ platformOnline(p.platform) ? '已登录' : '未登录' }}
|
||||
</em>
|
||||
</span>
|
||||
</span>
|
||||
<span class="sc-go">
|
||||
<template v-if="store.running && store.selectedId === p.id">{{ store.progress }}%</template>
|
||||
<template v-else>执行</template>
|
||||
</span>
|
||||
</button>
|
||||
<div v-if="!store.plugins.length" class="sc-empty">
|
||||
<span class="empty-emoji">🤍</span>
|
||||
<b>当前账号暂无可用场景</b>
|
||||
<span>请联系管理员在控制面进行授权,授权后点左栏「同步」刷新</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Collection } from '@element-plus/icons-vue'
|
||||
import { store } from '../store'
|
||||
|
||||
const GRADS = [
|
||||
'var(--grad-sky)', 'var(--grad-peach)', 'var(--grad-mint)',
|
||||
'var(--grad-lilac)', 'var(--grad-honey)', 'var(--grad-blush)',
|
||||
]
|
||||
function grad(i) { return GRADS[i % GRADS.length] }
|
||||
|
||||
function platformLabel(id) {
|
||||
return (store.platforms.find((p) => p.id === id) || {}).label || id
|
||||
}
|
||||
function platformOnline(id) {
|
||||
return !!(store.platforms.find((p) => p.id === id) || {}).online
|
||||
}
|
||||
function open(id) {
|
||||
store.selectedId = id
|
||||
store.view = 'run'
|
||||
store.pendingReplay = null
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scenes-page { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 10px; flex-shrink: 0; }
|
||||
.head { display: flex; align-items: center; justify-content: space-between; }
|
||||
.ident { display: flex; align-items: center; gap: 12px; }
|
||||
.avatar {
|
||||
width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
|
||||
display: grid; place-items: center; color: var(--tile-fg);
|
||||
background: var(--grad-sky); font-size: 15px;
|
||||
}
|
||||
.ident-meta h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }
|
||||
.ident-meta p { margin: 2px 0 0; font-size: 12px; color: var(--text-faint); }
|
||||
|
||||
.sc-list { display: flex; flex-direction: column; overflow: hidden; }
|
||||
.sc-row {
|
||||
display: flex; align-items: center; gap: 12px;
|
||||
padding: 12px 16px; width: 100%; text-align: left;
|
||||
border: none; border-bottom: 1px solid var(--border);
|
||||
background: transparent; cursor: pointer; font-family: inherit;
|
||||
transition: background .13s;
|
||||
}
|
||||
.sc-row:last-child { border-bottom: none; }
|
||||
.sc-row:hover { background: var(--surface-2); }
|
||||
.sc-row.running { background: var(--primary-tint); }
|
||||
.sc-ic {
|
||||
width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
|
||||
display: grid; place-items: center; color: var(--tile-fg);
|
||||
font-size: 14px; font-weight: 700;
|
||||
}
|
||||
.sc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
||||
.sc-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
|
||||
.sc-title b { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.sc-title em { font-style: normal; font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); flex-shrink: 0; }
|
||||
.sc-desc { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.sc-meta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-faint); font-style: normal; }
|
||||
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--dot-muted); }
|
||||
.plat-state { font-style: normal; color: var(--text-muted-warm); }
|
||||
.plat-state.on { color: var(--ok); }
|
||||
.sc-go {
|
||||
flex-shrink: 0; font-size: 12px; font-weight: 600;
|
||||
color: var(--primary); background: var(--primary-weak);
|
||||
border: 1px solid rgba(var(--primary-rgb), .35);
|
||||
padding: 5px 14px; border-radius: 999px;
|
||||
transition: all .15s ease;
|
||||
}
|
||||
.sc-row:hover .sc-go { background: var(--primary); color: var(--on-primary); border-color: transparent; }
|
||||
.sc-row.running .sc-go { color: var(--on-primary); background: var(--primary); border-color: transparent; font-variant-numeric: tabular-nums; }
|
||||
|
||||
.sc-empty {
|
||||
display: flex; flex-direction: column; align-items: center; gap: 4px;
|
||||
padding: 34px 20px; color: var(--text-faint); font-size: 12.5px;
|
||||
}
|
||||
.sc-empty .empty-emoji { font-size: 26px; }
|
||||
.sc-empty b { color: var(--text-sub); font-size: 13.5px; font-weight: 600; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user