feat:更新应用列表上移 #6035 (#6084)
Some checks failed
Build Test / build-linux-binary (push) Failing after -7m41s
Build / SonarCloud (push) Failing after -7m44s
sync2gitee / repo-sync (push) Failing after -7m45s

This commit is contained in:
trom 2024-08-12 10:26:16 +08:00 committed by GitHub
parent 15f4c05772
commit 1cc2cc6400
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,15 @@
<template>
<div>
<div v-if="showButton">
<RouterButton :buttons="buttons" />
<RouterButton :buttons="buttons">
<template #route-button>
<el-badge is-dot :hidden="!canUpdate" class="pr-5">
<el-button @click="sync" type="primary" plain :disabled="syncing">
{{ $t('app.syncAppList') }}
</el-button>
</el-badge>
</template>
</RouterButton>
</div>
<LayoutContent>
<router-view></router-view>
@ -12,9 +20,13 @@
<script lang="ts" setup>
import i18n from '@/lang';
import { onMounted, ref } from 'vue';
import { SearchAppInstalled } from '@/api/modules/app';
import { SearchAppInstalled, SyncApp } from '@/api/modules/app';
import bus from './bus';
import { MsgSuccess } from '@/utils/message';
let showButton = ref(false);
const syncing = ref(false);
const canUpdate = ref(false);
const buttons = [
{
label: i18n.global.t('app.all'),
@ -31,6 +43,22 @@ const buttons = [
},
];
const sync = () => {
syncing.value = true;
SyncApp()
.then((res) => {
if (res.message != '') {
MsgSuccess(res.message);
} else {
MsgSuccess(i18n.global.t('app.syncStart'));
}
canUpdate.value = false;
})
.finally(() => {
syncing.value = false;
});
};
const search = () => {
SearchAppInstalled({ update: true, page: 1, pageSize: 100 })
.then((res) => {