feat:修改数据结构

This commit is contained in:
zyronon
2025-07-21 00:03:52 +08:00
parent a90365e6a6
commit 3a913c8520
11 changed files with 3585 additions and 727 deletions

File diff suppressed because it is too large Load Diff

900
src/assets/dictionary2.ts Normal file
View File

@@ -0,0 +1,900 @@
import {DictResource, DictType} from "@/types.ts"
// 国际考试
const internationalExam: DictResource[] = [
{
id: 'BEC_2',
name: '商务英语词汇',
description: '商务英语词汇',
url: 'BEC_2.7z',
length: 2753,
category: '国际考试',
tags: ['所有', 'BEC'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BEC_3',
name: '新东方 BEC 词汇',
description: '新东方 BEC 词汇',
url: 'BEC_3.7z',
length: 2825,
category: '国际考试',
tags: ['所有', 'BEC', '新东方'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'TOEFL_2',
name: 'TOEFL 词汇',
description: 'TOEFL 词汇',
url: 'TOEFL_2.json',
length: 9213,
category: '国际考试',
tags: ['所有', 'TOEFL'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'GRE_2',
name: 'GRE 词汇',
description: 'GRE 词汇',
url: 'GRE_2.json',
length: 7199,
category: '国际考试',
tags: ['所有', 'GRE'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'SAT_2',
name: 'SAT 词汇',
description: 'SAT 词汇',
url: 'SAT_2.json',
length: 4423,
category: '国际考试',
tags: ['所有', 'SAT'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'GMAT_2',
name: 'GMAT 词汇',
description: 'GMAT 词汇',
url: 'GMAT_2.json',
length: 3254,
category: '国际考试',
tags: ['所有', 'GMAT'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'IELTS_3',
name: '新东方雅思词汇',
description: '新东方雅思词汇',
url: 'IELTS_3.json',
length: 3575,
category: '国际考试',
tags: ['所有', 'IELTS', '新东方'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'TOEFL_3',
name: '新东方 TOEFL 词汇',
description: '新东方 TOEFL 词汇',
url: 'TOEFL_3.json',
length: 4264,
category: '国际考试',
tags: ['所有', 'TOEFL', '新东方'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'GRE_3',
name: '新东方 GRE 词汇',
description: '新东方 GRE 词汇',
url: 'GRE_3.json',
length: 6515,
category: '国际考试',
tags: ['所有', '新东方', 'GRE'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'SAT_3',
name: '新东方 SAT 词汇',
description: '新东方 SAT 词汇',
url: 'SAT_3.json',
length: 4464,
category: '国际考试',
tags: ['所有', '新东方', 'SAT'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'GMAT_3',
name: '新东方 GMAT 词汇',
description: '新东方 GMAT 词汇',
url: 'GMAT_3.json',
length: 3047,
category: '国际考试',
tags: ['所有', '新东方', 'GMAT'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'IELTS_2',
name: '雅思词汇',
description: '雅思词汇',
url: 'IELTS_2.json',
length: 3427,
category: '国际考试',
tags: ['所有', 'IELTS'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
]
// 中国考试
const chinaExam: DictResource[] = [
{
id: 'CET4_1',
name: '四级真题核心词',
description: '四级真题核心词',
url: 'CET4_1.json',
length: 1162,
category: '中国考试',
tags: ['所有', '大学英语', '四级',],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'CET6_1',
name: '六级真题核心词',
description: '六级真题核心词',
url: 'CET6_1.json',
length: 1228,
category: '中国考试',
tags: ['所有', '大学英语', '六级'],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'Level4_1',
name: '专四真题高频词',
description: '专四真题高频词',
url: 'Level4_1.json',
length: 595,
category: '中国考试',
tags: ['所有', '大学英语'],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'Level8_1',
name: '专八真题高频词',
description: '专八真题高频词',
url: 'Level8_1.json',
length: 684,
category: '中国考试',
tags: ['所有', '大学英语'],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'CET4_2',
name: '四级英语词汇',
description: '四级英语词汇',
url: 'CET4_2.json',
length: 3739,
category: '中国考试',
tags: ['所有', '大学英语', '四级'],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'CET6_2',
name: '六级英语词汇',
description: '六级英语词汇',
url: 'CET6_2.json',
length: 2078,
category: '中国考试',
tags: ['所有', '大学英语', '六级'],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'Level4_2',
name: '专四核心词汇',
description: '专四核心词汇',
url: 'Level4_2.json',
length: 4025,
category: '中国考试',
tags: ['所有', '大学英语'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'Level8_2',
name: '专八核心词汇',
description: '专八核心词汇',
url: 'Level8_2.json',
length: 12197,
category: '中国考试',
tags: ['所有', '大学英语'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'CET4_3',
name: '新东方四级词汇',
url: 'CET4_3.json',
length: 2607,
category: '中国考试',
tags: ['所有', '大学英语', '四级', '新东方'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
description: ''
},
{
id: 'CET6_3',
name: '新东方六级词汇',
description: '新东方六级词汇',
url: 'CET6_3.json',
length: 2345,
category: '中国考试',
tags: ['所有', '大学英语', '六级', '新东方'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'KaoYan_2',
name: '考研英语词汇',
description: '考研英语词汇',
url: 'KaoYan_2.json',
length: 4533,
category: '中国考试',
tags: ['所有', '考研'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'KaoYan_1',
name: '考研必考词汇',
description: '考研必考词汇',
url: 'KaoYan_1.json',
length: 1341,
category: '中国考试',
tags: ['所有', '考研'],
translateLanguage: 'common',
language: 'en',
type: DictType.word
},
{
id: 'KaoYan_3',
name: '新东方考研词汇',
description: '新东方考研词汇',
url: 'KaoYan_3.json',
length: 3728,
category: '中国考试',
tags: ['所有', '考研', '新东方'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
]
// 青少儿英语
const childrenEnglish: DictResource[] = [
{
id: 'ChuZhong_2',
name: '初中英语词汇',
description: '初中英语词汇',
url: 'ChuZhong_2.json',
length: 1420,
category: '青少年英语',
tags: ['所有', '通用', '初中'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'GaoZhong_2',
name: '高中英语词汇',
description: '高中英语词汇',
url: 'GaoZhong_2.json',
length: 3668,
category: '青少年英语',
tags: ['所有', '通用', '高中'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'ChuZhong_3',
name: '新东方初中词汇',
description: '新东方初中词汇',
url: 'ChuZhong_3.json',
length: 1803,
category: '青少年英语',
tags: ['所有', '通用', '初中'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'GaoZhong_3',
name: '新东方高中词汇',
description: '新东方高中词汇',
url: 'GaoZhong_3.json',
length: 2340,
category: '青少年英语',
tags: ['所有', '通用', '高中'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue3_1',
name: '人教版小学英语-三年级上册',
description: '人教版小学英语-三年级上册',
url: 'PEPXiaoXue3_1.json',
length: 64,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue3_2',
name: '人教版小学英语-三年级下册',
description: '人教版小学英语-三年级下册',
url: 'PEPXiaoXue3_2.json',
length: 72,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue4_1',
name: '人教版小学英语-四年级上册',
description: '人教版小学英语-四年级上册',
url: 'PEPXiaoXue4_1.json',
length: 84,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue4_2',
name: '人教版小学英语-四年级下册',
description: '人教版小学英语-四年级下册',
url: 'PEPXiaoXue4_2.json',
length: 104,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue5_1',
name: '人教版小学英语-五年级上册',
description: '人教版小学英语-五年级上册',
url: 'PEPXiaoXue5_1.json',
length: 131,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue5_2',
name: '人教版小学英语-五年级下册',
description: '人教版小学英语-五年级下册',
url: 'PEPXiaoXue5_2.json',
length: 156,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue6_1',
name: '人教版小学英语-六年级上册',
description: '人教版小学英语-六年级上册',
url: 'PEPXiaoXue6_1.json',
length: 130,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPXiaoXue6_2',
name: '人教版小学英语-六年级下册',
description: '人教版小学英语-六年级下册',
url: 'PEPXiaoXue6_2.json',
length: 108,
category: '青少年英语',
tags: ['所有', '小学', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPChuZhong7_1',
name: '七年级上册',
description: '人教版初中英语-七年级上册',
url: 'PEPChuZhong7_1.json',
length: 392,
category: '青少年英语',
tags: ['所有', '初中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPChuZhong7_2',
name: '七年级下册',
description: '人教版初中英语-七年级下册',
url: 'PEPChuZhong7_2.json',
length: 492,
category: '青少年英语',
tags: ['所有', '初中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPChuZhong8_1',
name: '八年级上册',
description: '人教版初中英语-八年级上册',
url: 'PEPChuZhong8_1.json',
length: 419,
category: '青少年英语',
tags: ['所有', '初中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPChuZhong8_2',
name: '八年级下册',
description: '人教版初中英语-八年级下册',
url: 'PEPChuZhong8_2.json',
length: 466,
category: '青少年英语',
tags: ['所有', '初中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPChuZhong9_1',
name: '九年级全册',
description: '人教版初中英语-九年级全册',
url: 'PEPChuZhong9_1.json',
length: 551,
category: '青少年英语',
tags: ['所有', '初中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'WaiYanSheChuZhong_1',
name: '七年级上册',
description: '外研社版初中英语-七年级上册',
url: 'WaiYanSheChuZhong_1.json',
length: 629,
category: '青少年英语',
tags: ['所有', '初中', '外研社'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'WaiYanSheChuZhong_2',
name: '七年级下册',
description: '外研社版初中英语-七年级下册',
url: 'WaiYanSheChuZhong_2.json',
length: 438,
category: '青少年英语',
tags: ['所有', '初中', '外研社'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'WaiYanSheChuZhong_3',
name: '八年级上册',
description: '外研社版初中英语-八年级上册',
url: 'WaiYanSheChuZhong_3.json',
length: 320,
category: '青少年英语',
tags: ['所有', '初中', '外研社'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'WaiYanSheChuZhong_4',
name: '八年级下册',
description: '外研社版初中英语-八年级下册',
url: 'WaiYanSheChuZhong_4.json',
length: 266,
category: '青少年英语',
tags: ['所有', '初中', '外研社'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'WaiYanSheChuZhong_5',
name: '九年级上册',
description: '外研社版初中英语-九年级上册',
url: 'WaiYanSheChuZhong_5.json',
length: 381,
category: '青少年英语',
tags: ['所有', '初中', '外研社'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'WaiYanSheChuZhong_6',
name: '九年级下册',
description: '外研社版初中英语-九年级下册',
url: 'WaiYanSheChuZhong_6.json',
length: 128,
category: '青少年英语',
tags: ['所有', '初中', '外研社'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_1',
name: '高中必修1',
description: '人教版高中英语-必修 1',
url: 'PEPGaoZhong_1.json',
length: 311,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_2',
name: '高中必修2',
description: '人教版高中英语-必修 2',
url: 'PEPGaoZhong_2.json',
length: 319,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_3',
name: '高中必修3',
description: '人教版高中英语-必修 3',
url: 'PEPGaoZhong_3.json',
length: 366,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_4',
name: '高中必修4',
description: '人教版高中英语-必修 4',
url: 'PEPGaoZhong_4.json',
length: 307,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_5',
name: '高中必修5',
description: '人教版高中英语-必修 5',
url: 'PEPGaoZhong_5.json',
length: 357,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_6',
name: '高中必修6',
description: '人教版高中英语-必修 6',
url: 'PEPGaoZhong_6.json',
length: 391,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_7',
name: '高中必修7',
description: '人教版高中英语-必修 7',
url: 'PEPGaoZhong_7.json',
length: 384,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_8',
name: '高中必修8',
description: '人教版高中英语-必修 8',
url: 'PEPGaoZhong_8.json',
length: 420,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_9',
name: '高中必修9',
description: '人教版高中英语-必修 9',
url: 'PEPGaoZhong_9.json',
length: 352,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_10',
name: '高中必修10',
description: '人教版高中英语-必修 10',
url: 'PEPGaoZhong_10.json',
length: 361,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'PEPGaoZhong_11',
name: '高中必修11',
description: '人教版高中英语-必修 11',
url: 'PEPGaoZhong_11.json',
length: 309,
category: '青少年英语',
tags: ['所有', '高中', '人教版'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_1',
name: '高中必修1',
description: '北师大版高中必修1',
url: 'BeiShiGaoZhong_1.json',
length: 226,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_2',
name: '高中必修2',
description: '北师大版高中必修2',
url: 'BeiShiGaoZhong_2.json',
length: 244,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_3',
name: '高中必修3',
description: '北师大版高中必修3',
url: 'BeiShiGaoZhong_3.json',
length: 295,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_4',
name: '高中必修4',
description: '北师大版高中必修4',
url: 'BeiShiGaoZhong_4.json',
length: 336,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_5',
name: '高中必修5',
description: '北师大版高中必修5',
url: 'BeiShiGaoZhong_5.json',
length: 327,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_6',
name: '高中必修6',
description: '北师大版高中必修6',
url: 'BeiShiGaoZhong_6.json',
length: 271,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_7',
name: '高中必修7',
description: '北师大版高中必修7',
url: 'BeiShiGaoZhong_7.json',
length: 334,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_8',
name: '高中必修8',
description: '北师大版高中必修8',
url: 'BeiShiGaoZhong_8.json',
length: 364,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_9',
name: '高中必修9',
description: '北师大版高中必修9',
url: 'BeiShiGaoZhong_9.json',
length: 299,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_10',
name: '高中必修10',
description: '北师大版高中必修10',
url: 'BeiShiGaoZhong_10.json',
length: 267,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
{
id: 'BeiShiGaoZhong_11',
name: '高中必修11',
description: '北师大版高中必修11',
url: 'BeiShiGaoZhong_11.json',
length: 330,
category: '青少年英语',
tags: ['所有', '高中', '北师大'],
translateLanguage: 'common',
language: 'en',
type: DictType.word,
},
]
// 英语文章
export const enArticle: DictResource[] = [
{
id: 'article_nce2',
name: "新概念英语2-课文",
description: '新概念英语2-课文',
category: '文章学习',
tags: ['新概念英语'],
url: 'NCE_2.json',
length: 96,
translateLanguage: 'common',
language: 'en',
type: DictType.article
},
{
id: 'article_nce3',
name: "新概念英语3-课文",
description: '新概念英语3-课文',
category: '文章学习',
tags: ['新概念英语'],
url: 'NCE_3.json',
length: 3,
translateLanguage: 'common',
language: 'en',
type: DictType.article
},
{
id: 'article_nce4',
name: "新概念英语4-课文",
description: '新概念英语4-课文',
category: '文章学习',
tags: ['新概念英语'],
url: 'NCE_4.json',
length: 3,
translateLanguage: 'common',
language: 'en',
type: DictType.article
}
]
export const dictionaryResources: DictResource[] = [
...chinaExam,
...internationalExam,
...childrenEnglish,
]

View File

@@ -36,7 +36,7 @@ const activeId = $computed(() => {
return runtimeStore.editDict.articles?.[chapterIndex]?.id ?? ''
})
function addMyBookList() {
function addMyStudyList() {
let rIndex = base.article.bookList.findIndex(v => v.name === runtimeStore.editDict.name)
if (rIndex > -1) {
base.article.studyIndex = rIndex
@@ -76,7 +76,7 @@ function formClose() {
<div class="flex gap-2">
<BaseButton type="info" @click="isEdit = true">编辑</BaseButton>
<BaseButton type="info" @click="router.push('batch-edit-article')">文章管理</BaseButton>
<BaseButton @click="addMyBookList">学习</BaseButton>
<BaseButton @click="addMyStudyList">学习</BaseButton>
</div>
</div>
<div class="text-lg ">介绍{{ runtimeStore.editDict.description }}</div>

View File

@@ -5,7 +5,7 @@ import {Sort} from "@/types.ts";
import MiniDialog from "@/pages/pc/components/dialog/MiniDialog.vue";
import BaseIcon from "@/components/BaseIcon.vue";
import BaseButton from "@/components/BaseButton.vue";
import {cloneDeep, reverse, shuffle} from "lodash-es";
import {cloneDeep, debounce, reverse, shuffle} from "lodash-es";
import Input from "@/pages/pc/components/Input.vue";
import PopConfirm from "@/pages/pc/components/PopConfirm.vue";
import Empty from "@/components/Empty.vue";
@@ -132,7 +132,8 @@ defineRender(
>
<Input
modelValue={searchKey}
onUpdate:model-value={e => searchKey = e}
onUpdate:modelValue=
{debounce(e => searchKey = e)}
class="flex-1"/>
<BaseButton onClick={() => (showSearchInput = false, searchKey = '')}>取消</BaseButton>
</div>

View File

@@ -25,9 +25,9 @@ watch(() => props.groupByTag, () => {
</script>
<template>
<div >
<div>
<div class="flex items-center">
<div class="category">{{ category }}</div>
<div class="category shrink-0">{{ category }}</div>
<div class="tags">
<div class="tag" :class="i === currentTag &&'active'"
@click="currentTag = i"

View File

@@ -57,6 +57,11 @@ const DefaultFormWord = {
phonetic0: '',
phonetic1: '',
trans: '',
sentences: '',
phrases: '',
synos: '',
relWords: '',
etymology: '',
}
let wordForm = $ref(cloneDeep(DefaultFormWord))
const wordFormRef = $ref<FormInstance>()
@@ -114,13 +119,17 @@ function batchDel(ids: string[]) {
ids.map(v => delWord(v))
}
function editWord(word: Word,) {
function editWord(word: Word) {
wordFormData.type = FormMode.Edit
wordFormData.id = word.id
wordForm.word = word.word
wordForm.phonetic1 = word.phonetic1
wordForm.phonetic0 = word.phonetic0
wordForm.trans = word.trans.map(v => JSON.stringify(v)).join('\n')
wordForm.trans = word.trans.map(v => (v.pos + v.cn).replaceAll('"', '')).join('\n')
wordForm.sentences = word.sentences.map(v => (v.c + "\n" + v.cn).replaceAll('"', '')).join('\n\n')
wordForm.phrases = word.phrases.map(v => (v.c + "\n" + v.cn).replaceAll('"', '')).join('\n\n')
wordForm.synos = word.synos.map(v => (v.pos + v.cn + "\n" + v.ws.join('/')).replaceAll('"', '')).join('\n\n')
wordForm.relWords = word.relWords.rels.map(v => (v.pos + "\n" + v.words.map(v => (v.c + "\n" + v.cn))).replaceAll('"', '')).join('\n\n')
}
function addWord() {
@@ -152,8 +161,15 @@ function formClose() {
else router.back()
}
function addMyBookList() {
function addMyStudyList() {
let rIndex = base.word.bookList.findIndex(v => v.name === runtimeStore.editDict.name)
if (rIndex > -1) {
base.word.studyIndex = rIndex
} else {
base.word.bookList.push(runtimeStore.editDict)
base.word.studyIndex = base.word.bookList.length - 1
}
router.back()
}
defineRender(() => {
@@ -166,7 +182,7 @@ defineRender(() => {
<div class="absolute text-2xl text-align-center w-full">{runtimeStore.editDict.name}</div>
<div class="flex gap-2">
<BaseButton type="info" onClick={() => isEdit = true}>编辑</BaseButton>
<BaseButton onClick={addMyBookList}>学习</BaseButton>
<BaseButton onClick={addMyStudyList}>学习</BaseButton>
</div>
</div>
<div class="text-lg ">介绍{runtimeStore.editDict.description}</div>
@@ -215,7 +231,7 @@ defineRender(() => {
</div>
{
wordFormData.type ? (
<div class="flex-1 ml-4">
<div class="flex-1 ml-4 overflow-auto">
<div class="common-title">
{wordFormData.type === FormMode.Add ? '添加' : '修改'}单词
</div>
@@ -228,27 +244,67 @@ defineRender(() => {
<el-form-item label="单词" prop="word">
<el-input
modelValue={wordForm.word}
onUpdate:model-value={e => wordForm.word = e}
onUpdate:modelValue={e => wordForm.word = e}
/>
</el-form-item>
<el-form-item label="翻译">
<el-input
modelValue={wordForm.trans}
onUpdate:model-value={e => wordForm.trans = e}
placeholder="多个翻译请换行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="音标/发音①">
<el-input
modelValue={wordForm.phonetic0}
onUpdate:model-value={e => wordForm.phonetic0 = e}
onUpdate:modelValue={e => wordForm.phonetic0 = e}
/>
</el-form-item>
<el-form-item label="音标/发音②">
<el-input
modelValue={wordForm.phonetic1}
onUpdate:model-value={e => wordForm.phonetic1 = e}/>
onUpdate:modelValue={e => wordForm.phonetic1 = e}/>
</el-form-item>
<el-form-item label="翻译">
<el-input
modelValue={wordForm.trans}
onUpdate:modelValue={e => wordForm.trans = e}
placeholder="一行一个翻译前面词性后面内容n.取消);多个翻译请换行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="例句">
<el-input
modelValue={wordForm.sentences}
onUpdate:modelValue={e => wordForm.sentences = e}
placeholder="一行原文,一行译文;多个请换两行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="短语">
<el-input
modelValue={wordForm.phrases}
onUpdate:modelValue={e => wordForm.phrases = e}
placeholder="一行原文,一行译文;多个请换两行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="同义词">
<el-input
modelValue={wordForm.synos}
onUpdate:modelValue={e => wordForm.synos = e}
placeholder="一行原文,一行译文;多个请换两行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="同根词">
<el-input
modelValue={wordForm.relWords}
onUpdate:modelValue={e => wordForm.relWords = e}
placeholder="一行原文,一行译文;多个请换两行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<el-form-item label="词源">
<el-input
modelValue={wordForm.etymology}
onUpdate:modelValue={e => wordForm.etymology = e}
placeholder="一行原文,一行译文;多个请换两行"
autosize={{minRows: 6, maxRows: 10}}
type="textarea"/>
</el-form-item>
<div class="center">
<el-button

View File

@@ -6,7 +6,7 @@ import "vue-activity-calendar/style.css";
import {useRouter} from "vue-router";
import BaseIcon from "@/components/BaseIcon.vue";
import Dialog from "@/pages/pc/components/dialog/Dialog.vue";
import {_getAccomplishDate, _getAccomplishDays, useNav} from "@/utils";
import {_getAccomplishDate, _getAccomplishDays, _getDictDataByUrl, useNav} from "@/utils";
import BasePage from "@/pages/pc/components/BasePage.vue";
import {Dict, DictResource, getDefaultDict} from "@/types.ts";
import {onMounted} from "vue";
@@ -18,6 +18,7 @@ import DictGroup from "@/pages/pc/components/list/DictGroup.vue";
import {cloneDeep} from "lodash-es";
import {useRuntimeStore} from "@/stores/runtime.ts";
import {getArticleBookDataByUrl} from "@/utils/article.ts";
import Typing from "@/pages/pc/word/components/Typing.vue";
const store = useBaseStore()
const router = useRouter()
@@ -57,18 +58,19 @@ function changePerDayStudyNumber() {
}
function selectDict(e) {
console.log(e)
console.log(e.dict)
getDictDetail(e.dict)
}
async function goDictDetail2(val: Dict) {
runtimeStore.editDict = cloneDeep(val)
nav('edit-word-dict', {})
nav('dict-detail', {})
}
async function getBookDetail(val: DictResource) {
let r = await getArticleBookDataByUrl(val)
async function getDictDetail(val: DictResource) {
let r = await _getDictDataByUrl(val)
runtimeStore.editDict = cloneDeep(r)
nav('book-detail', {})
nav('dict-detail', {})
}
let dictListRef = $ref<any>()
@@ -81,7 +83,7 @@ function addDict() {
<template>
<BasePage>
<div class="card flex gap-10">
<div class="card flex gap-10" v-loading="!store.load">
<div class="flex-1 flex flex-col gap-2">
<div class="flex">
<div class="bg-slate-200 px-3 h-14 rounded-md flex items-center">

View File

@@ -21,7 +21,7 @@ export const routes: RouteRecordRaw[] = [
{path: 'home', component: HomeIndex},
{path: 'word', component: WordHomePage},
{path: 'study-word', component: StudyWord},
{path: 'edit-word-dict', component: EditWordDict},
{path: 'dict-detail', component: EditWordDict},
{path: 'article', component: ArticleHomePage},
{path: 'study-article', component: StudyArticle},
{path: 'edit-article', component: EditArticlePage},

View File

@@ -5,7 +5,7 @@ import {emitter, EventKey} from "@/utils/eventBus.ts"
import * as localforage from "localforage";
import {nanoid} from "nanoid";
import {SAVE_DICT_KEY} from "@/utils/const.ts";
import {_checkDictWords, _getStudyProgress, checkAndUpgradeSaveDict, getDictFile} from "@/utils";
import {_checkDictWords, _getDictDataByUrl, _getStudyProgress, checkAndUpgradeSaveDict, getDictFile} from "@/utils";
export interface BaseState {
myDictList: Dict[],
@@ -55,87 +55,24 @@ export const DefaultBaseState = (): BaseState => ({
word: {
bookList: [
getDefaultDict({
id: 'word-collect', name: '收藏', words: [
{
"id": "pharmacy",
"word": "pharmacy",
"trans": [
{
"cn": "n.药房,配药学,药学,制药业,一批备用药品"
}
],
"phonetic0": "ˈfɑ:məsi",
"phonetic1": "ˈfɑ:rməsi"
},
{
"id": "foregone",
"word": "foregone",
"trans": [
{
"cn": "过去的;先前的;预知的;预先决定的"
},
{
"cn": "发生在…之前forego的过去分词"
}
],
"phonetic0": "fɔː'gɒn",
"phonetic1": "'fɔrɡɔn"
},
{
"id": "calculate",
"word": "calculate",
"trans": [
{
"cn": "vt.& vi.计算,估计,打算,计划,旨在"
},
{
"cn": "vt.预测,推测"
}
],
"phonetic0": "ˈkælkjuleɪt",
"phonetic1": "ˈkælkjəˌlet"
},
{
"id": "compete",
"word": "compete",
"trans": [
{
"cn": "vi.竞赛,竞争,比得上,参加比赛(或竞赛)"
}
],
"phonetic0": "kəmˈpi:t",
"phonetic1": "kəmˈpit"
},
{
"id": "furnish",
"word": "furnish",
"trans": [
{
"cn": "vt.陈设,布置,提供,供应,装修(房屋)"
}
],
"phonetic0": "ˈfɜ:nɪʃ",
"phonetic1": "ˈfɜ:rnɪʃ"
},
]
id: 'word-collect', name: '收藏', words: []
}),
getDefaultDict({id: 'word-wrong', name: '错词'}),
getDefaultDict({id: 'word-known', name: '已掌握'}),
getDefaultDict({
id: 'nce-new-2',
name: '新概念英语(新版)-2',
description: '新概念英语新版第二册',
category: '青少年英语',
tags: ['新概念英语'],
url: 'nce-new-2_v2.json',
length: 862,
translateLanguage: 'common',
language: 'en',
type: DictType.word
}),
// getDefaultDict({
// id: 'nce-new-2',
// name: '新概念英语(新版)-2',
// description: '新概念英语新版第二册',
// category: '青少年英语',
// tags: ['新概念英语'],
// url: 'nce-new-2_v2.json',
// length: 862,
// translateLanguage: 'common',
// language: 'en',
// type: DictType.word
// }),
],
studyIndex: 3,
studyIndex: -1,
},
article: {
bookList: [
@@ -236,18 +173,13 @@ export const useBaseStore = defineStore('base', {
console.error('读取本地dict数据失败', e)
}
if (this.word.studyIndex >= 0) {
if (this.word.studyIndex >= 3) {
// await _checkDictWords(this.currentStudyWordDict)
let current = this.word.bookList[this.word.studyIndex]
let dictResourceUrl = `./dicts/${current.language}/${current.type}/${current.url}`;
let s = await getDictFile(dictResourceUrl)
current.words = cloneDeep(s.map(v => {
v.id = nanoid(6)
return v
}))
this.word.bookList[this.word.studyIndex] = await _getDictDataByUrl(current)
console.log('this.current', current)
}
if (this.article.studyIndex >= 0) {
if (this.article.studyIndex >= 1) {
let current = this.article.bookList[this.article.studyIndex]
let dictResourceUrl = `./dicts/${current.language}/${current.type}/${current.translateLanguage}/${current.url}`;
if (!current.articles.length) {

View File

@@ -44,7 +44,7 @@ export type Word = {
}[],
}
export function getDefaultWord(val?: any): Word {
export function getDefaultWord(val: Partial<Word> = {}): Word {
return {
"word": "",
"phonetic0": "",
@@ -96,7 +96,7 @@ export interface ArticleWord extends Word {
symbolPosition: 'start' | 'end' | '',
}
export function getDefaultArticleWord(val?: any): ArticleWord {
export function getDefaultArticleWord(val: Partial<ArticleWord> = {}): ArticleWord {
return getDefaultWord({
nextSpace: true,
isSymbol: false,
@@ -175,13 +175,6 @@ export enum Sort {
reverse = 2
}
export const ShortcutKeyMap = {
Show: 'Escape',
Ignore: 'Tab',
Remove: '`',
Collect: 'Enter',
}
export enum ShortcutKey {
ShowWord = 'ShowWord',
EditArticle = 'EditArticle',

View File

@@ -2,7 +2,7 @@ import {SAVE_DICT_KEY, SAVE_SETTING_KEY} from "@/utils/const.ts";
import {BaseState, DefaultBaseState} from "@/stores/base.ts";
import {DefaultSettingState, SettingState} from "@/stores/setting.ts";
import {cloneDeep} from "lodash-es";
import {Dict, DictType} from "@/types.ts";
import {Dict, DictResource, DictType, getDefaultDict} from "@/types.ts";
import {ArchiveReader, libarchiveWasm} from "libarchive-wasm";
import {useRouter} from "vue-router";
import {useRuntimeStore} from "@/stores/runtime.ts";
@@ -130,7 +130,7 @@ export function isMobile(): boolean {
export function getDictFile(url: string) {
return new Promise<any[]>(async resolve => {
let r = await fetch(url).catch(r => {
console.log('getDictFile_error',r)
console.log('getDictFile_error', r)
})
let v = await r.json()
resolve(v)
@@ -284,3 +284,16 @@ export function _parseLRC(lrc: string): { start: number, end: number, text: stri
return parsed;
}
export async function _getDictDataByUrl(val: DictResource) {
let dictResourceUrl = `./dicts/${val.language}/word/${val.url}`.replace('.json', '_v2.json');
let s = await getDictFile(dictResourceUrl)
let words = cloneDeep(s.map(v => {
v.id = nanoid(6)
return v
}))
return getDefaultDict({
...val,
words
})
}