Prechádzať zdrojové kódy

Merge branch 'liu-v1.3'

skyblued 2 rokov pred
rodič
commit
9829ac5156

+ 19 - 1
src/views/music/album/index.tsx

@@ -8,6 +8,7 @@ import { useRoute } from 'vue-router'
 import ColResult from '@/components/col-result'
 import styles from './index.module.less'
 import { state } from '@/state'
+import SelectSubject from '../search/select-subject'
 
 export default defineComponent({
   name: 'Album',
@@ -87,12 +88,29 @@ export default defineComponent({
       FetchList()
       tagVisibility.value = false
     }
+    
+    const onComfirmSubject = item => {
+      params.page = 1
+      params.subjectIds = item.id
+      subject.id = item.id
+      subject.name = item.name
+      data.value = null
+      FetchList()
+      subject.show = false
+    }
 
     expose({
       onSearch,
-      onComfirm
+      onComfirm,
+      onComfirmSubject
     })
 
+    const subject = reactive({
+      show: false,
+      name: '全部',
+      id: ''
+    });
+
     return () => {
       return (
         <>

+ 8 - 16
src/views/music/search/header.tsx

@@ -6,7 +6,7 @@ import {
   onBeforeRouteUpdate,
   onBeforeRouteLeave
 } from 'vue-router'
-import { defineComponent, onMounted, ref, watch } from 'vue'
+import { defineComponent, onMounted, reactive, ref, watch } from 'vue'
 import mitt from 'mitt'
 import Search from '@/components/col-search'
 import { useLocalStorage } from '@vueuse/core'
@@ -14,6 +14,7 @@ import styles from './index.module.less'
 import classNames from 'classnames'
 import SelectTag from './select-tag'
 import { getRandomKey, musicBuy } from '../music'
+import SelectSubject from './select-subject'
 
 export const mitter = mitt()
 
@@ -26,22 +27,17 @@ export default defineComponent({
     localStorage.setItem('behaviorId', getRandomKey())
     const router = useRouter()
     const route = useRoute()
-    const loading = ref(false)
     const keyword = ref('')
     const tagids = ref('')
-    const albumRows = ref([])
-    const sheetRows = ref([])
     const tagVisibility = ref(false)
     const words = useLocalStorage<string[]>('music-search', [])
     const activeTab = ref('songe')
 
     onBeforeRouteUpdate(() => {
-      // console.log('onBeforeRouteUpdate', route.fullPath)
       if (route.path === '/music-songbook/search') {
         keyword.value = ''
         tagids.value = ''
         activeTab.value = 'songe'
-        // console.log('onBeforeRouteUpdate')
         try {
           selectTagRef.value?.resetTags?.()
         } catch (error) {
@@ -66,18 +62,12 @@ export default defineComponent({
         words.value.length = Math.min(words.value.length, 5)
       }
       mitter.emit('search', val)
-      // const activeRef = activeTab.value === 'album' ? albumList : musicList
-      // ;(activeRef.value as any).onSearch?.(val)
-      // FetchList()
     }
 
     const onComfirm = (tags, name = '') => {
       const data = Object.values(tags).flat().filter(Boolean).join(',')
       tagids.value = data
       mitter.emit('confirm', tags)
-      // FetchList()
-      // const activeRef = activeTab.value === 'album' ? albumList : musicList
-      // ;(activeRef.value as any).onComfirm?.(tags)
       tagVisibility.value = false
     }
 
@@ -89,10 +79,12 @@ export default defineComponent({
       subject.show = false
     }
 
-    onMounted(() => {
-      // const activeRef = activeTab.value === 'album' ? albumList : musicList
-      // ;(activeRef.value as any).onSearch?.('')
-      // console.log(searchInputRef.value)
+    onMounted(() => {})
+
+    const subject = reactive({
+      show: false,
+      name: '全部',
+      id: ''
     })
     return () => {
       return (