|
@@ -30,6 +30,7 @@ import { state } from '@/state'
|
|
import TheSticky from '@/components/the-sticky'
|
|
import TheSticky from '@/components/the-sticky'
|
|
import bgImg from '../../images/bg-image-search.png'
|
|
import bgImg from '../../images/bg-image-search.png'
|
|
import iconSearch from './icon-search.png'
|
|
import iconSearch from './icon-search.png'
|
|
|
|
+import iconDelete from './icon-delete.png'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
import { browser } from '@/helpers/utils'
|
|
import { browser } from '@/helpers/utils'
|
|
import ColHeader from '@/components/col-header'
|
|
import ColHeader from '@/components/col-header'
|
|
@@ -89,7 +90,12 @@ export default defineComponent({
|
|
const searchResultStatus = ref(false)
|
|
const searchResultStatus = ref(false)
|
|
const keyword = ref('')
|
|
const keyword = ref('')
|
|
const tagids = ref('')
|
|
const tagids = ref('')
|
|
- const words = useLocalStorage<string[]>('music-search', [])
|
|
|
|
|
|
+ const words = useLocalStorage<string[]>(
|
|
|
|
+ route.path === '/music-songbook/search'
|
|
|
|
+ ? 'music-search'
|
|
|
|
+ : 'music-search-ablum',
|
|
|
|
+ []
|
|
|
|
+ )
|
|
const activeTab = ref('all')
|
|
const activeTab = ref('all')
|
|
|
|
|
|
if (route.path === '/music-songbook/result') {
|
|
if (route.path === '/music-songbook/result') {
|
|
@@ -129,15 +135,36 @@ export default defineComponent({
|
|
const searchList = ref<any>([])
|
|
const searchList = ref<any>([])
|
|
const onInputSearch = useThrottleFn(async (val: any) => {
|
|
const onInputSearch = useThrottleFn(async (val: any) => {
|
|
try {
|
|
try {
|
|
- const { data } = await request.post('/api-student/music/sheet/search', {
|
|
|
|
- hideLoading: true,
|
|
|
|
- data: {
|
|
|
|
- subjectId: subjects.id,
|
|
|
|
- name: val,
|
|
|
|
- rows: 10
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- const tempMusics = data.musicNames || []
|
|
|
|
|
|
+ let tData: any = {}
|
|
|
|
+ if (route.path === '/music-songbook/searchAlbum') {
|
|
|
|
+ const { data } = await request.post(
|
|
|
|
+ '/api-student/music/sheet/searchTenant',
|
|
|
|
+ {
|
|
|
|
+ hideLoading: true,
|
|
|
|
+ data: {
|
|
|
|
+ // subjectId: subjects.id,
|
|
|
|
+ name: val,
|
|
|
|
+ rows: 10
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ tData = data
|
|
|
|
+ } else {
|
|
|
|
+ const { data } = await request.post(
|
|
|
|
+ '/api-student/music/sheet/search',
|
|
|
|
+ {
|
|
|
|
+ hideLoading: true,
|
|
|
|
+ data: {
|
|
|
|
+ subjectId: subjects.id,
|
|
|
|
+ name: val,
|
|
|
|
+ rows: 10
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ tData = data
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const tempMusics = tData.musicNames || []
|
|
tempMusics.forEach((item: any, index: number) => {
|
|
tempMusics.forEach((item: any, index: number) => {
|
|
if (index < 10) {
|
|
if (index < 10) {
|
|
item.name = item.name.replace(val, `<span>${val}</span>`)
|
|
item.name = item.name.replace(val, `<span>${val}</span>`)
|
|
@@ -161,18 +188,27 @@ export default defineComponent({
|
|
words.value.unshift(val)
|
|
words.value.unshift(val)
|
|
// console.log(words.value.length, 'words.value.length')
|
|
// console.log(words.value.length, 'words.value.length')
|
|
words.value.length = Math.min(words.value.length, 10)
|
|
words.value.length = Math.min(words.value.length, 10)
|
|
|
|
+ // 结合搜索
|
|
if (route.path === '/music-songbook/search') defaultClose()
|
|
if (route.path === '/music-songbook/search') defaultClose()
|
|
|
|
+ // 机构专辑搜索
|
|
|
|
+ if (route.path === '/music-songbook/searchAlbum') defaultClose()
|
|
}
|
|
}
|
|
- // mitter.emit('search', val)
|
|
|
|
- if (route.path !== '/music-songbook/result') {
|
|
|
|
- router.replace({
|
|
|
|
- path: '/music-songbook/result',
|
|
|
|
- query: {
|
|
|
|
- search: val
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- searchResultStatus.value = false
|
|
|
|
- searchList.value = []
|
|
|
|
|
|
+ // 机构专辑详情
|
|
|
|
+ if (route.path !== '/music-songbook/searchAlbum') {
|
|
|
|
+ // 综合搜索
|
|
|
|
+ if (route.path !== '/music-songbook/result') {
|
|
|
|
+ router.replace({
|
|
|
|
+ path: '/music-songbook/result',
|
|
|
|
+ query: {
|
|
|
|
+ search: val
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ searchResultStatus.value = false
|
|
|
|
+ searchList.value = []
|
|
|
|
+ } else {
|
|
|
|
+ searchResultStatus.value = false
|
|
|
|
+ mitter.emit('search', val)
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
searchResultStatus.value = false
|
|
searchResultStatus.value = false
|
|
mitter.emit('search', val)
|
|
mitter.emit('search', val)
|
|
@@ -230,7 +266,7 @@ export default defineComponent({
|
|
}
|
|
}
|
|
|
|
|
|
if (!collapse.arrowStatus) {
|
|
if (!collapse.arrowStatus) {
|
|
- if (collapse.line > 2) {
|
|
|
|
|
|
+ if (collapse.line > 1) {
|
|
//从第3行开始 隐藏标签
|
|
//从第3行开始 隐藏标签
|
|
item.$el.style.display = 'none'
|
|
item.$el.style.display = 'none'
|
|
} else {
|
|
} else {
|
|
@@ -247,6 +283,7 @@ export default defineComponent({
|
|
}
|
|
}
|
|
// 首先调用默认收起的方法
|
|
// 首先调用默认收起的方法
|
|
if (route.path === '/music-songbook/search') defaultClose()
|
|
if (route.path === '/music-songbook/search') defaultClose()
|
|
|
|
+ if (route.path === '/music-songbook/searchAlbum') defaultClose()
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
postMessage({
|
|
postMessage({
|
|
@@ -259,7 +296,12 @@ export default defineComponent({
|
|
<div class={styles.search}>
|
|
<div class={styles.search}>
|
|
<div class={styles.sticky}>
|
|
<div class={styles.sticky}>
|
|
<TheSticky position="top">
|
|
<TheSticky position="top">
|
|
- <ColHeader isFixed={false} background="transparent" title=" " />
|
|
|
|
|
|
+ <ColHeader
|
|
|
|
+ isFixed={false}
|
|
|
|
+ background="transparent"
|
|
|
|
+ isBack={false}
|
|
|
|
+ title=" "
|
|
|
|
+ />
|
|
<Search
|
|
<Search
|
|
modelValue={keyword.value}
|
|
modelValue={keyword.value}
|
|
background="transparent"
|
|
background="transparent"
|
|
@@ -274,43 +316,41 @@ export default defineComponent({
|
|
if (route.path === '/music-songbook/result') {
|
|
if (route.path === '/music-songbook/result') {
|
|
router.replace('/music-songbook/search')
|
|
router.replace('/music-songbook/search')
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (route.path === '/music-songbook/searchAlbum') {
|
|
|
|
+ mitter.emit('search', '')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}}
|
|
}}
|
|
onSearch={(val: any) => {
|
|
onSearch={(val: any) => {
|
|
- if (!val) return
|
|
|
|
|
|
+ if (!val) {
|
|
|
|
+ if (route.path === '/music-songbook/searchAlbum') {
|
|
|
|
+ mitter.emit('search', '')
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
keyword.value = val
|
|
keyword.value = val
|
|
- console.log(val, 'val')
|
|
|
|
onSearch(val)
|
|
onSearch(val)
|
|
// searchResultStatus.value = true
|
|
// searchResultStatus.value = true
|
|
}}
|
|
}}
|
|
type="tenant"
|
|
type="tenant"
|
|
v-slots={{
|
|
v-slots={{
|
|
- left: () => (
|
|
|
|
- // <div
|
|
|
|
- // class={styles.label}
|
|
|
|
- // onClick={() => (subject.show = true)}
|
|
|
|
- // >
|
|
|
|
- // {subject.name}
|
|
|
|
- // <Icon
|
|
|
|
- // classPrefix="iconfont"
|
|
|
|
- // name="down"
|
|
|
|
- // size={12}
|
|
|
|
- // color="#333"
|
|
|
|
- // />
|
|
|
|
- // </div>
|
|
|
|
- <DropdownMenu>
|
|
|
|
- <DropdownItem
|
|
|
|
- titleClass={styles.titleActive}
|
|
|
|
- title="筛选"
|
|
|
|
- ref={searchRef}
|
|
|
|
- >
|
|
|
|
- <SelectSubject
|
|
|
|
- searchParams={subject}
|
|
|
|
- onComfirm={onComfirmSubject}
|
|
|
|
- />
|
|
|
|
- </DropdownItem>
|
|
|
|
- </DropdownMenu>
|
|
|
|
- ),
|
|
|
|
|
|
+ left: () =>
|
|
|
|
+ route.path !== '/music-songbook/searchAlbum' && (
|
|
|
|
+ <DropdownMenu>
|
|
|
|
+ <DropdownItem
|
|
|
|
+ // titleClass={styles.titleActive}
|
|
|
|
+ title={subject.name}
|
|
|
|
+ ref={searchRef}
|
|
|
|
+ >
|
|
|
|
+ <SelectSubject
|
|
|
|
+ isReset
|
|
|
|
+ searchParams={subject}
|
|
|
|
+ onComfirm={onComfirmSubject}
|
|
|
|
+ />
|
|
|
|
+ </DropdownItem>
|
|
|
|
+ </DropdownMenu>
|
|
|
|
+ ),
|
|
action: () => (
|
|
action: () => (
|
|
<span
|
|
<span
|
|
class={styles.searchCancel}
|
|
class={styles.searchCancel}
|
|
@@ -346,49 +386,53 @@ export default defineComponent({
|
|
</TheSticky>
|
|
</TheSticky>
|
|
<img class={styles.bgImg} src={bgImg} />
|
|
<img class={styles.bgImg} src={bgImg} />
|
|
</div>
|
|
</div>
|
|
- {words.value.length > 0 && route.path === '/music-songbook/search' && (
|
|
|
|
- <div class={styles.keywordSection}>
|
|
|
|
- <div class={styles.keywordTitle}>
|
|
|
|
- <span class={styles.t}>搜索历史</span>
|
|
|
|
- <Icon
|
|
|
|
- class={styles.remove}
|
|
|
|
- name="delete-o"
|
|
|
|
- onClick={() => (words.value = [])}
|
|
|
|
- />
|
|
|
|
- </div>
|
|
|
|
- <div class={classNames(styles.keywords)}>
|
|
|
|
- <div class={styles.content}>
|
|
|
|
- {words.value.map((item: any, index: number) => (
|
|
|
|
- <Tag
|
|
|
|
- ref={(el: any) => (tagRef.value[index] = el)}
|
|
|
|
- round
|
|
|
|
- class={[styles.searchKeyword, 'van-ellipsis']}
|
|
|
|
- key={item}
|
|
|
|
- onClick={() => {
|
|
|
|
- keyword.value = item
|
|
|
|
- onSearch(item)
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- {item}
|
|
|
|
- </Tag>
|
|
|
|
- ))}
|
|
|
|
- {collapse.line > 2 && (
|
|
|
|
- <span
|
|
|
|
- class={[styles.arrowMore]}
|
|
|
|
- onClick={() => {
|
|
|
|
- collapse.arrowStatus = !collapse.arrowStatus
|
|
|
|
- defaultClose()
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- <Icon
|
|
|
|
- name={collapse.arrowStatus ? 'arrow-up' : 'arrow-down'}
|
|
|
|
- />
|
|
|
|
- </span>
|
|
|
|
- )}
|
|
|
|
|
|
+ {words.value.length > 0 &&
|
|
|
|
+ (route.path === '/music-songbook/search' ||
|
|
|
|
+ route.path === '/music-songbook/searchAlbum') && (
|
|
|
|
+ <div class={styles.keywordSection}>
|
|
|
|
+ <div class={styles.keywordTitle}>
|
|
|
|
+ <span class={styles.t}>搜索历史</span>
|
|
|
|
+ <Icon
|
|
|
|
+ class={styles.remove}
|
|
|
|
+ name={iconDelete}
|
|
|
|
+ onClick={() => (words.value = [])}
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div class={classNames(styles.keywords)}>
|
|
|
|
+ <div class={styles.content}>
|
|
|
|
+ {words.value.map((item: any, index: number) => (
|
|
|
|
+ <Tag
|
|
|
|
+ ref={(el: any) => (tagRef.value[index] = el)}
|
|
|
|
+ round
|
|
|
|
+ class={[styles.searchKeyword, 'van-ellipsis']}
|
|
|
|
+ key={item}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ keyword.value = item
|
|
|
|
+ onSearch(item)
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {item}
|
|
|
|
+ </Tag>
|
|
|
|
+ ))}
|
|
|
|
+ {collapse.line > 1 && (
|
|
|
|
+ <span
|
|
|
|
+ class={[styles.arrowMore]}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ collapse.arrowStatus = !collapse.arrowStatus
|
|
|
|
+ defaultClose()
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <Icon
|
|
|
|
+ name={
|
|
|
|
+ collapse.arrowStatus ? 'arrow-up' : 'arrow-down'
|
|
|
|
+ }
|
|
|
|
+ />
|
|
|
|
+ </span>
|
|
|
|
+ )}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- )}
|
|
|
|
|
|
+ )}
|
|
{route.path === '/music-songbook/search' && (
|
|
{route.path === '/music-songbook/search' && (
|
|
<Tabs
|
|
<Tabs
|
|
color="var(--van-primary)"
|
|
color="var(--van-primary)"
|
|
@@ -406,22 +450,6 @@ export default defineComponent({
|
|
)}
|
|
)}
|
|
<RouterView />
|
|
<RouterView />
|
|
|
|
|
|
- {/* 声部弹框 */}
|
|
|
|
- {/* <Popup
|
|
|
|
- show={subject.show}
|
|
|
|
- position="bottom"
|
|
|
|
- round
|
|
|
|
- closeable
|
|
|
|
- safe-area-inset-bottom
|
|
|
|
- onClose={() => (subject.show = false)}
|
|
|
|
- onClosed={() => (subject.show = false)}
|
|
|
|
- >
|
|
|
|
- <SelectSubject
|
|
|
|
- searchParams={subject}
|
|
|
|
- onComfirm={onComfirmSubject}
|
|
|
|
- />
|
|
|
|
- </Popup> */}
|
|
|
|
-
|
|
|
|
<div
|
|
<div
|
|
class={[styles.searchResult]}
|
|
class={[styles.searchResult]}
|
|
style={{ display: searchResultStatus.value ? 'block' : 'none' }}
|
|
style={{ display: searchResultStatus.value ? 'block' : 'none' }}
|