|
@@ -1,4 +1,11 @@
|
|
|
-import { defineComponent, toRefs, reactive, onMounted, ref } from 'vue'
|
|
|
+import {
|
|
|
+ defineComponent,
|
|
|
+ toRefs,
|
|
|
+ reactive,
|
|
|
+ onMounted,
|
|
|
+ ref,
|
|
|
+ nextTick
|
|
|
+} from 'vue'
|
|
|
import { ElButton, ElTag } from 'element-plus'
|
|
|
import classes from './index.module.less'
|
|
|
import tagItem from '@/components/tagItem'
|
|
@@ -11,8 +18,9 @@ import request from '@/helpers/request'
|
|
|
import arrows from './images/selectArrow.png'
|
|
|
import clearIcon from './images/clearIcon.png'
|
|
|
import item from '@/views/user-info/components/item'
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import { spawn } from 'child_process'
|
|
|
+
|
|
|
export default defineComponent({
|
|
|
name: 'hotSearch',
|
|
|
components: { tagItem },
|
|
@@ -48,6 +56,7 @@ export default defineComponent({
|
|
|
searchHover: false
|
|
|
})
|
|
|
const router = useRouter()
|
|
|
+ const route = useRoute()
|
|
|
const getHotList = async () => {
|
|
|
try {
|
|
|
const res = await request.get(
|
|
@@ -64,7 +73,13 @@ export default defineComponent({
|
|
|
try {
|
|
|
const res = await request.get('/api-website/open/MusicTag/tree', {})
|
|
|
state.tagTree = res.data
|
|
|
-
|
|
|
+ if (route.params.tag && route.params.parentTagId) {
|
|
|
+ let tag = findTag(route.params.tag)
|
|
|
+ if (tag) {
|
|
|
+ state.showDetail= false;
|
|
|
+ chioseTag(tag)
|
|
|
+ }
|
|
|
+ }
|
|
|
// state.hotList = res.data
|
|
|
} catch (e) {
|
|
|
console.log(e)
|
|
@@ -171,9 +186,21 @@ export default defineComponent({
|
|
|
const gotoSearch = () => {
|
|
|
router.push({ path: props.gotoPath })
|
|
|
}
|
|
|
+ const findTag = (id: any) => {
|
|
|
+ let tag = null as any
|
|
|
+ state.tagTree.forEach((tree: any) => {
|
|
|
+ tree.children.forEach((item: any) => {
|
|
|
+ if (id == item.id) {
|
|
|
+ tag = item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return tag
|
|
|
+ }
|
|
|
onMounted(() => {
|
|
|
getHotList()
|
|
|
getTagTree()
|
|
|
+ // 判断有没有parment
|
|
|
})
|
|
|
return () => (
|
|
|
<>
|
|
@@ -236,7 +263,7 @@ export default defineComponent({
|
|
|
{state.searchTagList.map((item: any) => {
|
|
|
return (
|
|
|
<ElTag
|
|
|
- size="large"
|
|
|
+ size="large"
|
|
|
closable
|
|
|
onClose={() => closeChioseTag(item)}
|
|
|
class="chioseTag"
|
|
@@ -274,7 +301,10 @@ export default defineComponent({
|
|
|
// effect={isChiose(tag)}
|
|
|
|
|
|
<div
|
|
|
- class={[classes.tags,tag.isCheck?classes.check:'']}
|
|
|
+ class={[
|
|
|
+ classes.tags,
|
|
|
+ tag.isCheck ? classes.check : ''
|
|
|
+ ]}
|
|
|
onClick={() => {
|
|
|
chioseTag(tag)
|
|
|
}}
|