添加创建同名列表时的二次确认(#1621)

pull/1773/head
lyswhut 2024-01-29 13:23:55 +08:00
parent f13c6f0153
commit 431b04a011
7 changed files with 18 additions and 5 deletions

View File

@ -24,6 +24,7 @@
- 改进本地音乐在线信息的匹配机制 - 改进本地音乐在线信息的匹配机制
- 优化任务下载状态显示,现在下载时若数据传输完成但数据写入未完成时会显示相应的状态 - 优化任务下载状态显示,现在下载时若数据传输完成但数据写入未完成时会显示相应的状态
- 添加对下载歌曲时封面图片大小的控制处理(#1609 - 添加对下载歌曲时封面图片大小的控制处理(#1609
- 添加创建同名列表时的二次确认(#1621
### 修复 ### 修复

View File

@ -119,6 +119,7 @@
"list_add__title_first_add": "Add", "list_add__title_first_add": "Add",
"list_add__title_first_move": "Move", "list_add__title_first_move": "Move",
"list_add__title_last": "to...", "list_add__title_last": "to...",
"list_duplicate_tip": "A list with the same name already exists. Do you want to continue creating it?",
"list_import_tip__alldata": "Import failed, this is an all data backup file, you need to go here to import: \nSettings -> Backup and Restore -> All Data -> Import", "list_import_tip__alldata": "Import failed, this is an all data backup file, you need to go here to import: \nSettings -> Backup and Restore -> All Data -> Import",
"list_import_tip__playlist": "Import failed, this is a list backup file, you need to go here to import: \nSettings -> Backup and Restore -> Import List", "list_import_tip__playlist": "Import failed, this is a list backup file, you need to go here to import: \nSettings -> Backup and Restore -> Import List",
"list_import_tip__playlist_part": "The import failed, this is a single-list file, you need to go here to import: \nMy List -> Right-click on any list name -> Select Import in the pop-up menu", "list_import_tip__playlist_part": "The import failed, this is a single-list file, you need to go here to import: \nMy List -> Right-click on any list name -> Select Import in the pop-up menu",

View File

@ -119,6 +119,7 @@
"list_add__title_first_add": "添加", "list_add__title_first_add": "添加",
"list_add__title_first_move": "移动", "list_add__title_first_move": "移动",
"list_add__title_last": "到...", "list_add__title_last": "到...",
"list_duplicate_tip": "已存在同名列表,是否仍要继续创建?",
"list_import_tip__alldata": "导入失败,这是一个所有数据备份文件,你需要去这里导入:\n设置 -> 备份与恢复 -> 所有数据 -> 导入", "list_import_tip__alldata": "导入失败,这是一个所有数据备份文件,你需要去这里导入:\n设置 -> 备份与恢复 -> 所有数据 -> 导入",
"list_import_tip__playlist": "导入失败,这是一个列表备份文件,你需要去这里导入:\n设置 -> 备份与恢复 -> 部分数据 -> 导入列表", "list_import_tip__playlist": "导入失败,这是一个列表备份文件,你需要去这里导入:\n设置 -> 备份与恢复 -> 部分数据 -> 导入列表",
"list_import_tip__playlist_part": "导入失败,这是一个单列表文件,你需要去这里导入:\n我的列表 -> 右击任意一个列表名 -> 在弹出的菜单中选择导入", "list_import_tip__playlist_part": "导入失败,这是一个单列表文件,你需要去这里导入:\n我的列表 -> 右击任意一个列表名 -> 在弹出的菜单中选择导入",

View File

@ -119,6 +119,7 @@
"list_add__title_first_add": "添加", "list_add__title_first_add": "添加",
"list_add__title_first_move": "移動", "list_add__title_first_move": "移動",
"list_add__title_last": "到...", "list_add__title_last": "到...",
"list_duplicate_tip": "已存在同名列表,是否仍要繼續建立?",
"list_import_tip__alldata": "導入失敗,這是一個所有資料備份文件,你需要去這裡導入:\n設定 -> 備份與還原 -> 所有資料 -> 匯入", "list_import_tip__alldata": "導入失敗,這是一個所有資料備份文件,你需要去這裡導入:\n設定 -> 備份與還原 -> 所有資料 -> 匯入",
"list_import_tip__playlist": "導入失敗,這是一個列表備份文件,你需要去這裡導入:\n設定 -> 備份與還原 -> 部分資料 -> 匯入列表", "list_import_tip__playlist": "導入失敗,這是一個列表備份文件,你需要去這裡導入:\n設定 -> 備份與還原 -> 部分資料 -> 匯入列表",
"list_import_tip__playlist_part": "導入失敗,這是一個單列表文件,你需要去這裡導入:\n我的清單 -> 右鍵點選任何一個清單名稱 -> 在彈出的選單中選擇導入", "list_import_tip__playlist_part": "導入失敗,這是一個單列表文件,你需要去這裡導入:\n我的清單 -> 右鍵點選任何一個清單名稱 -> 在彈出的選單中選擇導入",

View File

@ -23,6 +23,7 @@ import { defaultList, loveList, userLists } from '@renderer/store/list/state'
import { addListMusics, moveListMusics, createUserList, getMusicExistListIds } from '@renderer/store/list/action' import { addListMusics, moveListMusics, createUserList, getMusicExistListIds } from '@renderer/store/list/action'
import useKeyDown from '@renderer/utils/compositions/useKeyDown' import useKeyDown from '@renderer/utils/compositions/useKeyDown'
import { useI18n } from '@root/lang' import { useI18n } from '@root/lang'
import { dialog } from '@renderer/plugins/Dialog'
export default { export default {
props: { props: {
@ -168,11 +169,13 @@ export default {
this.isEditing = true this.isEditing = true
this.$nextTick(() => event.currentTarget.querySelector('.' + this.$style.newListInput).focus()) this.$nextTick(() => event.currentTarget.querySelector('.' + this.$style.newListInput).focus())
}, },
handleSaveList(event) { async handleSaveList(event) {
let name = event.target.value let name = event.target.value
this.newListName = event.target.value = '' this.newListName = event.target.value = ''
this.isEditing = false this.isEditing = false
if (!name) return if (!name || (
userLists.some(l => l.name == name) && !(await dialog.confirm(window.i18n.t('list_duplicate_tip'))))
) return
void createUserList({ name }) void createUserList({ name })
}, },
}, },

View File

@ -22,6 +22,7 @@ import { defaultList, loveList, userLists } from '@renderer/store/list/state'
import { addListMusics, moveListMusics, createUserList } from '@renderer/store/list/action' import { addListMusics, moveListMusics, createUserList } from '@renderer/store/list/action'
import useKeyDown from '@renderer/utils/compositions/useKeyDown' import useKeyDown from '@renderer/utils/compositions/useKeyDown'
import { useI18n } from '@root/lang' import { useI18n } from '@root/lang'
import { dialog } from '@renderer/plugins/Dialog'
export default { export default {
props: { props: {
@ -129,11 +130,13 @@ export default {
this.isEditing = true this.isEditing = true
this.$nextTick(() => event.currentTarget.querySelector('.' + this.$style.newListInput).focus()) this.$nextTick(() => event.currentTarget.querySelector('.' + this.$style.newListInput).focus())
}, },
handleSaveList(event) { async handleSaveList(event) {
let name = event.target.value let name = event.target.value
this.newListName = event.target.value = '' this.newListName = event.target.value = ''
this.isEditing = false this.isEditing = false
if (!name) return if (!name || (
userLists.some(l => l.name == name) && !(await dialog.confirm(window.i18n.t('list_duplicate_tip'))))
) return
void createUserList({ name }) void createUserList({ name })
}, },
}, },

View File

@ -1,6 +1,7 @@
import { ref, nextTick, useCssModule, type Ref } from '@common/utils/vueTools' import { ref, nextTick, useCssModule, type Ref } from '@common/utils/vueTools'
import { userLists } from '@renderer/store/list/state' import { userLists } from '@renderer/store/list/state'
import { updateUserList, createUserList } from '@renderer/store/list/action' import { updateUserList, createUserList } from '@renderer/store/list/action'
import { dialog } from '@renderer/plugins/Dialog'
export default ({ dom_lists_list }: { export default ({ dom_lists_list }: {
dom_lists_list: Ref<HTMLElement | null> dom_lists_list: Ref<HTMLElement | null>
@ -39,7 +40,9 @@ export default ({ dom_lists_list }: {
let name = target.value.trim() let name = target.value.trim()
target.readOnly = true target.readOnly = true
if (name == '') { if (name == '' || (
userLists.some(l => l.name == name) && !(await dialog.confirm(window.i18n.t('list_duplicate_tip'))))
) {
isShowNewList.value = false isShowNewList.value = false
return return
} }