mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
feat: display cross-version installation status in app detail modal
- Replaced single `currentAppIsInstalled` boolean with `currentAppSparkInstalled` and `currentAppApmInstalled` in global store. - Updated `checkAppInstalled` logic in `App.vue` to fetch the installation status for both Spark and APM versions via `ipcRenderer`. - Passed both flags to `AppDetailModal.vue` as props. - Enhanced `AppDetailModal.vue` to compute the "install" button text dynamically: if viewing Spark and APM is installed, it displays `(已安装apm版)`; if viewing APM and Spark is installed, it displays `(已安装spark版)`. The button is also disabled in these scenarios to prevent duplicate cross-version installations.
This commit is contained in:
@@ -97,7 +97,9 @@
|
||||
: 'from-brand to-brand-dark'
|
||||
"
|
||||
@click="handleInstall"
|
||||
:disabled="installFeedback || isCompleted"
|
||||
:disabled="
|
||||
installFeedback || isCompleted || isOtherVersionInstalled
|
||||
"
|
||||
>
|
||||
<i
|
||||
class="fas"
|
||||
@@ -271,7 +273,8 @@ const props = defineProps<{
|
||||
show: boolean;
|
||||
app: App | null;
|
||||
screenshots: string[];
|
||||
isinstalled: boolean;
|
||||
sparkInstalled: boolean;
|
||||
apmInstalled: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -326,15 +329,30 @@ const activeDownload = computed(() => {
|
||||
return downloads.value.find((d) => d.pkgname === displayApp.value?.pkgname);
|
||||
});
|
||||
|
||||
const isinstalled = computed(() => {
|
||||
return viewingOrigin.value === "spark"
|
||||
? props.sparkInstalled
|
||||
: props.apmInstalled;
|
||||
});
|
||||
|
||||
const isOtherVersionInstalled = computed(() => {
|
||||
return viewingOrigin.value === "spark"
|
||||
? props.apmInstalled
|
||||
: props.sparkInstalled;
|
||||
});
|
||||
|
||||
const { installFeedback } = useInstallFeedback(appPkgname);
|
||||
const { isCompleted } = useDownloadItemStatus(appPkgname);
|
||||
const installBtnText = computed(() => {
|
||||
if (props.isinstalled) {
|
||||
if (isinstalled.value) {
|
||||
return "已安装";
|
||||
}
|
||||
if (isCompleted.value) {
|
||||
return "已安装";
|
||||
}
|
||||
if (isOtherVersionInstalled.value) {
|
||||
return viewingOrigin.value === "spark" ? "已安装apm版" : "已安装spark版";
|
||||
}
|
||||
if (installFeedback.value) {
|
||||
const status = activeDownload.value?.status;
|
||||
if (status === "downloading") {
|
||||
|
||||
Reference in New Issue
Block a user