This commit is contained in:
zyronon
2023-10-22 01:52:51 +08:00
parent 93f61f1620
commit 8b93f51617
200 changed files with 574 additions and 381 deletions

View File

@@ -64,12 +64,12 @@ onMounted(() => {
// if (!languageCategoryList.find(w => w === v.languageCategory)) {
// languageCategoryList.push(v.languageCategory)
// }
if (categoryList[v.languageCategory]) {
if (!categoryList[v.languageCategory].find(w => w === v.category)) {
categoryList[v.languageCategory].push(v.category)
if (categoryList[v.language]) {
if (!categoryList[v.language].find(w => w === v.category)) {
categoryList[v.language].push(v.category)
}
} else {
categoryList[v.languageCategory] = [v.category]
categoryList[v.language] = [v.category]
}
if (tagList[v.category]) {
tagList[v.category] = Array.from(new Set(tagList[v.category].concat(v.tags)))

View File

@@ -71,7 +71,7 @@ async function selectDict(item: DictionaryResource) {
...item,
}
if (item.languageCategory === 'article') {
if (item.language === 'article') {
data.type = DictType.publicArticle
let r = await fetch(`${item.url}`)
r.json().then(v => {
@@ -134,7 +134,7 @@ function groupByDictTags(dicts: DictionaryResource[]) {
}
const groupedByCategoryAndTag = $computed(() => {
const currentLanguageCategoryDicts = dictionaryResources.filter((dict) => dict.languageCategory === currentLanguage)
const currentLanguageCategoryDicts = dictionaryResources.filter((dict) => dict.language === currentLanguage)
const groupedByCategory = Object.entries(groupBy(currentLanguageCategoryDicts, (dict) => dict.category))
const groupedByCategoryAndTag = groupedByCategory.map(
([category, dicts]) => [category, groupByDictTags(dicts)] as [string, Record<string, DictionaryResource[]>],