mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-09-21 14:10:11 +08:00
refactor: 基于 upstream/Erotica 重新整合本地功能(来源选择/合并详情/计数/窗口/首页)
将本地在 upstream !408(已安装应用合并+统计)之上的后续改动重新整合到最新 upstream/Erotica: - 已安装应用:卸载/打开按 APM/Spark 来源选择;计数总数=APM+Spark 包数(双来源计为独立包) - 查看详情:已安装页复用所有应用页合并详情视图(单来源优先已装类型,双来源自动模式) - 窗口:恢复阈值改为 1600x900,过大回退默认尺寸并居中,不自动最大化 - 首页推荐:致谢卡片移至其他内容下方,加大标题/卡片/致谢间距 - 隐藏排行榜/荣耀榜侧栏入口(代码保留,v-if=false) - 新增 scripts/test-build.sh 测试打包脚本(版本末段+1 加 -test)并更新 AGENTS.md 冲突文件(index.ts/App.vue/InstalledAppsModal.vue)均取本地完整实现(为上游版本的超集)。
This commit is contained in:
@@ -58,6 +58,34 @@
|
||||
{{ error }}
|
||||
</div>
|
||||
|
||||
<!-- 双来源:先让用户选择要卸载的来源 -->
|
||||
<div
|
||||
v-if="installOrigins.length > 1 && !uninstalling && !completed"
|
||||
class="mb-1 flex w-full flex-col items-end gap-2"
|
||||
>
|
||||
<p class="text-sm text-slate-500 dark:text-slate-400">
|
||||
该应用同时通过 APM 与 Spark 安装,请选择要卸载的来源:
|
||||
</p>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-2 rounded-xl border border-amber-300/70 px-4 py-2 text-sm font-semibold text-amber-700 transition hover:bg-amber-50 dark:border-amber-500/40 dark:text-amber-300 dark:hover:bg-amber-500/10"
|
||||
@click="confirmUninstall('apm')"
|
||||
>
|
||||
<i class="fas fa-box-open"></i>
|
||||
卸载 APM 版
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-2 rounded-xl border border-sky-300/70 px-4 py-2 text-sm font-semibold text-sky-700 transition hover:bg-sky-50 dark:border-sky-500/40 dark:text-sky-300 dark:hover:bg-sky-500/10"
|
||||
@click="confirmUninstall('spark')"
|
||||
>
|
||||
<i class="fas fa-bolt"></i>
|
||||
卸载 Spark 版
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3">
|
||||
<button
|
||||
v-if="!uninstalling"
|
||||
@@ -69,10 +97,10 @@
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="!uninstalling && !completed"
|
||||
v-if="installOrigins.length <= 1 && !uninstalling && !completed"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-2 rounded-xl bg-rose-500 px-4 py-2 text-sm font-semibold text-white shadow-lg shadow-rose-500/30 transition hover:bg-rose-600 hover:-translate-y-0.5"
|
||||
@click="confirmUninstall"
|
||||
@click="confirmUninstall(installOrigins[0])"
|
||||
>
|
||||
<i class="fas fa-trash"></i>
|
||||
确认卸载
|
||||
@@ -115,6 +143,14 @@ const logEnd = ref<HTMLElement | null>(null);
|
||||
const appName = computed(() => props.app?.name || "未知应用");
|
||||
const appPkg = computed(() => props.app?.pkgname || "");
|
||||
|
||||
// 该应用实际安装的来源集合:优先取自合并后的 origins,回退到单 origin 字段
|
||||
const installOrigins = computed<Array<"spark" | "apm">>(() => {
|
||||
if (props.app?.origins && props.app.origins.length > 0) {
|
||||
return props.app.origins;
|
||||
}
|
||||
return [props.app?.origin ?? "spark"];
|
||||
});
|
||||
|
||||
const handleClose = () => {
|
||||
if (uninstalling.value && !completed.value) return; // Prevent closing while uninstalling
|
||||
reset();
|
||||
@@ -134,18 +170,20 @@ const reset = () => {
|
||||
error.value = "";
|
||||
};
|
||||
|
||||
const confirmUninstall = () => {
|
||||
const confirmUninstall = (origin: "spark" | "apm") => {
|
||||
if (!appPkg.value) {
|
||||
error.value = "无效的包名";
|
||||
return;
|
||||
}
|
||||
|
||||
uninstalling.value = true;
|
||||
logs.value = ["正在请求卸载: " + appPkg.value + "..."];
|
||||
const originLabel = origin === "apm" ? "APM" : "Spark";
|
||||
logs.value = [`正在请求卸载(${originLabel}): ${appPkg.value}...`];
|
||||
|
||||
// 按用户选择的来源走对应的卸载方式(spark -> aptss remove;apm -> apm autoremove)
|
||||
window.ipcRenderer.send("remove-installed", {
|
||||
pkgname: appPkg.value,
|
||||
origin: props.app?.origin || "spark",
|
||||
origin,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user