|
@@ -99,7 +99,10 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
const gotoSearch = (val: string, type = 'music') => {
|
|
|
- router.push({ name: 'musicLibrary', query: { search: val } })
|
|
|
+ router.push({
|
|
|
+ name: type === 'music' ? 'musicLibrary' : 'albumibrary',
|
|
|
+ query: { search: val }
|
|
|
+ })
|
|
|
}
|
|
|
const getTagTree = async (type = 'MUSIC') => {
|
|
|
try {
|
|
@@ -113,26 +116,36 @@ export default defineComponent({
|
|
|
const resHot = await request.get(
|
|
|
`/api-website/open/music/sheet/hotTag/${type}`
|
|
|
)
|
|
|
- state.hotList = resHot.data || []
|
|
|
- state.tagTree = res.data || []
|
|
|
+ state.hotList = getArrayLength(resHot.data || [])
|
|
|
+ state.tagTree = getArrayLength(res.data || [])
|
|
|
} else {
|
|
|
- state.tagTreeAlbum = res.data || []
|
|
|
+ state.tagTreeAlbum = getArrayLength(res.data || [])
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const getArrayLength = (arr: any, num = 6) => {
|
|
|
+ return arr.splice(0, num)
|
|
|
+ }
|
|
|
+
|
|
|
const gotoVideoList = () => {
|
|
|
router.push({ path: '/videoDetailList' })
|
|
|
}
|
|
|
|
|
|
const gotoSearchTag = (tag: any, type: string) => {
|
|
|
- if (type === 'album') {
|
|
|
+ if (type === 'album' || type === 'albumTag') {
|
|
|
+ const params = {} as any
|
|
|
+ if (type === 'album') {
|
|
|
+ params.albumTagIds = tag.id
|
|
|
+ } else {
|
|
|
+ params.search = tag
|
|
|
+ }
|
|
|
router.push({
|
|
|
name: 'albumibrary',
|
|
|
query: {
|
|
|
- albumTagIds: tag.id
|
|
|
+ ...params
|
|
|
}
|
|
|
})
|
|
|
} else if (type === 'music' || type === 'musicHot') {
|
|
@@ -196,11 +209,11 @@ export default defineComponent({
|
|
|
<img
|
|
|
src={searchIcon}
|
|
|
class={styles.searchIcon}
|
|
|
- onClick={() => gotoSearch(state.search)}
|
|
|
+ onClick={() => gotoSearchTag(state.search, 'albumTag')}
|
|
|
alt=""
|
|
|
/>
|
|
|
<ElInput
|
|
|
- placeholder="搜索你想要的曲目"
|
|
|
+ placeholder="搜索你想要的专辑"
|
|
|
v-model={state.search}
|
|
|
></ElInput>
|
|
|
</div>
|