迁移搜索、播放启动参数支持
parent
303d712860
commit
9bec54c454
|
@ -21,7 +21,7 @@ export default () => {
|
||||||
const id = decodeURIComponent(link)
|
const id = decodeURIComponent(link)
|
||||||
const playListId = `${source}__${decodeURIComponent(link)}`
|
const playListId = `${source}__${decodeURIComponent(link)}`
|
||||||
let list = (await getListDetail(id, source, 1)).list
|
let list = (await getListDetail(id, source, 1)).list
|
||||||
if (playIndex != null && list.length > playIndex) {
|
if (playIndex == null || list.length > playIndex) {
|
||||||
isPlayingList = true
|
isPlayingList = true
|
||||||
await setTempList(playListId, list)
|
await setTempList(playListId, list)
|
||||||
playList(tempList.id, getListPlayIndex(list, playIndex))
|
playList(tempList.id, getListPlayIndex(list, playIndex))
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { appSetting } from '@renderer/store/setting'
|
||||||
import useSync from './useSync'
|
import useSync from './useSync'
|
||||||
import useUpdate from './useUpdate'
|
import useUpdate from './useUpdate'
|
||||||
import useDataInit from './useDataInit'
|
import useDataInit from './useDataInit'
|
||||||
// import useHandleEnvParams from './useHandleEnvParams'
|
import useHandleEnvParams from './useHandleEnvParams'
|
||||||
import useEventListener from './useEventListener'
|
import useEventListener from './useEventListener'
|
||||||
import useDeeplink from './useDeeplink'
|
import useDeeplink from './useDeeplink'
|
||||||
import usePlayer from './usePlayer'
|
import usePlayer from './usePlayer'
|
||||||
|
@ -29,7 +29,7 @@ export default () => {
|
||||||
const initSyncService = useSync()
|
const initSyncService = useSync()
|
||||||
useEventListener()
|
useEventListener()
|
||||||
const initPlayer = usePlayer()
|
const initPlayer = usePlayer()
|
||||||
// const handleEnvParams = useHandleEnvParams()
|
const handleEnvParams = useHandleEnvParams()
|
||||||
const initData = useDataInit()
|
const initData = useDataInit()
|
||||||
const initDeeplink = useDeeplink()
|
const initDeeplink = useDeeplink()
|
||||||
// const handleListAutoUpdate = useListAutoUpdate()
|
// const handleListAutoUpdate = useListAutoUpdate()
|
||||||
|
@ -61,7 +61,7 @@ export default () => {
|
||||||
// 初始化我的列表、下载列表等数据
|
// 初始化我的列表、下载列表等数据
|
||||||
void initData().then(() => {
|
void initData().then(() => {
|
||||||
initPlayer()
|
initPlayer()
|
||||||
// handleEnvParams(envParams) // 处理传入的启动参数
|
handleEnvParams(envParams) // 处理传入的启动参数
|
||||||
void initDeeplink(envParams)
|
void initDeeplink(envParams)
|
||||||
void initSyncService()
|
void initSyncService()
|
||||||
handleListAutoUpdate()
|
handleListAutoUpdate()
|
||||||
|
|
|
@ -37,13 +37,15 @@ const useSearchMusic = () => {
|
||||||
if (isShowPlayerDetail.value) setShowPlayerDetail(false)
|
if (isShowPlayerDetail.value) setShowPlayerDetail(false)
|
||||||
const sourceList = [...sources, 'all']
|
const sourceList = [...sources, 'all']
|
||||||
source = sourceList.includes(source) ? source : null
|
source = sourceList.includes(source) ? source : null
|
||||||
router.replace({
|
setTimeout(() => {
|
||||||
path: '/search',
|
router.replace({
|
||||||
query: {
|
path: '/search',
|
||||||
text,
|
query: {
|
||||||
source,
|
text,
|
||||||
},
|
source,
|
||||||
})
|
},
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
focusWindow()
|
focusWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,90 +1,89 @@
|
||||||
// import { useRouter } from '@common/utils/vueTools'
|
import { useRouter } from '@common/utils/vueRouter'
|
||||||
// import { parseUrlParams } from '@common/utils/renderer'
|
import { parseUrlParams } from '@common/utils/common'
|
||||||
// import { defaultList, loveList, userLists } from '@renderer/store/list'
|
import { defaultList, loveList, userLists } from '@renderer/store/list/state'
|
||||||
// import { getList } from '@renderer/store/utils'
|
import { getListMusics } from '@renderer/store/list/action'
|
||||||
// import usePlaySonglist from './compositions/usePlaySonglist'
|
import usePlaySonglist from './compositions/usePlaySonglist'
|
||||||
// import { setPlayList } from '@renderer/store/player'
|
import { playList } from '@renderer/core/player'
|
||||||
|
|
||||||
// const getListPlayIndex = (list: LX.Music.MusicInfo[], indexStr?: string): number => {
|
const getListPlayIndex = (list: LX.Music.MusicInfo[], indexStr?: string): number => {
|
||||||
// let index: number
|
let index: number
|
||||||
// if (indexStr == null) {
|
if (indexStr == null) {
|
||||||
// index = 1
|
index = 1
|
||||||
// } else {
|
} else {
|
||||||
// index = parseInt(indexStr)
|
index = parseInt(indexStr)
|
||||||
// if (Number.isNaN(index)) {
|
if (Number.isNaN(index)) {
|
||||||
// index = 1
|
index = 1
|
||||||
// } else {
|
} else {
|
||||||
// if (index < 1) index = 1
|
if (index < 1) index = 1
|
||||||
// else if (index > list.length) index = list.length
|
else if (index > list.length) index = list.length
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return index - 1
|
return index - 1
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const useInitEnvParamSearch = () => {
|
const useInitEnvParamSearch = () => {
|
||||||
// const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
// return (search?: string) => {
|
return (search?: string) => {
|
||||||
// if (search == null) return
|
if (search == null) return
|
||||||
// void router.push({
|
setTimeout(() => {
|
||||||
// path: 'search',
|
void router.replace({
|
||||||
// query: {
|
path: '/search',
|
||||||
// text: search,
|
query: {
|
||||||
// },
|
text: search,
|
||||||
// })
|
},
|
||||||
// }
|
})
|
||||||
// }
|
}, 1000)
|
||||||
// const useInitEnvParamPlay = () => {
|
}
|
||||||
// // const setPlayList = useCommit('player', 'setList')
|
}
|
||||||
|
const useInitEnvParamPlay = () => {
|
||||||
|
// const setPlayList = useCommit('player', 'setList')
|
||||||
|
|
||||||
// const playSongListDetail = usePlaySonglist()
|
const playSongListDetail = usePlaySonglist()
|
||||||
|
|
||||||
// return (playStr?: string) => {
|
return async(playStr?: string) => {
|
||||||
// if (playStr == null || typeof playStr != 'string') return
|
if (playStr == null || typeof playStr != 'string') return
|
||||||
// // -play="source=kw&link=链接、ID"
|
// -play="source=kw&link=链接、ID"
|
||||||
// // -play="source=myList&name=名字"
|
// -play="source=myList&name=名字"
|
||||||
// // -play="source=myList&name=名字&index=位置"
|
// -play="source=myList&name=名字&index=位置"
|
||||||
// const params = parseUrlParams(playStr)
|
const params = parseUrlParams(playStr)
|
||||||
// if (params.type != 'songList') return
|
if (params.type != 'songList') return
|
||||||
// switch (params.source) {
|
switch (params.source) {
|
||||||
// case 'myList':
|
case 'myList':
|
||||||
// if (params.name != null) {
|
if (params.name != null) {
|
||||||
// let targetList
|
let targetList
|
||||||
// const lists = [defaultList, loveList, ...userLists]
|
const lists = [defaultList, loveList, ...userLists]
|
||||||
// for (const list of lists) {
|
for (const list of lists) {
|
||||||
// if (list.name === params.name) {
|
if (list.name === params.name) {
|
||||||
// targetList = list
|
targetList = list
|
||||||
// break
|
break
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if (!targetList) return
|
if (!targetList) return
|
||||||
|
|
||||||
// setPlayList({
|
playList(targetList.id, getListPlayIndex(await getListMusics(targetList.id), params.index))
|
||||||
// listId: targetList.id,
|
}
|
||||||
// index: getListPlayIndex(getList(targetList.id), params.index),
|
break
|
||||||
// })
|
case 'kw':
|
||||||
// }
|
case 'kg':
|
||||||
// break
|
case 'tx':
|
||||||
// case 'kw':
|
case 'mg':
|
||||||
// case 'kg':
|
case 'wy':
|
||||||
// case 'tx':
|
void playSongListDetail(params.source, params.link, parseInt(params.index))
|
||||||
// case 'mg':
|
break
|
||||||
// case 'wy':
|
}
|
||||||
// playSongListDetail(params.source, params.link, params.index)
|
}
|
||||||
// break
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default () => {
|
export default () => {
|
||||||
// // 处理启动参数 search
|
// 处理启动参数 search
|
||||||
// const initEnvParamSearch = useInitEnvParamSearch()
|
const initEnvParamSearch = useInitEnvParamSearch()
|
||||||
|
|
||||||
// // 处理启动参数 play
|
// 处理启动参数 play
|
||||||
// const initEnvParamPlay = useInitEnvParamPlay()
|
const initEnvParamPlay = useInitEnvParamPlay()
|
||||||
|
|
||||||
// return (envParams: LX.EnvParams) => {
|
return (envParams: LX.EnvParams) => {
|
||||||
// initEnvParamSearch(envParams.cmdParams.search)
|
initEnvParamSearch(envParams.cmdParams.search)
|
||||||
// initEnvParamPlay(envParams.cmdParams.play)
|
void initEnvParamPlay(envParams.cmdParams.play)
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ if (appSetting['search.isShowHistorySearch']) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const handleSearch = (text) => {
|
const handleSearch = (text) => {
|
||||||
router.replace({
|
router.replace({
|
||||||
path: 'search',
|
path: '/search',
|
||||||
query: {
|
query: {
|
||||||
text,
|
text,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue