update
This commit is contained in:
1 parent
7d5114953b
commit
cbc36d19f5
7 files changed
+215
-194
No files matched your search
@@ -332,7 +332,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Ref } from 'vue-property-decorator'
|
||||
import { api, IEntry, IQuiz } from '~/assets/api'
|
||||
import { api, IDictionaryLookup, IQuiz } from '~/assets/api'
|
||||
import { shuffle } from '~/assets/util'
|
||||
import ContextMenu from '../ContextMenu.vue'
|
||||
|
||||
@@ -358,17 +358,17 @@ export default class QuizCard extends Vue {
|
||||
} = {}
|
||||
|
||||
dictionaryData = {
|
||||
character: {} as Record<string, IEntry>,
|
||||
character: {} as Record<string, IDictionaryLookup>,
|
||||
vocabulary: {} as Record<
|
||||
string,
|
||||
IEntry & {
|
||||
sentence_set: Record<string, boolean>
|
||||
IDictionaryLookup & {
|
||||
sentence_set: string[]
|
||||
}
|
||||
>,
|
||||
sentence: {} as Record<
|
||||
string,
|
||||
IEntry & {
|
||||
vocabulary_set: Record<string, boolean>
|
||||
IDictionaryLookup & {
|
||||
vocabulary_set: string[]
|
||||
}
|
||||
>,
|
||||
}
|
||||
@@ -572,7 +572,7 @@ export default class QuizCard extends Vue {
|
||||
|
||||
this.dictionaryData[subtype][r.list[0]!] = {
|
||||
...r,
|
||||
sentence_set: {},
|
||||
sentence_set: [],
|
||||
}
|
||||
})
|
||||
|
||||
@@ -595,7 +595,7 @@ export default class QuizCard extends Vue {
|
||||
|
||||
this.dictionaryData[subtype][r.list[0]!] = {
|
||||
...r,
|
||||
vocabulary_set: {},
|
||||
vocabulary_set: [],
|
||||
}
|
||||
})
|
||||
|
||||
@@ -614,23 +614,18 @@ export default class QuizCard extends Vue {
|
||||
const subtype = 'sentence'
|
||||
|
||||
const { result } = await api.vocabulary_getSentence({ entry })
|
||||
result.map((r) => {
|
||||
this.dictionaryData[type][entry]!.sentence_set = result.map((r) => {
|
||||
if (this.dictionaryData[subtype][r.list[0]!]) {
|
||||
return
|
||||
return r.id
|
||||
}
|
||||
|
||||
this.dictionaryData[subtype][r.list[0]!] = {
|
||||
...r,
|
||||
vocabulary_set: {},
|
||||
vocabulary_set: [],
|
||||
}
|
||||
|
||||
return r.id
|
||||
})
|
||||
this.dictionaryData[type][entry]!.sentence_set = result.reduce(
|
||||
(prev, c) => ({
|
||||
...prev,
|
||||
[c.list[0]!]: true,
|
||||
}),
|
||||
{} as Record<string, boolean>
|
||||
)
|
||||
|
||||
this.$set(this.dictionaryData, type, this.dictionaryData[type])
|
||||
this.$set(this.dictionaryData, subtype, this.dictionaryData[subtype])
|
||||
@@ -660,7 +655,7 @@ export default class QuizCard extends Vue {
|
||||
|
||||
this.dictionaryData[subtype][entry] = {
|
||||
...r!,
|
||||
sentence_set: {},
|
||||
sentence_set: [],
|
||||
}
|
||||
this.$set(
|
||||
this.dictionaryData,
|
||||
|
||||
Reference in new issue
Block a user