diff --git a/src/store/modules/albums/actions.js b/src/store/modules/albums/actions.js index 301ddb5..90bb4f6 100644 --- a/src/store/modules/albums/actions.js +++ b/src/store/modules/albums/actions.js @@ -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); + }); } } \ No newline at end of file diff --git a/src/store/modules/albums/getters.js b/src/store/modules/albums/getters.js index 94440bf..cecc746 100644 --- a/src/store/modules/albums/getters.js +++ b/src/store/modules/albums/getters.js @@ -32,5 +32,8 @@ export default { }, newest(state) { return state.newest; + }, + randomCovers(state) { + return state.randomCovers; } } \ No newline at end of file diff --git a/src/store/modules/albums/mutations.js b/src/store/modules/albums/mutations.js index dafa403..c1c8222 100644 --- a/src/store/modules/albums/mutations.js +++ b/src/store/modules/albums/mutations.js @@ -76,5 +76,8 @@ export default { } }); state.newest = albums; + }, + setRandomCovers(state, covers) { + state.randomCovers = covers; } } \ No newline at end of file diff --git a/src/store/modules/albums/state.js b/src/store/modules/albums/state.js index e504bbe..6fb4e5f 100644 --- a/src/store/modules/albums/state.js +++ b/src/store/modules/albums/state.js @@ -2,6 +2,7 @@ export default { collection: [], newest: [], selectedAlbum: { tracks: [], covers: {}, share: {} }, + randomCovers: [], page: 1, loading: false, eos: false diff --git a/src/views/Home.vue b/src/views/Home.vue index a3ac45e..0215f5d 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -2,30 +2,29 @@
- - + +
-
+
@@ -160,6 +112,11 @@ export default { this.$store.dispatch("boxes/loadNewest"); this.$store.dispatch("tracks/loadMostListened"); this.$store.dispatch("videos/loadMostViewed"); + if (this.randomCovers.length == 0) { + this.$store.dispatch("albums/loadRandomCovers", 48); + this.$store.dispatch("albums/loadAlbums", true); + this.$store.dispatch("artists/loadArtists", true); + } }, loadNextPage() { this.scrollPosition = this.$refs.welcome.scrollTop; @@ -194,6 +151,7 @@ export default { serverInfo: "serverInfo", mostListened: "tracks/mostListened", mostViewed: "videos/mostViewed", + randomCovers: ["albums/randomCovers"], }), historyToggleText() { return this.historyAll ? "less..." : "more..."; @@ -221,4 +179,17 @@ export default { #history.more { max-height: initial; } + +#banner { + position: relative; +} + +#collage { + bottom: 0; + top: 0; + left: 0; + right: 0; + opacity: 0.2; + position: absolute; +} \ No newline at end of file