|
|
|
@ -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) => { |
|
|
|
|