mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
feat(install): add app uninstall functionality
This commit is contained in:
@@ -38,7 +38,7 @@ import AppDetailModal from './components/AppDetailModal.vue';
|
||||
import ScreenPreview from './components/ScreenPreview.vue';
|
||||
import DownloadQueue from './components/DownloadQueue.vue';
|
||||
import DownloadDetail from './components/DownloadDetail.vue';
|
||||
import { APM_STORE_ARCHITECTURE, APM_STORE_BASE_URL, currentApp } from './global/storeConfig';
|
||||
import { APM_STORE_ARCHITECTURE, APM_STORE_BASE_URL, currentApp, currentAppIsInstalled } from './global/storeConfig';
|
||||
import { downloads } from './global/downloadStatus';
|
||||
import { handleInstall, handleRetry, handleRemove } from './modeuls/processInstall';
|
||||
|
||||
@@ -60,7 +60,6 @@ const showModal = ref(false);
|
||||
const showPreview = ref(false);
|
||||
const currentScreenIndex = ref(0);
|
||||
const screenshots = ref([]);
|
||||
const currentAppIsInstalled = ref(false);
|
||||
const loading = ref(true);
|
||||
const showDownloadDetailModal = ref(false);
|
||||
const currentDownload = ref(null);
|
||||
|
||||
@@ -2,4 +2,7 @@ import { ref } from "vue";
|
||||
|
||||
export const APM_STORE_BASE_URL=import.meta.env.VITE_APM_STORE_BASE_URL;
|
||||
export const APM_STORE_ARCHITECTURE='amd64-apm';
|
||||
export const currentApp = ref<any>(null);
|
||||
|
||||
// 下面的变量用于存储当前应用的信息,其实用在多个组件中
|
||||
export const currentApp = ref<any>(null);
|
||||
export const currentAppIsInstalled = ref(false);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// console.log('[Receive Main-process message]:', ...args)
|
||||
// })
|
||||
|
||||
import { currentApp } from "../global/storeConfig";
|
||||
import { currentApp, currentAppIsInstalled } from "../global/storeConfig";
|
||||
import { APM_STORE_BASE_URL, APM_STORE_ARCHITECTURE } from "../global/storeConfig";
|
||||
import { downloads } from "../global/downloadStatus";
|
||||
|
||||
@@ -53,11 +53,20 @@ export const handleRetry = (download_: DownloadItem) => {
|
||||
window.ipcRenderer.send('queue-install', JSON.stringify(download_));
|
||||
};
|
||||
|
||||
export const handleRemove = (download_: DownloadItem) => {
|
||||
export const handleRemove = () => {
|
||||
if (!currentApp.value?.Pkgname) return;
|
||||
console.log('请求卸载: ', currentApp.value.Pkgname);
|
||||
window.ipcRenderer.send('remove-installed', currentApp.value.Pkgname);
|
||||
}
|
||||
|
||||
window.ipcRenderer.on('remove-complete', (_event, log: DownloadResult) => {
|
||||
if (log.success) {
|
||||
currentAppIsInstalled.value = false;
|
||||
} else {
|
||||
currentAppIsInstalled.value = true;
|
||||
console.error('卸载失败:', log.message);
|
||||
}
|
||||
});
|
||||
|
||||
window.ipcRenderer.on('install-status', (_event, log: InstallLog) => {
|
||||
const downloadObj: any = downloads.value.find(d => d.id === log.id);
|
||||
downloadObj.status = log.message;
|
||||
|
||||
Reference in New Issue
Block a user