lint code

This commit is contained in:
lyswhut
2023-08-27 15:09:07 +08:00
parent 0d76c9ccb4
commit 71b84fb10d
69 changed files with 346 additions and 413 deletions
+6 -6
View File
@@ -143,9 +143,9 @@ export default {
if (task.isComplate) {
handlePlayMusic(list.value.indexOf(task), true)
} else if (task.status === downloadStatus.RUN || task.status === downloadStatus.WAITING) {
handlePauseTask(index, true)
void handlePauseTask(index, true)
} else {
handleStartTask(index, true)
void handleStartTask(index, true)
}
clickTime = 0
clickIndex = -1
@@ -172,16 +172,16 @@ export default {
handlePlayMusic(index, true)
break
case 'start':
handleStartTask(index, true)
void handleStartTask(index, true)
break
case 'pause':
handlePauseTask(index, true)
void handlePauseTask(index, true)
break
case 'remove':
handleRemoveTask(index, true)
void handleRemoveTask(index, true)
break
case 'file':
handleOpenFile(index)
void handleOpenFile(index)
break
case 'search':
handleSearch(index)
@@ -25,9 +25,8 @@
<script setup lang="ts">
import { watch, shallowReactive, ref } from '@common/utils/vueTools'
import { getBoardsList, setBoard } from '@renderer/store/leaderboard/action'
import { boards, Board } from '@renderer/store/leaderboard/state'
import { boards, type Board } from '@renderer/store/leaderboard/state'
import useMenu from './useMenu'
import LX from '@renderer/types/lx'
import { useRouter, useRoute } from '@common/utils/vueRouter'
const props = defineProps<{
@@ -44,7 +43,7 @@ const list = shallowReactive<Board['list']>([])
const rightClickItemIndex = ref(-1)
const handleToggleList = (id: string) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: props.source,
@@ -65,7 +64,7 @@ const handleRigthClick = (event: MouseEvent, index: number) => {
rightClickItemIndex.value = index
showMenu(event, index)
}
const handleMenuClick = (action?: { action: string}) => {
const handleMenuClick = (action?: { action: string }) => {
if (rightClickItemIndex.value < 0) return
let index = rightClickItemIndex.value
rightClickItemIndex.value = -1
@@ -16,7 +16,6 @@
<script setup lang="ts">
import { watch } from '@common/utils/vueTools'
import LX from '@renderer/types/lx'
import useList from './useList'
+2 -2
View File
@@ -44,7 +44,7 @@ const verifyQueryParams = async function(to, from, next) {
next()
source.value = _source
boardId.value = _boardId
setLeaderboardSetting({ source: _source, boardId: _boardId })
void setLeaderboardSetting({ source: _source, boardId: _boardId })
}
@@ -64,7 +64,7 @@ export default {
const router = useRouter()
const route = useRoute()
const handleToggleSource = (id) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: id,
+2 -2
View File
@@ -139,12 +139,12 @@ export default {
const handleRestoreScroll = (_scrollIndex, _isAnimation) => {
scrollIndex = _scrollIndex
isAnimation = _isAnimation
if (isAnimation) restoreScroll(scrollIndex, isAnimation)
if (isAnimation) void restoreScroll(scrollIndex, isAnimation)
// console.log('handleRestoreScroll', scrollIndex, isAnimation)
}
const onLoadedList = () => {
// console.log('restoreScroll', scrollIndex, isAnimation)
restoreScroll(scrollIndex, isAnimation)
void restoreScroll(scrollIndex, isAnimation)
}
const {
@@ -84,7 +84,7 @@ export default {
watch(() => props.visible, (visible) => {
if (visible) {
if (duplicateList.value.length) duplicateList.value = []
handleFilterList()
void handleFilterList()
}
})
@@ -117,7 +117,7 @@ export default {
console.log(sortType.value, sortField.value)
closeModal()
updateListMusicsPosition({ listId: props.listInfo.id, position: 0, ids: list.map(m => m.id) })
void updateListMusicsPosition({ listId: props.listInfo.id, position: 0, ids: list.map(m => m.id) })
}
const listName = computed(() => {
@@ -56,7 +56,7 @@ export default {
const updateInfo = ref({})
// const updateTimes = ref({})
getListUpdateInfo().then((listUpdateInfo) => {
void getListUpdateInfo().then((listUpdateInfo) => {
updateInfo.value = listUpdateInfo
// if (listUpdateTimes._inited) {
// for (const [id, value] of Object.entries(info)) {
@@ -72,12 +72,12 @@ export default {
})
const handleUpdate = (targetListInfo) => {
handleSyncSourceList(targetListInfo)
void handleSyncSourceList(targetListInfo)
// console.log(targetListInfo.list.length, list.length)
}
const handleChangeAutoUpdate = (list, enable) => {
setListAutoUpdate(list.id, enable)
void setListAutoUpdate(list.id, enable)
}
return {
+4 -4
View File
@@ -148,16 +148,16 @@ export default {
url = await musicSdk[source].songList.getDetailPageUrl(sourceListId)
}
if (!url) return
openUrl(url)
void openUrl(url)
}
const handleRemove = (listInfo) => {
dialog.confirm({
void dialog.confirm({
message: t('lists__remove_tip', { name: listInfo.name }),
confirmButtonText: t('lists__remove_tip_button'),
}).then(isRemove => {
if (!isRemove) return
removeUserList([listInfo.id])
void removeUserList([listInfo.id])
if (props.listId == listInfo.id) {
handleListToggle(LIST_IDS.DEFAULT)
}
@@ -212,7 +212,7 @@ export default {
watch(() => userLists, (lists) => {
if (lists.some(l => l.id == props.listId)) return
router.replace({
void router.replace({
path: '/list',
query: {
id: defaultList.id,
+2 -2
View File
@@ -6,7 +6,7 @@ import useDarg from '@renderer/utils/compositions/useDrag'
export default ({ dom_lists_list, handleSaveListName, handleMenuClick }: {
dom_lists_list: Ref<HTMLElement | null>
handleSaveListName: () => void
handleSaveListName: () => Promise<void> | void
handleMenuClick: () => void
}) => {
const isModDown = ref(false)
@@ -34,7 +34,7 @@ export default ({ dom_lists_list, handleSaveListName, handleMenuClick }: {
isModDown.value = true
setDisabled(false)
handleSaveListName()
void handleSaveListName()
}
handleMenuClick()
}
@@ -19,7 +19,7 @@
import { watch } from '@common/utils/vueTools'
import { searchText } from '@renderer/store/search/state'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import useList, { SearchSource } from './useList'
import useList, { type SearchSource } from './useList'
interface Props {
sourceId: SearchSource
@@ -51,7 +51,7 @@ watch(searchText, (searchText) => {
})
const handleTogglePage = (page: number) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -8,7 +8,7 @@
import { watch } from '@common/utils/vueTools'
import { searchText } from '@renderer/store/search/state'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import useList, { SearchSource } from './useList'
import useList, { type SearchSource } from './useList'
import SongList from '@renderer/views/songList/List/components/SongList.vue'
interface Props {
@@ -40,7 +40,7 @@ watch(searchText, (searchText) => {
})
const togglePage = (page: number) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -44,7 +44,7 @@ const hotSearchList = shallowRef([])
if (appSetting['search.isShowHotSearch']) {
watch(() => props.visible, (visible) => {
if (!visible) return
getList(props.source).then(list => {
void getList(props.source).then(list => {
hotSearchList.value = list
})
}, {
@@ -53,7 +53,7 @@ if (appSetting['search.isShowHotSearch']) {
watch(() => props.source, (source) => {
if (!props.visible) return
getList(source).then(list => {
void getList(source).then(list => {
if (source != props.source) return
hotSearchList.value = list
})
@@ -61,12 +61,12 @@ if (appSetting['search.isShowHotSearch']) {
}
if (appSetting['search.isShowHistorySearch']) {
getHistoryList()
void getHistoryList()
}
const router = useRouter()
const handleSearch = (text) => {
router.replace({
void router.replace({
path: '/search',
query: {
text,
+3 -3
View File
@@ -54,7 +54,7 @@ const verifyQueryParams = async(to, from, next) => {
if (!_page) page.value = 1
}
next()
setSearchSetting({ source: _source, type: _type })
void setSearchSetting({ source: _source, type: _type })
}
export default {
@@ -76,7 +76,7 @@ export default {
}
})
const handleSourceChange = (id) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -93,7 +93,7 @@ export default {
]
})
const handleTypeChange = (type) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -148,11 +148,11 @@ export default {
await importNewListData(allData.playList)
importNewSettingData(allData.setting)
break
default: return showImportTip(allData.type)
default: { showImportTip(allData.type) }
}
}
const handleImportAllData = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_all_import_desc'),
properties: ['openFile'],
filters: [
@@ -161,13 +161,13 @@ export default {
],
}).then(result => {
if (result.canceled) return
dialog.confirm({
void dialog.confirm({
message: t('setting__backup_part_import_list_confirm'),
cancelButtonText: t('cancel_button_text'),
confirmButtonText: t('confirm_button_text'),
}).then(confirm => {
if (!confirm) return
importAllData(result.filePaths[0])
void importAllData(result.filePaths[0])
})
})
}
@@ -178,15 +178,15 @@ export default {
setting: { ...appSetting },
playList: await getAllLists(),
}
window.lx.worker.main.saveLxConfigFile(path, allData)
void window.lx.worker.main.saveLxConfigFile(path, allData)
}
const handleExportAllData = () => {
openSaveDir({
void openSaveDir({
title: t('setting__backup_all_export_desc'),
defaultPath: 'lx_datas_v2.lxmc',
}).then(result => {
if (result.canceled) return
exportAllData(result.filePath)
void exportAllData(result.filePath)
})
}
@@ -195,10 +195,10 @@ export default {
type: 'setting_v2',
data: { ...appSetting },
}
window.lx.worker.main.saveLxConfigFile(path, data)
void window.lx.worker.main.saveLxConfigFile(path, data)
}
const handleExportSetting = () => {
openSaveDir({
void openSaveDir({
title: t('setting__backup_part_export_setting_desc'),
defaultPath: 'lx_setting_v2.lxmc',
}).then(result => {
@@ -222,11 +222,11 @@ export default {
case 'setting_v2':
importNewSettingData(settingData.data)
break
default: return showImportTip(settingData.type)
default: { showImportTip(settingData.type) }
}
}
const handleImportSetting = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_part_import_setting_desc'),
properties: ['openFile'],
filters: [
@@ -235,7 +235,7 @@ export default {
],
}).then(result => {
if (result.canceled) return
importSetting(result.filePaths[0])
void importSetting(result.filePaths[0])
})
}
@@ -244,15 +244,15 @@ export default {
type: 'playList_v2',
data: await getAllLists(),
}
window.lx.worker.main.saveLxConfigFile(path, data)
void window.lx.worker.main.saveLxConfigFile(path, data)
}
const handleExportPlayList = () => {
openSaveDir({
void openSaveDir({
title: t('setting__backup_part_export_list_desc'),
defaultPath: 'lx_list.lxmc',
}).then(result => {
if (result.canceled) return
exportPlayList(result.filePath)
void exportPlayList(result.filePath)
})
}
@@ -275,11 +275,11 @@ export default {
case 'playList_v2':
await importNewListData(listData.data)
break
default: return showImportTip(listData.type)
default: { showImportTip(listData.type) }
}
}
const handleImportPlayList = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_part_import_list_desc'),
properties: ['openFile'],
filters: [
@@ -288,13 +288,13 @@ export default {
],
}).then(result => {
if (result.canceled) return
dialog.confirm({
void dialog.confirm({
message: t('setting__backup_part_import_list_confirm'),
cancelButtonText: t('cancel_button_text'),
confirmButtonText: t('confirm_button_text'),
}).then(confirm => {
if (!confirm) return
importPlayList(result.filePaths[0])
void importPlayList(result.filePaths[0])
})
})
}
@@ -310,23 +310,23 @@ export default {
confirmButtonText: t('confirm_button_text'),
})
if (confirm) {
openSaveDir({
void openSaveDir({
title: t('setting__backup_other_export_dir'),
defaultPath: 'lx_list_all.txt',
}).then(result => {
if (result.canceled) return
let path = result.filePath
if (!path.endsWith('.txt')) path += '.txt'
exportPlayListToText(path, true)
void exportPlayListToText(path, true)
})
} else {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_other_export_dir'),
// defaultPath: currentStting.value.download.savePath,
properties: ['openDirectory'],
}).then(result => {
if (result.canceled) return
exportPlayListToText(result.filePaths[0], false)
void exportPlayListToText(result.filePaths[0], false)
})
}
}
@@ -342,23 +342,23 @@ export default {
confirmButtonText: t('confirm_button_text'),
})
if (confirm) {
openSaveDir({
void openSaveDir({
title: t('setting__backup_other_export_dir'),
defaultPath: 'lx_list_all.csv',
}).then(result => {
if (result.canceled) return
let path = result.filePath
if (!path.endsWith('.csv')) path += '.csv'
exportPlayListToCsv(path, true)
void exportPlayListToCsv(path, true)
})
} else {
showSelectDialog({
void showSelectDialog({
title: t('setting__backup_other_export_dir'),
// defaultPath: currentStting.value.download.savePath,
properties: ['openDirectory'],
}).then(result => {
if (result.canceled) return
exportPlayListToCsv(result.filePaths[0], false)
void exportPlayListToCsv(result.filePaths[0], false)
})
}
}
@@ -186,7 +186,7 @@ export default {
const handleEditTheme = (theme) => {
// console.log(theme)
if (!theme && userThemes.length >= 10) {
dialog({
void dialog({
message: t('theme_max_tip'),
confirmButtonText: t('alert_button_text'),
})
@@ -214,7 +214,7 @@ export default {
if (themeId.value == 'auto') return
if (window.localStorage.getItem('theme-auto-tip') != 'true') {
window.localStorage.setItem('theme-auto-tip', 'true')
dialog({
void dialog({
message: t('setting__basic_theme_auto_tip'),
confirmButtonText: t('ok'),
})
@@ -271,7 +271,7 @@ export default {
const fontList = computed(() => {
return [{ id: '', label: t('setting__desktop_lyric_font_default') }, ...systemFontList.value]
})
getSystemFonts().then(fonts => {
void getSystemFonts().then(fonts => {
systemFontList.value = fonts.map(f => ({ id: f, label: f.replace(/(^"|"$)/g, '') }))
})
@@ -269,7 +269,7 @@ export default {
const fontList = computed(() => {
return [{ id: '', label: t('setting__desktop_lyric_font_default') }, ...systemFontList.value]
})
getSystemFonts().then(fonts => {
void getSystemFonts().then(fonts => {
systemFontList.value = fonts.map(f => ({ id: f, label: f.replace(/(^"|"$)/g, '') }))
})
@@ -67,7 +67,7 @@ export default {
const t = useI18n()
const handleChangeSavePath = () => {
showSelectDialog({
void showSelectDialog({
title: t('setting__download_select_save_path'),
defaultPath: appSetting['download.savePath'],
properties: ['openDirectory'],
@@ -134,6 +134,7 @@ export default {
if (config) {
if (config.key == newHotKey) return
originKey = config.key
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete current_hot_key.value[type].keys[config.key]
} else if (!newHotKey) return
@@ -143,6 +144,7 @@ export default {
config = tempInfo.keys[newHotKey]
if (config) {
console.log(newHotKey, info, config, info.name, config.name)
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete current_hot_key.value[tempType].keys[newHotKey]
break
}
@@ -203,7 +205,7 @@ export default {
await handleHotKeySaveConfig()
await getHotKeyStatus()
}
const getHotKeyStatus = () => {
const getHotKeyStatus = async() => {
return hotKeyGetStatus().then(status => {
// console.log(status)
hotKeyStatus.value = status
@@ -213,7 +215,7 @@ export default {
current_hot_key.value = window.lx.appHotKeyConfig
initHotKeyConfig()
getHotKeyStatus()
void getHotKeyStatus()
window.app_event.on('keyDown', handleKeyDown)
@@ -83,7 +83,7 @@ export default {
const isDisabledResourceCacheClear = ref(false)
// const isDisabledListCacheClear = ref(false)
const refreshCacheSize = () => {
getCacheSize().then(size => {
void getCacheSize().then(size => {
cacheSize.value = sizeFormate(size)
})
}
@@ -94,7 +94,7 @@ export default {
confirmButtonText: t('setting__other_resource_cache_confirm'),
})) return
isDisabledResourceCacheClear.value = true
clearCache().then(() => {
void clearCache().then(() => {
refreshCacheSize()
isDisabledResourceCacheClear.value = false
})
@@ -105,13 +105,13 @@ export default {
const otherSourceCount = ref(0)
const isDisabledOtherSourceCacheClear = ref(false)
const refreshOtherSourceCount = () => {
getOtherSourceCount().then(count => {
void getOtherSourceCount().then(count => {
otherSourceCount.value = count
})
}
const handleClearOtherSourceCache = async() => {
isDisabledOtherSourceCacheClear.value = true
clearOtherSource().then(() => {
void clearOtherSource().then(() => {
refreshOtherSourceCount()
isDisabledOtherSourceCacheClear.value = false
})
@@ -122,13 +122,13 @@ export default {
const musicUrlCount = ref(0)
const isDisabledMusicUrlCacheClear = ref(false)
const refreshMusicUrlCount = () => {
getMusicUrlCount().then(count => {
void getMusicUrlCount().then(count => {
musicUrlCount.value = count
})
}
const handleClearMusicUrlCache = async() => {
isDisabledMusicUrlCacheClear.value = true
clearMusicUrl().then(() => {
void clearMusicUrl().then(() => {
refreshMusicUrlCount()
isDisabledMusicUrlCacheClear.value = false
})
@@ -139,13 +139,13 @@ export default {
const lyricRawCount = ref(0)
const isDisabledLyricRawCacheClear = ref(false)
const refreshLyricRawCount = () => {
getLyricRawCount().then(count => {
void getLyricRawCount().then(count => {
lyricRawCount.value = count
})
}
const handleClearLyricRawCache = async() => {
isDisabledLyricRawCacheClear.value = true
clearLyricRaw().then(() => {
void clearLyricRaw().then(() => {
refreshLyricRawCount()
isDisabledLyricRawCacheClear.value = false
})
@@ -156,7 +156,7 @@ export default {
const lyricEditedCount = ref(0)
const isDisabledLyricEditedCacheClear = ref(false)
const refreshLyricEditedCount = () => {
getLyricEditedCount().then(count => {
void getLyricEditedCount().then(count => {
lyricEditedCount.value = count
})
}
@@ -167,7 +167,7 @@ export default {
confirmButtonText: t('setting__other_resource_cache_confirm'),
})) return
isDisabledLyricEditedCacheClear.value = true
clearLyricEdited().then(() => {
void clearLyricEdited().then(() => {
refreshLyricEditedCount()
isDisabledLyricEditedCacheClear.value = false
})
@@ -180,7 +180,7 @@ export default {
cancelButtonText: t('cancel_button_text'),
confirmButtonText: t('setting__other_resource_cache_confirm'),
})) return
overwriteListFull({
void overwriteListFull({
defaultList: [],
loveList: [],
userList: [],
@@ -47,7 +47,7 @@ export default {
mediaDevices.value = audioDevices
// console.log(this.mediaDevices)
}
getMediaDevice()
void getMediaDevice()
navigator.mediaDevices.addEventListener('devicechange', getMediaDevice)
onBeforeUnmount(() => {
@@ -91,7 +91,7 @@ export default {
})
const refreshSyncCode = () => {
sendSyncAction({ action: 'generate_code' })
void sendSyncAction({ action: 'generate_code' })
}
const setSyncServerPort = debounce(port => {
@@ -288,39 +288,39 @@ export default {
// console.log('appBgColor', color)
theme.config.extInfo['--color-app-background'] = color == appBgColor ? appBgColorOrigin : color
createPreview()
}, () => setAppBgColor(getColor(appBgColorOrigin, theme)))
}, () => { setAppBgColor(getColor(appBgColorOrigin, theme)) })
initAsideFontColor(asideFontColor, (color) => {
theme.config.extInfo['--color-nav-font'] = color == asideFontColor ? asideFontColorOrigin : color
createPreview()
}, () => setAsideFontColor(getColor(asideFontColorOrigin, theme)))
}, () => { setAsideFontColor(getColor(asideFontColorOrigin, theme)) })
initMainBgColor(mainBgColor, (color) => {
theme.config.extInfo['--color-main-background'] = color == mainBgColor ? mainBgColorOrigin : color
createPreview()
}, () => setMainBgColor(getColor(mainBgColorOrigin, theme)))
}, () => { setMainBgColor(getColor(mainBgColorOrigin, theme)) })
initBadgePrimaryColor(badgePrimaryColor, (color) => {
theme.config.extInfo['--color-badge-primary'] = color == badgePrimaryColor ? badgePrimaryColorOrigin : color
createPreview()
}, () => setBadgePrimaryColor(getColor(badgePrimaryColorOrigin, theme)))
}, () => { setBadgePrimaryColor(getColor(badgePrimaryColorOrigin, theme)) })
initBadgeSecondaryColor(badgeSecondaryColor, (color) => {
theme.config.extInfo['--color-badge-secondary'] = color == badgeSecondaryColor ? badgeSecondaryColorOrigin : color
createPreview()
}, () => setBadgeSecondaryColor(getColor(badgeSecondaryColorOrigin, theme)))
}, () => { setBadgeSecondaryColor(getColor(badgeSecondaryColorOrigin, theme)) })
initBadgeTertiaryColor(badgeTertiaryColor, (color) => {
theme.config.extInfo['--color-badge-tertiary'] = color == badgeTertiaryColor ? badgeTertiaryColorOrigin : color
createPreview()
}, () => setBadgeTertiaryColor(getColor(badgeTertiaryColorOrigin, theme)))
}, () => { setBadgeTertiaryColor(getColor(badgeTertiaryColorOrigin, theme)) })
initCloseBtnColor(closeBtnColor, (color) => {
theme.config.extInfo['--color-btn-close'] = color == closeBtnColor ? closeBtnColorOrigin : color
createPreview()
}, () => setCloseBtnColor(getColor(closeBtnColorOrigin, theme)))
}, () => { setCloseBtnColor(getColor(closeBtnColorOrigin, theme)) })
initMinBtnColor(minBtnColor, (color) => {
theme.config.extInfo['--color-btn-min'] = color == minBtnColor ? minBtnColorOrigin : color
createPreview()
}, () => setMinBtnColor(getColor(minBtnColorOrigin, theme)))
}, () => { setMinBtnColor(getColor(minBtnColorOrigin, theme)) })
initHideBtnColor(hideBtnColor, (color) => {
theme.config.extInfo['--color-btn-hide'] = color == hideBtnColor ? hideBtnColorOrigin : color
createPreview()
}, () => setHideBtnColor(getColor(hideBtnColorOrigin, theme)))
}, () => { setHideBtnColor(getColor(hideBtnColorOrigin, theme)) })
createPreview()
}
@@ -339,7 +339,7 @@ export default {
}
watch(() => props.modelValue, (visible) => {
nextTick(() => {
void nextTick(() => {
getThemes(({ themes, userThemes }) => {
if (visible) {
if (props.themeId) {
@@ -392,7 +392,7 @@ export default {
}
const removeBgImg = async() => {
if (currentBgPath) {
removeFile(currentBgPath)
void removeFile(currentBgPath)
currentBgPath = ''
}
bgImg.value = ''
@@ -432,7 +432,7 @@ export default {
// 移除旧背景
if (originBgName &&
theme.config.extInfo['--background-image'] != originBgName &&
!isUrl(theme.config.extInfo['--background-image'])) removeFile(joinPath(themeInfo.dataPath, originBgName))
!isUrl(theme.config.extInfo['--background-image'])) void removeFile(joinPath(themeInfo.dataPath, originBgName))
if (props.themeId) {
const index = themeInfo.userThemes.findIndex(t => t.id == theme.id)
if (index > -1) themeInfo.userThemes.splice(index, 1, theme)
@@ -468,7 +468,7 @@ export default {
}
}
if (isRequireUpdateSetting) updateSetting(newSetting)
if (originBgName) removeFile(joinPath(themeInfo.dataPath, originBgName))
if (originBgName) void removeFile(joinPath(themeInfo.dataPath, originBgName))
await removeTheme(props.themeId)
const index = themeInfo.userThemes.findIndex(t => t.id == theme.id)
console.log(index)
@@ -60,16 +60,16 @@ export default {
})
return
}
showSelectDialog({
void showSelectDialog({
title: this.$t('user_api__import_file'),
properties: ['openFile'],
filters: [
{ name: 'LX API File', extensions: ['js'] },
{ name: 'All Files', extensions: ['*'] },
],
}).then(result => {
}).then(async result => {
if (result.canceled) return
return readFile(result.filePaths[0]).then(data => {
return readFile(result.filePaths[0]).then(async data => {
return importUserApi(data.toString()).then(({ apiList }) => {
userApi.list = apiList
})
@@ -92,10 +92,10 @@ export default {
this.$emit('update:modelValue', false)
},
handleOpenUrl(url) {
openUrl(url)
void openUrl(url)
},
handleChangeAllowUpdateAlert(api, enable) {
setAllowShowUserApiUpdateAlert(api.id, enable)
void setAllowShowUserApiUpdateAlert(api.id, enable)
},
},
}
+1 -1
View File
@@ -119,7 +119,7 @@ export default {
const toggleTab = id => {
avtiveComponentName.value = id
nextTick(() => {
void nextTick(() => {
dom_content_ref.value?.scrollTo({
top: 0,
behavior: 'smooth',
+5 -6
View File
@@ -45,7 +45,6 @@
import { ref, watch } from '@common/utils/vueTools'
import { listDetailInfo } from '@renderer/store/songList/state'
import { setVisibleListDetail } from '@renderer/store/songList/action'
import LX from '@renderer/types/lx'
import { useRouter } from '@common/utils/vueRouter'
import { addSongListDetail, playSongListDetail } from './action'
import useList from './useList'
@@ -68,7 +67,7 @@ interface Query {
fromName?: string
}
const verifyQueryParams = async function(this: any, to: { query: Query, path: string}, from: any, next: (route?: { path: string; query: Query }) => void) {
const verifyQueryParams = async function(this: any, to: { query: Query, path: string }, from: any, next: (route?: { path: string, query: Query }) => void) {
let _source = to.query.source
let _id = to.query.id
let _page: string | undefined = to.query.page
@@ -119,25 +118,25 @@ export default {
const togglePage = (page: number) => {
getListData(source.value, id.value, page, refresh.value)
void getListData(source.value, id.value, page, refresh.value)
}
const handleBack = () => {
setVisibleListDetail(false)
if (window.lx.songListInfo.fromName) router.replace({ name: window.lx.songListInfo.fromName })
if (window.lx.songListInfo.fromName) void router.replace({ name: window.lx.songListInfo.fromName })
else router.back()
}
useKeyBack(handleBack)
watch([source, id, page, refresh], ([_source, _id, _page, _refresh]) => {
watch([source, id, page, refresh], async([_source, _id, _page, _refresh]) => {
if (!_source || !_id) return router.replace({ path: '/songList/list' })
// console.log(_source, _id, _page, _refresh, picUrl.value)
// source.value = _source
// id.value = _id
// refresh.value = _refresh
// page.value = _page ?? 1
getListData(_source, _id, _page, _refresh)
void getListData(_source, _id, _page, _refresh)
}, {
immediate: true,
})
@@ -7,7 +7,6 @@ import { watch, ref, nextTick } from '@common/utils/vueTools'
import { listInfo } from '@renderer/store/songList/state'
import { getAndSetList } from '@renderer/store/songList/action'
import { useRouter, useRoute, onBeforeRouteLeave } from '@common/utils/vueRouter'
import LX from '@renderer/types/lx'
import SongList from './components/SongList.vue'
@@ -28,12 +27,12 @@ const getListData = async(source: LX.OnlineSource, tabId: string, sortId: string
// console.log(source, tabId, sortId, page)
await getAndSetList(source, tabId, sortId, page).then(() => {
if (listInfo.key == window.lx.songListInfo.songlistKey && window.lx.songListInfo.songlistPosition) {
nextTick(() => {
void nextTick(() => {
list_ref.value?.scrollTo(window.lx.songListInfo.songlistPosition)
})
} else if (list_ref.value) {
window.lx.songListInfo.songlistKey = null
nextTick(() => {
void nextTick(() => {
list_ref.value.scrollTo(0)
})
}
@@ -41,7 +40,7 @@ const getListData = async(source: LX.OnlineSource, tabId: string, sortId: string
}
const togglePage = (page: number) => {
router.replace({
void router.replace({
path: route.path,
query: {
...route.query,
@@ -57,7 +56,7 @@ watch(() => [props.source, props.tagId, props.sortId, props.page], ([source, tag
// console.log(source, tagId, sortId)
if (!source || !sortId) return
// console.log(source, tagId, sortId, page)
getListData(source as LX.OnlineSource, tagId as string, sortId as string, page as number)
void getListData(source as LX.OnlineSource, tagId as string, sortId as string, page as number)
}, {
immediate: true,
})
@@ -65,7 +65,7 @@ watch(() => props.modelValue, (visible) => {
const handleSubmit = () => {
if (!text.value.length) return
setOpenSongListInputInfo(text.value, source.value)
router.push({
void router.push({
path: '/songList/detail',
query: {
source: source.value,
@@ -36,7 +36,6 @@
<script setup lang="ts">
import { ref } from '@common/utils/vueTools'
import type { ListInfo, ListInfoItem } from '@renderer/store/songList/state'
// import LX from '@renderer/types/lx'
import { useRoute, useRouter } from '@common/utils/vueRouter'
@@ -60,7 +59,7 @@ const togglePage = (page: number) => {
}
const toDetail = (info: ListInfoItem) => {
router.push({
void router.push({
path: '/songList/detail',
query: {
source: info.source,
@@ -29,7 +29,7 @@ const list = shallowReactive([])
const handleToggle = (id) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: props.source,
@@ -24,7 +24,6 @@
import { watch, shallowReactive, ref, onMounted, onBeforeUnmount, computed, reactive } from '@common/utils/vueTools'
import { setTags, getTags } from '@renderer/store/songList/action'
import { tags, type TagInfoTypeItem } from '@renderer/store/songList/state'
import LX from '@renderer/types/lx'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import { useI18n } from '@renderer/plugins/i18n'
@@ -40,7 +39,7 @@ const t = useI18n()
const list = shallowReactive<TagInfoTypeItem[]>([])
const handleToggleTag = (id: string) => {
router.replace({
void router.replace({
path: route.path,
query: {
source: props.source,
+3 -4
View File
@@ -22,7 +22,6 @@ import OpenListModal from './components/OpenListModal.vue'
import ListView from './ListView.vue'
import { sources, listInfo, isVisibleListDetail } from '@renderer/store/songList/state'
import { sourceNames } from '@renderer/store'
import LX from '@renderer/types/lx'
import { useRoute, useRouter } from '@common/utils/vueRouter'
const source = ref<LX.OnlineSource>('kw')
@@ -38,7 +37,7 @@ interface Query {
page?: string
}
const verifyQueryParams = async function(this: any, to: { query: Query, path: string}, from: any, next: (route?: { path: string; query: Query }) => void) {
const verifyQueryParams = async function(this: any, to: { query: Query, path: string }, from: any, next: (route?: { path: string, query: Query }) => void) {
let _source = to.query.source
let _tagId = to.query.tagId
let _sortId = to.query.sortId
@@ -72,7 +71,7 @@ const verifyQueryParams = async function(this: any, to: { query: Query, path: st
tagId.value = _tagId ?? ''
sortId.value = _sortId ?? ''
page.value = _page ? parseInt(_page) : 1
setSongListSetting({ source: _source, tagId: _tagId, sortId: _sortId })
void setSongListSetting({ source: _source, tagId: _tagId, sortId: _sortId })
}
@@ -95,7 +94,7 @@ export default {
const route = useRoute()
const handleToggleSource = (id: LX.OnlineSource) => {
if (id == source.value) return
router.replace({
void router.replace({
path: route.path,
query: {
source: id,