mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-08 17:26:41 +08:00
fix(plugin): resort market list when statistics load
This commit is contained in:
@@ -777,12 +777,13 @@ async function getPluginStatistics() {
|
|||||||
async function refreshData() {
|
async function refreshData() {
|
||||||
await fetchInstalledPlugins()
|
await fetchInstalledPlugins()
|
||||||
await fetchUninstalledPlugins()
|
await fetchUninstalledPlugins()
|
||||||
|
getPluginStatistics()
|
||||||
// 重新加载文件夹配置,确保分身插件能正确显示在文件夹中
|
// 重新加载文件夹配置,确保分身插件能正确显示在文件夹中
|
||||||
await loadPluginFolders()
|
await loadPluginFolders()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对uninstalledList进行排序到sortedUninstalledList
|
// 对uninstalledList进行排序到sortedUninstalledList
|
||||||
watch([marketList, filterForm, activeSort], () => {
|
watch([marketList, filterForm, activeSort, PluginStatistics], () => {
|
||||||
// 匹配过滤函数
|
// 匹配过滤函数
|
||||||
const match = (filter: Array<string>, value: string | undefined) =>
|
const match = (filter: Array<string>, value: string | undefined) =>
|
||||||
filter.length === 0 || (value && filter.includes(value))
|
filter.length === 0 || (value && filter.includes(value))
|
||||||
@@ -811,7 +812,7 @@ watch([marketList, filterForm, activeSort], () => {
|
|||||||
if (!isNullOrEmptyObject(PluginStatistics.value)) {
|
if (!isNullOrEmptyObject(PluginStatistics.value)) {
|
||||||
if (!activeSort.value || activeSort.value === 'count') {
|
if (!activeSort.value || activeSort.value === 'count') {
|
||||||
sortedUninstalledList.value = sortedUninstalledList.value.sort((a, b) => {
|
sortedUninstalledList.value = sortedUninstalledList.value.sort((a, b) => {
|
||||||
return PluginStatistics.value[b.id || '0'] - PluginStatistics.value[a.id || '0']
|
return (PluginStatistics.value[b.id || '0'] ?? 0) - (PluginStatistics.value[a.id || '0'] ?? 0)
|
||||||
})
|
})
|
||||||
} else if (activeSort.value) {
|
} else if (activeSort.value) {
|
||||||
sortedUninstalledList.value = sortedUninstalledList.value.sort((a: any, b: any) => {
|
sortedUninstalledList.value = sortedUninstalledList.value.sort((a: any, b: any) => {
|
||||||
@@ -848,7 +849,7 @@ async function refreshMarket() {
|
|||||||
isMarketRefreshing.value = true
|
isMarketRefreshing.value = true
|
||||||
try {
|
try {
|
||||||
await fetchUninstalledPlugins(true)
|
await fetchUninstalledPlugins(true)
|
||||||
await getPluginStatistics()
|
getPluginStatistics()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -905,7 +906,6 @@ onMounted(async () => {
|
|||||||
await loadPluginOrderConfig()
|
await loadPluginOrderConfig()
|
||||||
await loadPluginFolders() // 加载文件夹配置
|
await loadPluginFolders() // 加载文件夹配置
|
||||||
await refreshData()
|
await refreshData()
|
||||||
getPluginStatistics()
|
|
||||||
if (activeTab.value != 'market' && pluginId.value) {
|
if (activeTab.value != 'market' && pluginId.value) {
|
||||||
// 找到这个插件
|
// 找到这个插件
|
||||||
const plugin = dataList.value.find(item => item.id === pluginId.value)
|
const plugin = dataList.value.find(item => item.id === pluginId.value)
|
||||||
|
|||||||
Reference in New Issue
Block a user