新增定位当前播放歌曲
parent
59091a5ea9
commit
b7eba95ab2
|
@ -1,3 +1,4 @@
|
||||||
#### 新增
|
#### 新增
|
||||||
|
|
||||||
- 新增窗口大小设置,若觉得软件窗口小可以到设置页调大点
|
- 新增窗口大小设置,若觉得软件窗口小可以到设置页调大点
|
||||||
|
- 新增定位当前播放歌曲,点击播放栏左侧的**歌曲图片**可在播放列表定位当前播放的歌曲(该功能对播放下载列表的歌曲无效)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
div(:class="$style.player")
|
div(:class="$style.player")
|
||||||
div(:class="$style.left")
|
div(:class="$style.left" @click="handleToMusicLocation")
|
||||||
img(v-if="musicInfo.img" :src="musicInfo.img" @error="imgError")
|
img(v-if="musicInfo.img" :src="musicInfo.img" @error="imgError")
|
||||||
svg(v-else version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='100%' height='100%' viewBox='0 0 60 60' space='preserve')
|
svg(v-else version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='100%' height='100%' viewBox='0 0 60 60' space='preserve')
|
||||||
use(:xlink:href='`#${$style.iconPic}`')
|
use(:xlink:href='`#${$style.iconPic}`')
|
||||||
|
@ -492,6 +492,17 @@ export default {
|
||||||
handleResize() {
|
handleResize() {
|
||||||
this.setProgessWidth()
|
this.setProgessWidth()
|
||||||
},
|
},
|
||||||
|
handleToMusicLocation() {
|
||||||
|
if (this.listId == 'download') return
|
||||||
|
if (this.playIndex == -1) return
|
||||||
|
this.$router.push({
|
||||||
|
path: 'list',
|
||||||
|
query: {
|
||||||
|
id: this.listId,
|
||||||
|
scrollIndex: this.playIndex,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -520,6 +531,14 @@ export default {
|
||||||
transition-property: color;
|
transition-property: color;
|
||||||
flex: none;
|
flex: none;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
|
opacity: 1;
|
||||||
|
transition: @transition-theme;
|
||||||
|
transition-property: opacity;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: .8;
|
||||||
|
}
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
fill: currentColor;
|
fill: currentColor;
|
||||||
|
|
|
@ -4,11 +4,12 @@ import Router from 'vue-router'
|
||||||
import paths from './paths'
|
import paths from './paths'
|
||||||
|
|
||||||
|
|
||||||
function route(path, view, name, meta) {
|
function route(path, view, name, meta, props) {
|
||||||
return {
|
return {
|
||||||
name: name || view,
|
name: name || view,
|
||||||
path,
|
path,
|
||||||
meta,
|
meta,
|
||||||
|
props,
|
||||||
component: (resovle) => import(
|
component: (resovle) => import(
|
||||||
`../views/${view}.vue`
|
`../views/${view}.vue`
|
||||||
).then(resovle),
|
).then(resovle),
|
||||||
|
@ -19,7 +20,7 @@ Vue.use(Router)
|
||||||
|
|
||||||
const router = new Router({
|
const router = new Router({
|
||||||
mode: 'hash',
|
mode: 'hash',
|
||||||
routes: paths.map(path => route(path.path, path.view, path.name, path.meta)).concat([
|
routes: paths.map(path => route(path.path, path.view, path.name, path.meta, path.props)).concat([
|
||||||
{ path: '*', redirect: '/search' },
|
{ path: '*', redirect: '/search' },
|
||||||
]),
|
]),
|
||||||
linkActiveClass: 'active-link',
|
linkActiveClass: 'active-link',
|
||||||
|
|
|
@ -26,6 +26,7 @@ export default [
|
||||||
path: '/list',
|
path: '/list',
|
||||||
name: 'list',
|
name: 'list',
|
||||||
view: 'List',
|
view: 'List',
|
||||||
|
// props: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/download',
|
path: '/download',
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
div.scroll(:class="$style.tbody" @scroll="handleScroll" ref="dom_scrollContent")
|
div.scroll(:class="$style.tbody" @scroll="handleScroll" ref="dom_scrollContent")
|
||||||
table
|
table
|
||||||
tbody
|
tbody
|
||||||
tr(v-for='(item, index) in list' :key='item.songmid'
|
tr(v-for='(item, index) in list' :key='item.songmid' :id="'mid_' + item.songmid"
|
||||||
@click="handleDoubleClick(index)" :class="[isPlayList && playIndex === index ? $style.active : '', (isAPITemp && item.source != 'kw') ? $style.disabled : '']")
|
@click="handleDoubleClick(index)" :class="[isPlayList && playIndex === index ? $style.active : '', (isAPITemp && item.source != 'kw') ? $style.disabled : '']")
|
||||||
td.nobreak.center(style="width: 37px;" @click.stop)
|
td.nobreak.center(style="width: 37px;" @click.stop)
|
||||||
material-checkbox(:id="index.toString()" v-model="selectdData" :value="item")
|
material-checkbox(:id="index.toString()" v-model="selectdData" :value="item")
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapMutations, mapGetters, mapActions } from 'vuex'
|
import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||||
import { throttle, asyncSetArray } from '../utils'
|
import { throttle, asyncSetArray, scrollTo } from '../utils'
|
||||||
export default {
|
export default {
|
||||||
name: 'List',
|
name: 'List',
|
||||||
data() {
|
data() {
|
||||||
|
@ -69,6 +69,7 @@ export default {
|
||||||
isShowListAdd: false,
|
isShowListAdd: false,
|
||||||
isShowListAddMultiple: false,
|
isShowListAddMultiple: false,
|
||||||
delayTimeout: null,
|
delayTimeout: null,
|
||||||
|
isToggleList: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -125,9 +126,18 @@ export default {
|
||||||
list() {
|
list() {
|
||||||
this.resetSelect()
|
this.resetSelect()
|
||||||
},
|
},
|
||||||
|
'$route.query.scrollIndex'(n) {
|
||||||
|
if (n == null || this.isToggleList) return
|
||||||
|
this.restoreScroll(true)
|
||||||
|
this.isToggleList = true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
beforeRouteUpdate(to, from, next) {
|
beforeRouteUpdate(to, from, next) {
|
||||||
if (to.query.id === undefined) return
|
if (to.query.id == null) return
|
||||||
|
else if (to.query.id == this.listId) {
|
||||||
|
if (to.query.scrollIndex != null) this.isToggleList = false
|
||||||
|
return next()
|
||||||
|
}
|
||||||
this.delayShow = false
|
this.delayShow = false
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.listId = to.query.id
|
this.listId = to.query.id
|
||||||
|
@ -195,14 +205,29 @@ export default {
|
||||||
this.delayTimeout = null
|
this.delayTimeout = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
restoreScroll() {
|
restoreScroll(isAnimation) {
|
||||||
if (!this.list.length) return
|
if (!this.list.length) return
|
||||||
let location = this.setting.list.scroll.locations[this.listId]
|
if (this.$route.query.scrollIndex == null) {
|
||||||
if (this.setting.list.scroll.enable && location) {
|
let location = this.setting.list.scroll.locations[this.listId]
|
||||||
this.$nextTick(() => {
|
if (this.setting.list.scroll.enable && location) {
|
||||||
this.$refs.dom_scrollContent.scrollTo(0, location)
|
this.$nextTick(() => {
|
||||||
})
|
this.$refs.dom_scrollContent.scrollTo(0, location)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
let location = this.getMusicLocation(this.$route.query.scrollIndex) - 200
|
||||||
|
if (location < 0) location = 0
|
||||||
|
isAnimation ? scrollTo(this.$refs.dom_scrollContent, location) : this.$refs.dom_scrollContent.scrollTo(0, location)
|
||||||
|
this.$router.replace({
|
||||||
|
path: 'list',
|
||||||
|
query: {
|
||||||
|
id: this.listId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
handleDoubleClick(index) {
|
handleDoubleClick(index) {
|
||||||
if (
|
if (
|
||||||
|
@ -292,6 +317,10 @@ export default {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getMusicLocation(index) {
|
||||||
|
let dom = document.getElementById('mid_' + this.list[index].songmid)
|
||||||
|
return dom ? dom.offsetTop : 0
|
||||||
|
},
|
||||||
// handleScroll(e) {
|
// handleScroll(e) {
|
||||||
// console.log(e.target.scrollTop)
|
// console.log(e.target.scrollTop)
|
||||||
// },
|
// },
|
||||||
|
|
|
@ -46,8 +46,8 @@ div.scroll(:class="$style.setting")
|
||||||
h3 是否显示歌曲源(仅对我的音乐分类有效)
|
h3 是否显示歌曲源(仅对我的音乐分类有效)
|
||||||
div
|
div
|
||||||
material-checkbox(id="setting_list_showSource_enable" v-model="current_setting.list.isShowSource" label="是否显示")
|
material-checkbox(id="setting_list_showSource_enable" v-model="current_setting.list.isShowSource" label="是否显示")
|
||||||
dd(title='是否恢复播放列表滚动条位置')
|
dd(title='是否记住播放列表滚动条位置')
|
||||||
h3 恢复列表滚动位置(仅对我的音乐分类有效)
|
h3 记住列表滚动位置(仅对我的音乐分类有效)
|
||||||
div
|
div
|
||||||
material-checkbox(id="setting_list_scroll_enable" v-model="current_setting.list.scroll.enable" label="是否启用")
|
material-checkbox(id="setting_list_scroll_enable" v-model="current_setting.list.scroll.enable" label="是否启用")
|
||||||
//- dd(title='播放列表是否显示专辑栏')
|
//- dd(title='播放列表是否显示专辑栏')
|
||||||
|
|
Loading…
Reference in New Issue