Modify the phonetic field of word

This commit is contained in:
zyronon
2023-12-13 17:23:58 +08:00
parent 4179bfaf5b
commit 1a70c9af45
6 changed files with 24 additions and 23 deletions

View File

@@ -49,7 +49,7 @@ defineExpose({scrollToBottom, scrollToItem})
<template v-slot="{ item, index }">
<div class="item-title">
<span class="word" :class="!showWord && 'text-shadow'">{{ item.word }}</span>
<span class="phonetic">{{ item.usphone }}</span>
<span class="phonetic">{{ item.phonetic0 }}</span>
<VolumeIcon class="volume" @click="playWordAudio(item.name)"></VolumeIcon>
</div>
<div class="item-sub-title" v-if="item.trans.length && showTranslate">

View File

@@ -35,8 +35,8 @@ const word: Word = $computed(() => {
return data.words[data.index] ?? {
trans: [],
word: '',
usphone: '',
ukphone: '',
phonetic0: '',
phonetic1: '',
}
})

View File

@@ -300,9 +300,9 @@ enum FormMode {
}
const DefaultFormWord = {
name: '',
usphone: '',
ukphone: '',
word: '',
phonetic0: '',
phonetic1: '',
trans: '',
}
let wordForm = $ref(cloneDeep(DefaultFormWord))
@@ -314,6 +314,7 @@ const wordRules = reactive<FormRules>({
],
})
//TODO trans结构变了
async function onSubmitWord() {
await wordFormRef.validate((valid, fields) => {
if (valid) {
@@ -378,8 +379,8 @@ function editWord(word: Word, index: number, where: string) {
wordFormData.id = word.id
wordFormData.where = where
wordForm.word = word.word
wordForm.ukphone = word.ukphone
wordForm.usphone = word.usphone
wordForm.phonetic1 = word.phonetic1
wordForm.phonetic0 = word.phonetic0
wordForm.trans = word.trans.join('\n')
}
@@ -502,8 +503,8 @@ function importData(e: any) {
id: nanoid(6),
checked: false,
word: String(v['单词']),
usphone: String(v['音标①'] ?? ''),
ukphone: String(v['音标②'] ?? ''),
phonetic0: String(v['音标①'] ?? ''),
phonetic1: String(v['音标②'] ?? ''),
trans: String(v['释义(一行一个释义)'] ?? '').split('\n')
}
return word
@@ -563,7 +564,7 @@ defineExpose({getDictDetail, add: addWord, editDict})
<div class="left">
<div class="top">
<div class="title">
{{ runtimeStore.editDict.word }}
{{ runtimeStore.editDict.name }}
</div>
<template v-if="!isPinDict">
<BaseIcon icon="tabler:edit" @click='editDict'/>
@@ -705,10 +706,10 @@ defineExpose({getDictDetail, add: addWord, editDict})
type="textarea"/>
</el-form-item>
<el-form-item label="音标/发音①">
<el-input v-model="wordForm.usphone"/>
<el-input v-model="wordForm.phonetic0"/>
</el-form-item>
<el-form-item label="音标/发音②">
<el-input v-model="wordForm.ukphone"/>
<el-input v-model="wordForm.phonetic1"/>
</el-form-item>
<div class="flex-center">
<el-button @click="closeWordForm">关闭</el-button>

View File

@@ -84,8 +84,8 @@ watch(() => settingStore.dictation, () => {
function nextSentence() {
// wordData.words = [
// {"word": "pharmacy", "trans": ["药房;配药学,药剂学;制药业;一批备用药品"], "usphone": "'fɑrməsi", "ukphone": "'fɑːməsɪ"},
// // {"word": "foregone", "trans": ["过去的;先前的;预知的;预先决定的", "发生在…之前forego的过去分词"], "usphone": "'fɔrɡɔn", "ukphone": "fɔː'gɒn"}, {"word": "president", "trans": ["总统;董事长;校长;主席"], "usphone": "'prɛzɪdənt", "ukphone": "'prezɪd(ə)nt"}, {"word": "plastic", "trans": ["塑料的;(外科)造型的;可塑的", "塑料制品;整形;可塑体"], "usphone": "'plæstɪk", "ukphone": "'plæstɪk"}, {"word": "provisionally", "trans": ["临时地,暂时地"], "usphone": "", "ukphone": ""}, {"word": "incentive", "trans": ["动机;刺激", "激励的;刺激的"], "usphone": "ɪn'sɛntɪv", "ukphone": "ɪn'sentɪv"}, {"word": "calculate", "trans": ["计算;以为;作打算"], "usphone": "'kælkjulet", "ukphone": "'kælkjʊleɪt"}
// {"word": "pharmacy", "trans": ["药房;配药学,药剂学;制药业;一批备用药品"], "phonetic0": "'fɑrməsi", "phonetic1": "'fɑːməsɪ"},
// // {"word": "foregone", "trans": ["过去的;先前的;预知的;预先决定的", "发生在…之前forego的过去分词"], "phonetic0": "'fɔrɡɔn", "phonetic1": "fɔː'gɒn"}, {"word": "president", "trans": ["总统;董事长;校长;主席"], "phonetic0": "'prɛzɪdənt", "phonetic1": "'prezɪd(ə)nt"}, {"word": "plastic", "trans": ["塑料的;(外科)造型的;可塑的", "塑料制品;整形;可塑体"], "phonetic0": "'plæstɪk", "phonetic1": "'plæstɪk"}, {"word": "provisionally", "trans": ["临时地,暂时地"], "phonetic0": "", "phonetic1": ""}, {"word": "incentive", "trans": ["动机;刺激", "激励的;刺激的"], "phonetic0": "ɪn'sɛntɪv", "phonetic1": "ɪn'sentɪv"}, {"word": "calculate", "trans": ["计算;以为;作打算"], "phonetic0": "'kælkjulet", "phonetic1": "'kælkjʊleɪt"}
// ]
// return

View File

@@ -198,8 +198,8 @@ defineExpose({del, showWord, hideWord, play})
<VolumeIcon ref="volumeIconRef" :simple="true" :cb="() => playWordAudio(word.word)"/>
</Tooltip>
</div>
<div class="phonetic" v-if="settingStore.wordSoundType === 'us' && word.usphone">[{{ word.usphone}}]</div>
<div class="phonetic" v-if="settingStore.wordSoundType === 'uk' && word.ukphone">[{{ word.ukphone }}]</div>
<div class="phonetic" v-if="settingStore.wordSoundType === 'us' && word.phonetic0">[{{ word.phonetic0 }}]</div>
<div class="phonetic" v-if="settingStore.wordSoundType === 'uk' && word.phonetic1">[{{ word.phonetic1 }}]</div>
</div>
</template>

View File

@@ -6,8 +6,8 @@ import {DefaultChapterWordNumber} from "@/stores/setting.ts";
export type Word = {
"word": string,
"usphone": string,
"ukphone": string,
"phonetic0": string,
"phonetic1": string,
"trans": string[]
checked?: boolean,
id?: any,
@@ -15,8 +15,8 @@ export type Word = {
export const DefaultWord: Word = {
word: '',
usphone: '',
ukphone: '',
phonetic0: '',
phonetic1: '',
trans: []
}
@@ -49,8 +49,8 @@ export enum DictType {
export const DefaultArticleWord: ArticleWord = {
word: '',
usphone: '',
ukphone: '',
phonetic0: '',
phonetic1: '',
trans: [],
nextSpace: true,
isSymbol: false,