Commit 4db6a27f authored by Yuki's avatar Yuki
Browse files

Integrate comment

parent c0ba8fe4
<template>
<div>
<section>
<v-row no-gutters>
<v-img
:min-height="'calc(100vh - ' + $vuetify.application.top + 'px)'"
src="https://picsum.photos/1920/1080"
gradient="to top right, rgba(100,115,201,.33), rgba(25,32,72,.7)"
>
<v-theme-provider dark>
<v-container fill-height>
<v-row align="center" class="white--text mx-auto" justify="center">
<v-col class="white--text text-center" cols="12" tag="h1">
<span class="display-4 font-weight-black">
Leave a review
</span>
<br>
<span class="font-weight-light">
We hope you love your new product!
</span>
</v-col>
<v-theme-provider light>
<v-card class="pa-2">
<v-card-title>Review {{ product.name }}</v-card-title>
<v-card-text>
<v-rating
v-model="rating"
class="mt-1"
color="amber"
half-increments
size="64"
></v-rating>
<v-textarea v-model="comment" placeholder="Leave your review here"></v-textarea>
</v-card-text>
<v-card-actions>
<v-btn block color="primary" @click="send">Send</v-btn>
</v-card-actions>
</v-card>
</v-theme-provider>
</v-row>
</v-container>
</v-theme-provider>
</v-img>
</v-row>
</section>
</div>
</template>
<script>
import CartAddSheet from '../../components/CartAddSheet.vue'
export default {
components: { CartAddSheet },
data() {
return {
product: {},
rating: 0,
comment: '',
}
},
computed: {
breadcrumbs() {
return [
{
text: 'Nyanazon',
disabled: false,
href: '/'
},
{
text: this.category.name,
disabled: false,
href: `/categories/${this.category.id}`
}
]
}
},
watch: {
product(value) {
this.$axios
.get(`/api/category/${value.category}/`)
.then((res) => res.data)
.then((data) => this.category = data)
}
},
mounted() {
this.$axios
.get(`/api/product/${this.$route.params.id}/`)
.then((res) => res.data)
.then((data) => this.product = data)
},
methods: {
send() {
this.$axios
.post(`/api/comment/`, {
product: this.product.id,
comment: this.comment,
rating: Math.round(this.rating * 2),
})
.then((res) => this.$router.push('/'))
}
}
}
</script>
<style>
p {
text-align: justify;
}
</style>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment