feat: 修改应用信息界面,对于已安装应用,安装按钮变为打开按钮,并添加卸载按钮

This commit is contained in:
2026-02-27 23:03:10 +08:00
parent 3a9c9dda22
commit 6ea628d869
4 changed files with 42 additions and 26 deletions

View File

@@ -633,8 +633,8 @@ const onUninstallSuccess = () => {
}
};
const installCompleteCallback = () => {
if (currentApp.value) {
const installCompleteCallback = (pkgname?: string) => {
if (currentApp.value && (!pkgname || currentApp.value.pkgname === pkgname)) {
checkAppInstalled(currentApp.value);
}
};

View File

@@ -236,8 +236,10 @@ const activeDownload = computed(() => {
const { installFeedback } = useInstallFeedback(appPkgname);
const { isCompleted } = useDownloadItemStatus(appPkgname);
const installBtnText = computed(() => {
if (props.isinstalled) {
return "已安装";
}
if (isCompleted.value) {
// TODO: 似乎有一个时间差,安装好了之后并不是立马就可以从已安装列表看见
return "已安装";
}
if (installFeedback.value) {

View File

@@ -12,7 +12,7 @@ export function removeDownloadItem(pkgname: string) {
}
}
export function watchDownloadsChange(cb: () => void) {
export function watchDownloadsChange(cb: (pkgname: string) => void) {
const statusById = new Map<number, DownloadItemStatus>();
for (const item of downloads.value) {
@@ -25,7 +25,7 @@ export function watchDownloadsChange(cb: () => void) {
for (const item of list) {
const prevStatus = statusById.get(item.id);
if (item.status === "completed" && prevStatus !== "completed") {
cb();
cb(item.pkgname);
}
statusById.set(item.id, item.status);
}