Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Commit

Permalink
修复歌曲切换后相关信息显示错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
maicong committed Mar 5, 2018
1 parent 0631d4b commit aa7a1e2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions static/js/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ $(function() {

// 申明变量
var player = null;
var playerList = [];
var nopic = 'static/img/nopic.jpg';
var qName = q('name');
var qId = q('id');
Expand Down Expand Up @@ -223,7 +224,11 @@ $(function() {
if (player) {
player.pause();
}
setValue(result.data[0]);

playerList = result.data;

setValue(playerList[0]);

$('#j-validator').slideUp();
$('#j-main').slideDown();

Expand All @@ -248,13 +253,14 @@ $(function() {
});
} else {
player.addMusic(result.data);
playerList = playerList.concat(result.data)
}

player.on('canplay', function() {
player.play();
});
player.on('play', function() {
var data = result.data[player.playIndex];
var data = playerList[player.playIndex];
var img = new Image();
img.src = data.pic;
img.onerror = function() {
Expand Down

0 comments on commit aa7a1e2

Please sign in to comment.