mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-10 23:13:20 +08:00
Merge pull request #230 from thsrite/v2
This commit is contained in:
@@ -184,8 +184,8 @@ watchEffect(() => {
|
|||||||
// 导入代码需要json格式
|
// 导入代码需要json格式
|
||||||
try {
|
try {
|
||||||
if (importCodeType.value === 'custom') {
|
if (importCodeType.value === 'custom') {
|
||||||
// 将导入的代码转换为规则卡片
|
// 将导入的代码转换为规则卡片,并追加到已有的 customRules
|
||||||
customRules.value = JSON.parse(importCodeString.value).map((item: any) => {
|
const newCustomRules = JSON.parse(importCodeString.value).map((item: any) => {
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
@@ -196,9 +196,10 @@ watchEffect(() => {
|
|||||||
size_range: item.size_range,
|
size_range: item.size_range,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
customRules.value = [...customRules.value, ...newCustomRules] // 合并已有的和新导入的规则
|
||||||
} else if (importCodeType.value === 'group') {
|
} else if (importCodeType.value === 'group') {
|
||||||
// 将导入的代码转换为规则卡片
|
// 将导入的代码转换为规则卡片,并追加到已有的 filterRuleGroups
|
||||||
filterRuleGroups.value = JSON.parse(importCodeString.value).map((item: any) => {
|
const newFilterRuleGroups = JSON.parse(importCodeString.value).map((item: any) => {
|
||||||
return {
|
return {
|
||||||
name: item.name,
|
name: item.name,
|
||||||
rule_string: item.rule_string,
|
rule_string: item.rule_string,
|
||||||
@@ -206,6 +207,7 @@ watchEffect(() => {
|
|||||||
category: item.category,
|
category: item.category,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
filterRuleGroups.value = [...filterRuleGroups.value, ...newFilterRuleGroups] // 合并已有的和新导入的规则
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
$toast.error('规则导入失败!')
|
$toast.error('规则导入失败!')
|
||||||
|
|||||||
Reference in New Issue
Block a user