change audio file name

This commit is contained in:
zyronon
2023-12-05 01:05:27 +08:00
parent 71b467b814
commit 4e674fdd27
15 changed files with 294 additions and 305 deletions

View File

@@ -43,7 +43,7 @@ const groupByTranslateLanguage = $computed(() => {
data = groupBy(articleList, 'translateLanguage')
} else if (currentLanguage === 'my') {
data = {
common: store.myDictList.concat([{name: '',} as any])
common: store.myDictList.concat([{id: '',} as any])
}
} else {
data = groupBy(groupByLanguage[currentLanguage], 'translateLanguage')
@@ -87,6 +87,7 @@ const groupedByCategoryAndTag = $computed(() => {
<DictList
@add="emit('add')"
@selectDict="e => emit('selectDict',e)"
:select-id="store.currentDict.id"
:list="groupByTranslateLanguage['common']"/>
</template>
<template v-else>
@@ -98,7 +99,7 @@ const groupedByCategoryAndTag = $computed(() => {
</div>
<DictGroup
v-for="item in groupedByCategoryAndTag"
:select-dict-name="runtimeStore.editDict.resourceId"
:select-id="store.currentDict.id"
@selectDict="e => emit('selectDict',e)"
:groupByTag="item[1]"
:category="item[0]"

View File

@@ -35,6 +35,7 @@ let loading = $ref(false)
let show = $ref(false)
let chapterList2 = $ref([])
let chapterWordNumber = $ref(0)
let toggleLoading = $ref(false)
const activeId = $computed(() => {
if (dictIsArticle) {
@@ -104,18 +105,15 @@ function close() {
}
function changeDict() {
store.changeDict(runtimeStore.editDict)
close()
store.changeDict(runtimeStore.editDict)
ElMessage.success('切换成功')
}
const dictIsArticle = $computed(() => {
return isArticle(runtimeStore.editDict.type)
})
const chapterList = $computed(() => {
return dictIsArticle ? runtimeStore.editDict.articles.length : runtimeStore.editDict.chapterWords.length
})
function showAllWordModal() {
emitter.emit(EventKey.openWordListModal, {
title: runtimeStore.editDict.name,
@@ -124,7 +122,7 @@ function showAllWordModal() {
})
}
function resetChapterList(v:number) {
function resetChapterList(v: number) {
const temp = () => {
runtimeStore.editDict.chapterWordNumber = v
runtimeStore.editDict.chapterWords = chunk(runtimeStore.editDict.words, runtimeStore.editDict.chapterWordNumber)
@@ -144,7 +142,7 @@ function resetChapterList(v:number) {
}
}
function changeSort(v, notice: boolean = true) {
function changeSort(v: Sort, notice: boolean = true) {
const temp = () => {
runtimeStore.editDict.sort = v
if (v === Sort.normal) {
@@ -175,16 +173,6 @@ function option(type: string) {
}, 500)
}
/**/
/* 单词修改相关*/
/**/
watch(() => step, v => {
if (v === 0) {
}
})
onMounted(() => {
emitter.on(EventKey.openDictModal, (type: 'detail' | 'list' | 'my') => {
if (type === "detail") {
@@ -202,14 +190,6 @@ onMounted(() => {
})
})
function addDict() {
show = false
setTimeout(() => {
router.push({path: '/dict', query: {type: 'addDict'}})
}, 500)
}
function showWordListModal(val: { item: Word, index: number }) {
emitter.emit(EventKey.openWordListModal, {
title: `${val.index + 1}`,
@@ -218,7 +198,7 @@ function showWordListModal(val: { item: Word, index: number }) {
})
}
function handleChangeArticleChapterIndex(val) {
function handleChangeArticleChapterIndex(val: any) {
let rIndex = runtimeStore.editDict.articles.findIndex(v => v.id === val.item.id)
if (rIndex > -1) {
runtimeStore.editDict.chapterIndex = rIndex
@@ -235,7 +215,7 @@ function handleChangeArticleChapterIndex(val) {
<div id="DictDialog">
<Slide :slide-count="2" :step="step">
<DictListPanel
@add="addDict"
@add="option('addDict')"
@select-dict="selectDict"
/>
<div class="dict-detail-page">
@@ -425,7 +405,7 @@ function handleChangeArticleChapterIndex(val) {
<div class="footer">
<!-- <BaseButton @click="step = 0">导出</BaseButton>-->
<BaseButton @click="close">关闭</BaseButton>
<BaseButton @click="changeDict">切换</BaseButton>
<BaseButton :loading="toggleLoading" @click="changeDict">切换</BaseButton>
</div>
</div>
</div>

View File

@@ -6,6 +6,7 @@ import {onMounted, onUnmounted, watch} from "vue";
import {emitter, EventKey} from "@/utils/eventBus.ts";
import {useRuntimeStore} from "@/stores/runtime.ts";
import WordList from "@/components/list/WordList.vue";
import Empty from "@/components/Empty.vue";
let show = $ref(false)
let loading = $ref(false)
@@ -78,9 +79,11 @@ onUnmounted(() => {
:show-text="false"/>
</div>
<WordList
v-if="list.length"
class="word-list"
:list="list">
</WordList>
<Empty v-else/>
</div>
</Dialog>
</template>

View File

@@ -8,7 +8,7 @@ import DictList from "@/components/list/DictList.vue";
const props = defineProps<{
category: string,
groupByTag: any,
selectDictName: string
selectId: string
}>()
const emit = defineEmits<{
selectDict: [val: { dict: DictResource, index: number }]
@@ -37,7 +37,8 @@ watch(() => props.groupByTag, () => {
</div>
<DictList
@selectDict="e => emit('selectDict',e)"
:list="list" :select-dict-name="selectDictName"/>
:list="list"
:select-id="selectId"/>
</div>
</template>

View File

@@ -20,7 +20,7 @@ const emit = defineEmits<{
class="dict-item anim"
:class="active && 'active'"
>
<template v-if="dict.name">
<template v-if="dict.id">
<div class="top">
<div class="name">{{ dict.name }}</div>
<div class="desc">{{ dict.description }}</div>

View File

@@ -5,7 +5,7 @@ import DictItem from "@/components/list/DictItem.vue";
defineProps<{
list?: Dict[],
selectDictName?: string
selectId?: string
}>()
const emit = defineEmits<{
@@ -19,6 +19,7 @@ const emit = defineEmits<{
<template>
<div class="dict-list">
<DictItem v-for="(dict,index) in list"
:active="selectId === dict.id"
@click="emit('selectDict',{dict,index})"
@add="emit('add')"
:dict="dict"/>

View File

@@ -10,7 +10,6 @@ import {useSettingStore} from "@/stores/setting.ts";
import VolumeIcon from "@/components/icon/VolumeIcon.vue";
import {getAudioFileUrl, useChangeAllSound, usePlayAudio, useWatchAllSound} from "@/hooks/sound.ts";
import {SoundFileOptions} from "@/utils/const.ts";
import {throttle} from "lodash-es";
const settingStore = useSettingStore()