设计数据结构
This commit is contained in:
205
src/types.ts
205
src/types.ts
@@ -1,22 +1,22 @@
|
||||
export type Config = {
|
||||
newWords: Word[],
|
||||
skipWords: Word[],
|
||||
skipWordNames: string[],
|
||||
dict: string,
|
||||
currentDict: {
|
||||
wordList: Word[],
|
||||
chapterList: Word[][],
|
||||
name: string,
|
||||
desc: string
|
||||
}
|
||||
chapterIndex: number,
|
||||
wordIndex: number,
|
||||
newWords: Word[],
|
||||
skipWords: Word[],
|
||||
skipWordNames: string[],
|
||||
dict: string,
|
||||
currentDict: {
|
||||
wordList: Word[],
|
||||
chapterList: Word[][],
|
||||
name: string,
|
||||
desc: string
|
||||
}
|
||||
chapterIndex: number,
|
||||
wordIndex: number,
|
||||
}
|
||||
export type Word = {
|
||||
"name": string,
|
||||
"usphone": string,
|
||||
"ukphone": string,
|
||||
"trans": string[]
|
||||
"name": string,
|
||||
"usphone": string,
|
||||
"ukphone": string,
|
||||
"trans": string[]
|
||||
}
|
||||
|
||||
export const SaveKey = 'bb-word-config'
|
||||
@@ -30,122 +30,121 @@ export type LanguageCategoryType = 'en' | 'ja' | 'de' | 'code'
|
||||
|
||||
|
||||
export type DictionaryResource = {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
category: string
|
||||
tags: string[]
|
||||
url: string
|
||||
length: number
|
||||
language: LanguageType
|
||||
languageCategory: LanguageCategoryType
|
||||
//override default pronunciation when not undefined
|
||||
defaultPronIndex?: number
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
category: string
|
||||
tags: string[]
|
||||
url: string
|
||||
length: number
|
||||
language: LanguageType
|
||||
languageCategory: LanguageCategoryType
|
||||
//override default pronunciation when not undefined
|
||||
defaultPronIndex?: number
|
||||
}
|
||||
|
||||
export type Dictionary = {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
category: string
|
||||
tags: string[]
|
||||
url: string
|
||||
length: number
|
||||
language: LanguageType
|
||||
languageCategory: LanguageCategoryType
|
||||
// calculated in the store
|
||||
chapterCount: number
|
||||
//override default pronunciation when not undefined
|
||||
defaultPronIndex?: number
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
category: string
|
||||
tags: string[]
|
||||
url: string
|
||||
length: number
|
||||
language: LanguageType
|
||||
languageCategory: LanguageCategoryType
|
||||
// calculated in the store
|
||||
chapterCount: number
|
||||
//override default pronunciation when not undefined
|
||||
defaultPronIndex?: number
|
||||
}
|
||||
|
||||
export type PronunciationConfig = {
|
||||
name: string
|
||||
pron: PronunciationType
|
||||
name: string
|
||||
pron: PronunciationType
|
||||
}
|
||||
|
||||
export type LanguagePronunciationMapConfig = {
|
||||
defaultPronIndex: number
|
||||
pronunciation: PronunciationConfig[]
|
||||
defaultPronIndex: number
|
||||
pronunciation: PronunciationConfig[]
|
||||
}
|
||||
|
||||
export type LanguagePronunciationMap = {
|
||||
[key in LanguageType]: LanguagePronunciationMapConfig
|
||||
[key in LanguageType]: LanguagePronunciationMapConfig
|
||||
}
|
||||
|
||||
export type SoundResource = {
|
||||
key: string
|
||||
name: string
|
||||
filename: string
|
||||
key: string
|
||||
name: string
|
||||
filename: string
|
||||
}
|
||||
|
||||
|
||||
export interface DictJson {
|
||||
name: string,
|
||||
description: string,
|
||||
category: string,
|
||||
tags: string[],
|
||||
url: string,
|
||||
length: number,
|
||||
language: string,
|
||||
languageCategory: string,
|
||||
name: string,
|
||||
description: string,
|
||||
category: string,
|
||||
tags: string[],
|
||||
url: string,
|
||||
length: number,
|
||||
language: string,
|
||||
languageCategory: string,
|
||||
}
|
||||
|
||||
export enum DictType {
|
||||
newWordDict = 'newWordDict',
|
||||
skipWordDict = 'skipWordDict',
|
||||
inner = 'inner',
|
||||
custom = 'custom',
|
||||
newWordDict = 'newWordDict',
|
||||
skipWordDict = 'skipWordDict',
|
||||
inner = 'inner',
|
||||
custom = 'custom',
|
||||
}
|
||||
|
||||
export interface Dict extends DictJson {
|
||||
type: DictType,
|
||||
wordList: Word[],
|
||||
chapterList: Word[][],
|
||||
chapterIndex: number,
|
||||
wordIndex: number,
|
||||
type: DictType,
|
||||
wordList: Word[],
|
||||
chapterList: Word[][],
|
||||
chapterIndex: number,
|
||||
wordIndex: number,
|
||||
}
|
||||
|
||||
interface DictLog {
|
||||
startDate: number,//开始日期
|
||||
endDate: number//结束日期
|
||||
chapterWordNumber: number//章节单词数量
|
||||
chapterLog: {
|
||||
startDate: number,//开始日期
|
||||
endDate: number//结束日期
|
||||
correctRate: number//正确率
|
||||
}
|
||||
startDate: number,//开始日期
|
||||
endDate: number//结束日期
|
||||
chapterWordNumber: number//章节单词数量
|
||||
statistics: Array<ChapterStatistics>
|
||||
}
|
||||
|
||||
interface ChapterStatistics {
|
||||
startDate: number,//开始日期
|
||||
endDate: number//结束日期
|
||||
correctRate: number//正确率
|
||||
correctNumber: number//正确数
|
||||
}
|
||||
|
||||
export interface State {
|
||||
newWordDict: {
|
||||
type: DictType,
|
||||
wordList: Word[],
|
||||
chapterList: Word[][],
|
||||
chapterIndex: number,
|
||||
wordIndex: number,
|
||||
},
|
||||
skipWordDict: {
|
||||
type: DictType,
|
||||
wordList: Word[],
|
||||
chapterList: Word[][],
|
||||
chapterIndex: number,
|
||||
wordIndex: number,
|
||||
},
|
||||
dict: Dict,
|
||||
currentDictType: {
|
||||
name: DictType,
|
||||
dictUrl: string
|
||||
}
|
||||
sideIsOpen: boolean,
|
||||
dictModalIsOpen: boolean,
|
||||
dictModalIsOpen2: boolean,
|
||||
setting: {
|
||||
showToolbar: boolean,
|
||||
show: boolean,
|
||||
value1: boolean,
|
||||
value2: number,
|
||||
value3: number,
|
||||
value4: boolean,
|
||||
}
|
||||
newWordDict: {
|
||||
wordList: Word[],
|
||||
wordIndex: number,
|
||||
statistics: Array<ChapterStatistics>
|
||||
},
|
||||
skipWordDict: {
|
||||
wordList: Word[],
|
||||
wordIndex: number,
|
||||
statistics: Array<ChapterStatistics>
|
||||
},
|
||||
dict: Dict,
|
||||
currentDictType: {
|
||||
name: DictType,
|
||||
dictUrl: string
|
||||
}
|
||||
sideIsOpen: boolean,
|
||||
dictModalIsOpen: boolean,
|
||||
dictModalIsOpen2: boolean,
|
||||
setting: {
|
||||
showToolbar: boolean,
|
||||
show: boolean,
|
||||
value1: boolean,
|
||||
value2: number,
|
||||
value3: number,
|
||||
value4: boolean,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user