load random covers
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Artem Anufrij 2023-09-27 16:51:44 +02:00
parent 02e13cb642
commit 7ebce51c2d
6 changed files with 17 additions and 7 deletions

View File

@ -1,5 +1,5 @@
{
"backend_de": "http://localhost:31204",
"backend_dev": "https://webplay.rocks",
"backend_dev": "http://localhost:31204",
"backend_de": "https://webplay.rocks",
"backend": "https://webplay.rocks"
}

View File

@ -176,5 +176,10 @@ export default {
resolve();
});
});
},
loadRandomCovers(context, count) {
axios.get(context.rootGetters.server + "/api/albums/random/" + count, context.rootGetters.headers).then((res) => {
context.commit("setRandomCovers", res.data);
});
}
}

View File

@ -32,5 +32,8 @@ export default {
},
newest(state) {
return state.newest;
},
randomCovers(state) {
return state.randomCovers;
}
}

View File

@ -76,5 +76,8 @@ export default {
}
});
state.newest = albums;
},
setRandomCovers(state, covers) {
state.randomCovers = covers;
}
}

View File

@ -2,6 +2,7 @@ export default {
collection: [],
newest: [],
selectedAlbum: { tracks: [], covers: {}, share: {} },
randomCovers: [],
page: 1,
loading: false,
eos: false

View File

@ -8,9 +8,7 @@
<animateTransform id="animY1" attributeName="transform" type="translate" begin="0s; animY2.end" from="-40 -20" to="0 0" dur="30s" />
<animateTransform id="animY2" attributeName="transform" type="translate" begin="animY1.end" from="0 0" to="-40 -20" dur="30s" />
<image :xlink:href="item.covers.cover128" :x="i * 64" y="0" width="64" height="64" v-for="(item, i) in albums" :key="item" />
<image :xlink:href="item.covers.cover256" :x="i * 128" y="64" width="128" v-for="(item, i) in artists" :key="item" />
<image :xlink:href="item.covers.cover128 || item.covers.cover256" :x="i * 64" y="128" v-for="(item, i) in history" :key="item" />
<image :xlink:href="item.covers.cover64" :x="i * 64" y="0" width="64" height="64" v-for="(item, i) in randomCovers" :key="item" />
</g>
</svg>
</div>
@ -115,6 +113,7 @@ export default {
this.$store.dispatch("tracks/loadMostListened");
this.$store.dispatch("videos/loadMostViewed");
this.$store.dispatch("albums/loadRandomCovers", 24);
this.$store.dispatch("albums/loadAlbums", true);
this.$store.dispatch("artists/loadArtists", true);
},
@ -151,8 +150,7 @@ export default {
serverInfo: "serverInfo",
mostListened: "tracks/mostListened",
mostViewed: "videos/mostViewed",
albums: ["albums/collection"],
artists: ["artists/collection"],
randomCovers: ["albums/randomCovers"],
}),
historyToggleText() {
return this.historyAll ? "less..." : "more...";