wip sharing view
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Artem Anufrij 2023-02-16 18:19:22 +01:00
parent dc83bd6c65
commit efef863e66
4 changed files with 68 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

@ -272,6 +272,7 @@ td.fillCell>* {
overflow: hidden;
text-overflow: ellipsis;
flex-grow: 1;
text-align: left;
}
.radioCover {
@ -593,6 +594,7 @@ td.fillCell>* {
.z1 {
z-index: 1;
}
.z2 {
z-index: 2;
}

View File

@ -2,8 +2,17 @@ import axios from 'axios'
export default {
get(context, id) {
axios.get(context.rootGetters.server + "/api/shares/" + id, context.rootGetters.headers).then((res) => {
console.log(res);
return new Promise((resolve) => {
axios.get(context.rootGetters.server + "/api/shares/" + id, context.rootGetters.headers).then((res) => {
if (res.data.object.type == "album") {
console.log(res.data)
res.data.object.tracks.forEach(track => {
track.parent = res.data.object;
track.parentType = "album"
});
}
resolve(res.data);
});
});
},
}

View File

@ -1,16 +1,66 @@
<template>
<div ref="share" id="share"></div>
<div ref="share" id="share" class="flex-column">
<div class="flex-column ma-horizontal">
<h1>{{ object.title }}</h1>
<h2>{{ object.artist_name }}</h2>
</div>
<div id="content" class="flex-row border-top">
<div>
<img id="cover" class="shadow ma24" :src="cover" />
</div>
<ul id="trackList" class="tracks">
<li v-for="track in object.tracks" :key="track._id">
<TrackItem :track="track" :showCover="false" />
</li>
</ul>
</div>
</div>
</template>
<script>
import TrackItem from "../components/Track";
export default {
name: "ShareView",
data() {
return {
object: {
covers: { cover256: "" },
},
};
},
mounted() {
if (this.$route.query.id) {
this.$store.dispatch("share/get", this.$route.query.id);
this.$store.dispatch("share/get", this.$route.query.id).then((res) => {
this.$nextTick(() => {
this.object = res.object;
});
});
} else {
this.$router.replace("/");
}
},
computed: {
cover() {
return this.object.covers.cover256;
},
},
components: {
TrackItem,
},
};
</script>
<style scoped>
#share {
overflow: auto;
}
#cover {
align-self: flex-start;
width: 256px;
align-self: center;
}
#content {
overflow: auto;
}
</style>