optimize first poster display

This commit is contained in:
DIYgod 2018-03-09 02:03:54 +08:00
parent 5e610b15e8
commit 591b6b5cff
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
3 changed files with 12 additions and 1 deletions

View File

@ -62,6 +62,7 @@ class APlayer {
this.template = new Template({
container: this.container,
options: this.options,
randomOrder: this.randomOrder,
});
if (this.template.info.offsetWidth < 200) {

View File

@ -5,13 +5,23 @@ class Template {
constructor (options) {
this.container = options.container;
this.options = options.options;
this.randomOrder = this.randomOrder;
this.init();
}
init () {
let pic;
if (this.options.order === 'random') {
pic = this.options.music[this.randomOrder[0]].pic;
}
else {
pic = this.options.music[0].pic;
}
this.container.innerHTML = tplPlayer({
options: this.options,
icons: Icons,
pic: pic,
});
this.lrc = this.container.querySelector('.aplayer-lrc-contents');

View File

@ -1,4 +1,4 @@
<div class="aplayer-pic">
<div class="aplayer-pic"{{ if pic }} style="background-image: url("{{ pic }}");"{{ /if }}>
<div class="aplayer-button aplayer-play">{{@ icons.play }}</div>
</div>
<div class="aplayer-info">