Skip to content

Commit

Permalink
add searchback
Browse files Browse the repository at this point in the history
  • Loading branch information
hua1995116 committed Mar 29, 2017
1 parent b659df3 commit 768912b
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 116 deletions.
187 changes: 95 additions & 92 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div id="app">
<header>
<musicsearch v-on:musicsearch="showsong"></musicsearch>
<musicsearch v-on:musicsearch="showsong" v-on:openmusicsong="showsong"></musicsearch>
<ul>
<li class="head-li" @click="move('/')">个性推荐</li>
<li class="head-li" @click="move('/music')">歌单</li>
Expand Down
17 changes: 9 additions & 8 deletions src/components/Musicmenu/Musicmenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,18 @@ export default{
},
openmusicsong(index, item) {
this.number = index;
var obj;
if (item) {
obj = {
id: item.id,
migUrl: item.al.picUrl,
name: item.ar[0].name,
songname: item.name
};
} else {
item = null;
obj = null;
}
var obj = {
id: item.id,
migUrl: item.al.picUrl,
name: item.ar[0].name,
songname: item.name
};
this.$emit('openmusicsong', obj);
},
setmusiclist(item) {
Expand Down
29 changes: 15 additions & 14 deletions src/components/Musicsong/Musicsong.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@
},
song: {},
audiourl: '',
albumPic: '',
songname: '',
albumPic: '../../../static/img/placeholder_disk_play_song.png',
songname: '暂无歌曲',
list: []
};
},
created() {
this.$nextTick(() => {
this.canPlaySong();
});
},
methods: {
pre() {
Expand All @@ -132,17 +135,12 @@
},
_initScroll() {
if (!this.songlistScroll) {
console.log(this.$refs.songlistWrapper);
this.songlistScroll = new BScroll(this.$refs.songlistWrapper, {
probeType: 3,
click: true
});
} else {
this.songlistScroll.refresh();
}
this.songlistScroll.on('scroll', (pos) => {
console.log(Math.abs(Math.round(pos.y)));
});
},
nulllist() {
this.list.splice(0, this.list.length);
Expand Down Expand Up @@ -187,6 +185,9 @@
this.name = item.name;
if (item.audiosrc !== undefined) {
this.audiourl = item.audiosrc;
this.$nextTick(() => {
this.canPlaySong();
});
} else {
this.get(item);
}
Expand Down Expand Up @@ -214,7 +215,7 @@
this.showFlag = false;
},
togglePlay() {
if (!this.playing) {
if (this.playing === false) {
document.getElementById('audioPlay').pause();
this.playing = true;
} else {
Expand All @@ -230,12 +231,12 @@
this.tipshow = true;
} else {
this.tipshow = false;
}
this.mwidth = time / timelength * 100;
this.time.start = changeTime(time);
this.time.end = changeTime(timelength);
if (timelength === time) {
this.togglePlay();
this.mwidth = time / timelength * 100;
this.time.start = changeTime(time);
this.time.end = changeTime(timelength);
if (timelength === time) {
this.togglePlay();
}
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/musicsearch/musicsearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="music" @click="hidelist">
<span v-show="lshow">取消</span>
<img src="../../../static/img/ph.png" alt="" v-show="!lshow">
<img src="../../../static/img/ph.png" alt="" v-show="!lshow" @click="openmusicsong">
</div>
</div>
<div class="searchresult" v-show="lshow">
Expand Down Expand Up @@ -51,8 +51,13 @@ export default{
this.lshow = true;
},
hidelist() {
document.getElementById('inputvalue').value = '';
this.lshow = false;
},
openmusicsong() {
var obj = null;
this.$emit('openmusicsong', obj);
},
opensong(item) {
if (item) {
Expand Down
Binary file added static/img/placeholder_disk_play_song.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 768912b

Please sign in to comment.