import '../models/vocabulary_book_model.dart'; import '../models/vocabulary_book_category.dart'; /// 词汇书数据服务 class VocabularyDataService { /// 获取模拟的词汇书数据(根据分类) static List getVocabularyBooksByCategory(VocabularyBookMainCategory category) { final baseTime = DateTime.now(); switch (category) { case VocabularyBookMainCategory.academicStage: return [ _createVocabularyBook( id: 'primary_core_1000', name: '小学英语核心词汇', description: '小学阶段必备的1000个核心词汇,涵盖日常生活场景', totalWords: 1000, tags: ['小学', '基础', '日常用语'], difficulty: VocabularyBookDifficulty.beginner, category: category, ), _createVocabularyBook( id: 'junior_high_1500', name: '初中英语词汇', description: '初中阶段1500-2500词汇,结合教材要求', totalWords: 1500, tags: ['初中', '教材', '基础'], difficulty: VocabularyBookDifficulty.beginner, category: category, ), _createVocabularyBook( id: 'senior_high_3500', name: '高中英语词汇', description: '高中阶段2500-3500词汇,涵盖课标与高考高频词', totalWords: 3500, tags: ['高中', '高考', '课标'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'college_textbook', name: '大学英语教材词汇', description: '大学英语精读/泛读配套词汇', totalWords: 2000, tags: ['大学', '教材', '精读'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), ]; case VocabularyBookMainCategory.domesticTest: return [ _createVocabularyBook( id: 'cet4_vocabulary', name: '大学四级词汇(CET-4)', description: '大学英语四级考试核心词汇', totalWords: 4500, tags: ['四级', 'CET-4', '考试'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'cet6_vocabulary', name: '大学六级词汇(CET-6)', description: '大学英语六级考试核心词汇', totalWords: 5500, tags: ['六级', 'CET-6', '考试'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'postgraduate_vocabulary', name: '考研英语核心词汇', description: '考研英语必备核心词汇', totalWords: 5500, tags: ['考研', '研究生', '核心词汇'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'tem4_vocabulary', name: '专四词汇(TEM-4)', description: '英语专业四级考试词汇', totalWords: 8000, tags: ['专四', 'TEM-4', '英语专业'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'tem8_vocabulary', name: '专八词汇(TEM-8)', description: '英语专业八级考试词汇', totalWords: 12000, tags: ['专八', 'TEM-8', '英语专业'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), ]; case VocabularyBookMainCategory.internationalTest: return [ _createVocabularyBook( id: 'ielts_academic', name: '雅思学术词汇(IELTS Academic)', description: '雅思学术类考试核心词汇', totalWords: 8000, tags: ['雅思', 'IELTS', '学术类'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'ielts_general', name: '雅思通用词汇(IELTS General)', description: '雅思通用类考试核心词汇', totalWords: 6000, tags: ['雅思', 'IELTS', '通用类'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'toefl_ibt', name: '托福词汇(TOEFL iBT)', description: '托福网考核心词汇', totalWords: 10000, tags: ['托福', 'TOEFL', 'iBT'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'toeic_vocabulary', name: '托业词汇(TOEIC)', description: '托业考试职场应用词汇', totalWords: 6000, tags: ['托业', 'TOEIC', '职场'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'gre_vocabulary', name: 'GRE词汇', description: 'GRE学术/研究生申请词汇', totalWords: 15000, tags: ['GRE', '研究生', '学术'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'gmat_vocabulary', name: 'GMAT词汇', description: 'GMAT商科/管理类研究生词汇', totalWords: 8000, tags: ['GMAT', '商科', '管理'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'sat_vocabulary', name: 'SAT词汇', description: 'SAT美本申请词汇', totalWords: 5000, tags: ['SAT', '美本', '申请'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), ]; case VocabularyBookMainCategory.professional: return [ _createVocabularyBook( id: 'bec_preliminary', name: '商务英语初级(BEC Preliminary)', description: 'BEC初级商务英语词汇', totalWords: 3000, tags: ['BEC', '商务', '初级'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'bec_vantage', name: '商务英语中级(BEC Vantage)', description: 'BEC中级商务英语词汇', totalWords: 4000, tags: ['BEC', '商务', '中级'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'bec_higher', name: '商务英语高级(BEC Higher)', description: 'BEC高级商务英语词汇', totalWords: 5000, tags: ['BEC', '商务', '高级'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'mba_finance', name: 'MBA/金融词汇', description: 'MBA、金融、会计、经济学专业词汇', totalWords: 6000, tags: ['MBA', '金融', '会计'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'medical_english', name: '医学英语词汇', description: '医学专业英语词汇', totalWords: 8000, tags: ['医学', '专业', '医疗'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'legal_english', name: '法律英语词汇', description: '法律专业英语词汇', totalWords: 5000, tags: ['法律', '专业', '司法'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'it_engineering', name: '工程与IT英语', description: '计算机科学、人工智能、软件工程词汇', totalWords: 4000, tags: ['IT', '工程', '计算机'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'academic_english', name: '学术英语(EAP)', description: '学术英语写作/阅读/科研常用词汇', totalWords: 6000, tags: ['学术', 'EAP', '科研'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), ]; case VocabularyBookMainCategory.functional: return [ _createVocabularyBook( id: 'word_roots_affixes', name: '词根词缀词汇', description: '帮助记忆与扩展的词根词缀词汇', totalWords: 3000, tags: ['词根', '词缀', '记忆'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'synonyms_antonyms', name: '同义词/反义词库', description: '同义词、反义词、近义搭配库', totalWords: 2500, tags: ['同义词', '反义词', '搭配'], difficulty: VocabularyBookDifficulty.intermediate, category: category, ), _createVocabularyBook( id: 'daily_spoken_collocations', name: '日常口语搭配库', description: '日常口语常用搭配库', totalWords: 1500, tags: ['口语', '搭配', '日常'], difficulty: VocabularyBookDifficulty.beginner, category: category, ), _createVocabularyBook( id: 'academic_spoken_collocations', name: '学术口语搭配库', description: '学术口语常用搭配库', totalWords: 2000, tags: ['学术', '口语', '搭配'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'academic_writing_collocations', name: '学术写作搭配库', description: '学术写作常用搭配库(Collocations)', totalWords: 2500, tags: ['学术', '写作', '搭配'], difficulty: VocabularyBookDifficulty.advanced, category: category, ), _createVocabularyBook( id: 'daily_life_english', name: '日常生活英语', description: '旅游、点餐、购物、出行、租房等日常生活英语', totalWords: 2000, tags: ['日常', '生活', '实用'], difficulty: VocabularyBookDifficulty.beginner, category: category, ), ]; } } /// 创建词汇书的辅助方法 static VocabularyBook _createVocabularyBook({ required String id, required String name, required String description, required int totalWords, required List tags, required VocabularyBookDifficulty difficulty, required VocabularyBookMainCategory category, }) { final coverImages = [ 'https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=300', 'https://images.unsplash.com/photo-1481627834876-b7833e8f5570?w=300', 'https://images.unsplash.com/photo-1434030216411-0b793f4b4173?w=300', 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=300', 'https://images.unsplash.com/photo-1456513080510-7bf3a84b82f8?w=300', ]; return VocabularyBook( id: id, name: name, description: description, type: VocabularyBookType.system, difficulty: difficulty, coverImageUrl: coverImages[id.hashCode % coverImages.length], totalWords: totalWords, isPublic: true, tags: tags, mainCategory: category, targetLevels: _getTargetLevels(category), estimatedDays: (totalWords / 20).ceil(), dailyWordCount: 20, downloadCount: (totalWords * 0.3).round(), rating: 4.2 + (id.hashCode % 8) * 0.1, reviewCount: 50 + (id.hashCode % 200), createdAt: DateTime.now(), updatedAt: DateTime.now(), ); } /// 根据分类获取目标等级 static List _getTargetLevels(VocabularyBookMainCategory category) { switch (category) { case VocabularyBookMainCategory.academicStage: return ['小学', '初中', '高中', '大学']; case VocabularyBookMainCategory.domesticTest: return ['大学', '研究生']; case VocabularyBookMainCategory.internationalTest: return ['大学', '研究生', '出国']; case VocabularyBookMainCategory.professional: return ['职场', '专业']; case VocabularyBookMainCategory.functional: return ['通用']; } } /// 获取推荐词汇书(首页显示) static List getRecommendedVocabularyBooks() { final recommended = []; for (final category in VocabularyBookMainCategory.values) { final categoryBooks = getVocabularyBooksByCategory(category).take(2); recommended.addAll(categoryBooks); } return recommended; } }