fix: 修复应用还没有安装完,按钮就重新变成可安装状态 (#11)

fix:先用比较简单的方案解决安装之后卸载了还是显示已安装的问题

fix: 在安装成功的ipc信息之后再删除安装队列的任务

删除pnpm workspace
This commit is contained in:
Delta1035
2026-02-04 13:06:01 +08:00
committed by GitHub
parent 53eb307f5c
commit b43c6117ec
6 changed files with 138 additions and 24 deletions

View File

@@ -25,9 +25,9 @@
class="inline-flex items-center gap-2 rounded-2xl bg-gradient-to-r px-4 py-2 text-sm font-semibold text-white shadow-lg disabled:opacity-40 transition hover:-translate-y-0.5"
:class="installFeedback ? 'from-emerald-500 to-emerald-600' : 'from-brand to-brand-dark'"
@click="handleInstall"
:disabled="installFeedback">
:disabled="installFeedback || isCompleted">
<i class="fas" :class="installFeedback ? 'fa-check' : 'fa-download'"></i>
<span>{{ installFeedback ? '已加入队列' : '安装' }}</span>
<span>{{ installBtnText }}</span>
</button>
<template v-else>
<button type="button"
@@ -109,7 +109,8 @@
</template>
<script setup lang="ts">
import { computed, ref, useAttrs } from 'vue';
import { computed,useAttrs } from 'vue';
import { useDownloadItemStatus,useInstallFeedback } from '../global/downloadStatus';
import { APM_STORE_BASE_URL } from '../global/storeConfig';
import type { App } from '../global/typedefinition';
@@ -131,8 +132,16 @@ const emit = defineEmits<{
}>();
const installFeedback = ref(false);
const appPkgname = computed(() => props.app?.pkgname);
const { installFeedback } = useInstallFeedback(appPkgname);
const { isCompleted } = useDownloadItemStatus(appPkgname);
const installBtnText = computed(() => {
if (isCompleted.value) {
// TODO: 似乎有一个时间差,安装好了之后并不是立马就可以从已安装列表看见
return "已安装";
}
return installFeedback.value ? "已加入队列" : "安装";
});
const iconPath = computed(() => {
if (!props.app) return '';
return `${APM_STORE_BASE_URL}/${window.apm_store.arch}/${props.app.category}/${props.app.pkgname}/icon.png`;
@@ -143,11 +152,7 @@ const closeModal = () => {
};
const handleInstall = () => {
installFeedback.value = true;
emit('install');
setTimeout(() => {
installFeedback.value = false;
}, 2000);
};
const handleRemove = () => {