mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix plugin order
This commit is contained in:
@@ -121,14 +121,16 @@ async function loadPluginOrderConfig() {
|
|||||||
localStorage.setItem('MP_PLUGIN_ORDER', JSON.stringify(orderConfig.value))
|
localStorage.setItem('MP_PLUGIN_ORDER', JSON.stringify(orderConfig.value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 排序
|
|
||||||
if (orderConfig.value) {
|
|
||||||
sortPluginOrder()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按order的顺序对插件进行排序
|
// 按order的顺序对插件进行排序
|
||||||
function sortPluginOrder() {
|
function sortPluginOrder() {
|
||||||
|
if (!orderConfig.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (dataList.value.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
dataList.value.sort((a, b) => {
|
dataList.value.sort((a, b) => {
|
||||||
const aIndex = orderConfig.value.findIndex((item: { id: string }) => item.id === a.id)
|
const aIndex = orderConfig.value.findIndex((item: { id: string }) => item.id === a.id)
|
||||||
const bIndex = orderConfig.value.findIndex((item: { id: string }) => item.id === b.id)
|
const bIndex = orderConfig.value.findIndex((item: { id: string }) => item.id === b.id)
|
||||||
@@ -139,7 +141,8 @@ function sortPluginOrder() {
|
|||||||
// 保存顺序设置
|
// 保存顺序设置
|
||||||
async function savePluginOrder() {
|
async function savePluginOrder() {
|
||||||
// 顺序配置
|
// 顺序配置
|
||||||
const orderObj = dataList.value.map(item => ({ id: item.id }))
|
const orderObj = dataList.value.map(item => ({ id: item.id || '' }))
|
||||||
|
orderConfig.value = orderObj
|
||||||
const orderString = JSON.stringify(orderObj)
|
const orderString = JSON.stringify(orderObj)
|
||||||
localStorage.setItem('MP_PLUGIN_ORDER', orderString)
|
localStorage.setItem('MP_PLUGIN_ORDER', orderString)
|
||||||
|
|
||||||
@@ -255,6 +258,8 @@ async function fetchInstalledPlugins() {
|
|||||||
state: 'installed',
|
state: 'installed',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
// 排序
|
||||||
|
sortPluginOrder()
|
||||||
loading.value = false
|
loading.value = false
|
||||||
isRefreshed.value = true
|
isRefreshed.value = true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -377,8 +382,8 @@ function handleRepoUrl(url: string | undefined) {
|
|||||||
|
|
||||||
// 加载时获取数据
|
// 加载时获取数据
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await refreshData()
|
|
||||||
await loadPluginOrderConfig()
|
await loadPluginOrderConfig()
|
||||||
|
refreshData()
|
||||||
getPluginStatistics()
|
getPluginStatistics()
|
||||||
if (activeTab.value != 'market' && pluginId.value) {
|
if (activeTab.value != 'market' && pluginId.value) {
|
||||||
// 找到这个插件
|
// 找到这个插件
|
||||||
|
|||||||
@@ -7093,6 +7093,11 @@ to-regex-range@^5.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-number "^7.0.0"
|
is-number "^7.0.0"
|
||||||
|
|
||||||
|
toggle-selection@^1.0.6:
|
||||||
|
version "1.0.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
|
||||||
|
integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==
|
||||||
|
|
||||||
toidentifier@1.0.1:
|
toidentifier@1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
|
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
|
||||||
|
|||||||
Reference in New Issue
Block a user