From f1143b2ffecbd5553f87f427b51094115f2b54b6 Mon Sep 17 00:00:00 2001 From: LuSrackhall <3647637206@qq.com> Date: Wed, 13 Nov 2024 09:32:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ui):=20=E5=AF=B9=E6=96=B0=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E4=B8=8B,=20=E5=88=B6=E4=BD=9C=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=8C=89=E9=94=AE=E9=9F=B3=20=E6=97=B6,=20=E6=8C=89=E4=B8=8B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20=E4=BB=A5=E5=8F=8A=20=E6=8A=AC=E8=B5=B7?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20=E4=B8=AD=E7=9A=84=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=A3=B0=E9=9F=B3=E6=A1=86=E6=89=80=E4=BE=9D=E8=B5=96=E7=9A=84?= =?UTF-8?q?=20options,=20=E5=AF=B9=E8=B1=A1=E4=B8=AD=E5=AD=97=E6=AE=B5,=20?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E9=87=8D=E6=9E=84=E3=80=82=20=E5=B0=86key?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=94=B9=E5=90=8D=E4=B8=BAtype=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit #39、commit #36 --- .../Create_keytone_pkg.vue | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/frontend/src/pages/KeytonePkgPageChildren/Create_keytone_pkg.vue b/frontend/src/pages/KeytonePkgPageChildren/Create_keytone_pkg.vue index 67ba614..56e80bc 100644 --- a/frontend/src/pages/KeytonePkgPageChildren/Create_keytone_pkg.vue +++ b/frontend/src/pages/KeytonePkgPageChildren/Create_keytone_pkg.vue @@ -829,15 +829,15 @@ v-model="selectedSoundsForDown" :options="downSoundList" :option-label="(item: any) => { - if (item.key === 'audio_files') { - return (options.find((option) => item.key === option.value)?.label ) + '  §   ' + (item?.value?.name + item?.value?.type); + if (item.type === 'audio_files') { + return (options.find((option) => item.type === option.value)?.label ) + '  §   ' + (item?.value?.name + item?.value?.type); } - if (item.key === 'sounds') { + if (item.type === 'sounds') { // 此处的item可以是any , 但其soundList的源类型, 必须是指定准确, 否则此处会发生意外报错, 且无法定位 if (item.value.soundValue?.name !== '' && item.value.soundValue?.name !== undefined) { - return item.value.soundValue.name; + return (options.find((option) => item.type === option.value)?.label ) + '      §   ' + (item.value.soundValue.name) } else { - return (options.find((option) => item.key === option.value)?.label ) + '      §   ' + ( + return (options.find((option) => item.type === option.value)?.label ) + '      §   ' + ( soundFileList.find( (soundFile:any) => soundFile.sha256 === item.value.soundValue?.source_file_for_sound?.sha256 && @@ -852,8 +852,8 @@ ); } } - if (item.key === 'key_sounds') { - return (options.find((option) => item.key === option.value)?.label ) + '  §   ' + (item.value.keySoundValue?.name); + if (item.type === 'key_sounds') { + return (options.find((option) => item.type === option.value)?.label ) + '  §   ' + (item.value.keySoundValue?.name); } }" label="选择声音 (多选)" @@ -983,15 +983,15 @@ v-model="selectedSoundsForUp" :options="upSoundList" :option-label="(item: any) => { - if (item.key === 'audio_files') { - return (options.find((option) => item.key === option.value)?.label ) + '  §   ' + (item?.value?.name + item?.value?.type); + if (item.type === 'audio_files') { + return (options.find((option) => item.type === option.value)?.label ) + '  §   ' + (item?.value?.name + item?.value?.type); } - if (item.key === 'sounds') { + if (item.type === 'sounds') { // 此处的item可以是any , 但其soundList的源类型, 必须是指定准确, 否则此处会发生意外报错, 且无法定位 if (item.value.soundValue?.name !== '' && item.value.soundValue?.name !== undefined) { - return item.value.soundValue.name; + return (options.find((option) => item.type === option.value)?.label ) + '      §   '+ (item.value.soundValue.name) } else { - return (options.find((option) => item.key === option.value)?.label ) + '      §   ' + ( + return (options.find((option) => item.type === option.value)?.label ) + '      §   ' + ( soundFileList.find( (soundFile:any) => soundFile.sha256 === item.value.soundValue?.source_file_for_sound?.sha256 && @@ -1006,8 +1006,8 @@ ); } } - if (item.key === 'key_sounds') { - return (options.find((option) => item.key === option.value)?.label ) + '  §   ' + (item.value.keySoundValue?.name); + if (item.type === 'key_sounds') { + return (options.find((option) => item.type === option.value)?.label ) + '  §   ' + (item.value.keySoundValue?.name); } }" label="选择声音 (多选)" @@ -1696,17 +1696,17 @@ const downSoundList = computed(() => { const List: Array = []; if (downTypeGroup.value.includes('audio_files')) { soundFileList.value.forEach((item) => { - List.push({ key: 'audio_files', value: item }); + List.push({ type: 'audio_files', value: item }); }); } if (downTypeGroup.value.includes('sounds')) { soundList.value.forEach((item) => { - List.push({ key: 'sounds', value: item }); + List.push({ type: 'sounds', value: item }); }); } if (downTypeGroup.value.includes('key_sounds')) { keySoundList.value.forEach((item) => { - List.push({ key: 'key_sounds', value: item }); + List.push({ type: 'key_sounds', value: item }); }); } console.log('List=', List); @@ -1727,17 +1727,17 @@ const upSoundList = computed(() => { const List: Array = []; if (upTypeGroup.value.includes('audio_files')) { soundFileList.value.forEach((item) => { - List.push({ key: 'audio_files', value: item }); + List.push({ type: 'audio_files', value: item }); }); } if (upTypeGroup.value.includes('sounds')) { soundList.value.forEach((item) => { - List.push({ key: 'sounds', value: item }); + List.push({ type: 'sounds', value: item }); }); } if (upTypeGroup.value.includes('key_sounds')) { keySoundList.value.forEach((item) => { - List.push({ key: 'key_sounds', value: item }); + List.push({ type: 'key_sounds', value: item }); }); } return List;