Files
37duAutomation/desktop/electron-shell/frontend/src/components/ScenesPage.vue
T
puddy 612df5531c feat: 新增续签电子签插件及多插件钉钉通知功能
- 新增 xq0034 续签电子签插件,包含核心流程与钉钉通知能力
- 为 xq0035、xq0008、xq0009、xq0010、xq0011、xq0031_xq0032、xq0037、xq0038、xq0045_xq0046 插件添加钉钉群通知配置
- 优化续签电子签执行结果日志,减少重复名单输出
- 桌面端插件列表新增分页功能,优化长列表展示
2026-10-16 13:11:30 +08:00

140 lines
5.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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 pagedList" :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((page - 1) * pageSize + 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>
<el-pagination v-if="store.plugins.length > pageSize" class="sc-pager" small background
layout="total, prev, pager, next" :total="store.plugins.length" :page-size="pageSize"
:current-page="page" @current-change="(p) => page = p" />
</div>
</template>
<script setup>
import { computed, ref, watch } from 'vue'
import { Collection } from '@element-plus/icons-vue'
import { store } from '../store'
// ---- 分页:每页 10 个场景,避免长列表刷屏 ----
const page = ref(1)
const pageSize = 10
const pagedList = computed(() => store.plugins.slice((page.value - 1) * pageSize, page.value * pageSize))
// 同步/撤销授权后当前页可能超界,自动回退
watch(() => store.plugins.length, (n) => {
const max = Math.max(1, Math.ceil(n / pageSize))
if (page.value > max) page.value = max
})
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; }
.sc-pager { justify-content: center; }
</style>