Skip to content

Commit

Permalink
coment post getting an issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrolopeshlsSENAI committed Oct 8, 2020
1 parent df0619c commit fb85d13
Showing 1 changed file with 51 additions and 27 deletions.
78 changes: 51 additions & 27 deletions src/components/cpmCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
<v-expansion-panel>
<v-expansion-panel-header>Comentários</v-expansion-panel-header>
<v-expansion-panel-content>

<div v-if="cardDataArray[0].comments != '' ">
<div class="d-flex" v-for="(item, i) in cardDataArray" :key="i">

Expand All @@ -50,26 +49,30 @@

<div>

Lorem ipsum, dolor sit amet consectetur adipisicing elit. Rerum, magni dicta. Dignissimos doloribus cum, similique corrupti consequatur quod! Deserunt, sequi!
<!-- {{ userData }} -->
<!-- <v-avatar size="36" color="orange">
<v-icon v-if="!item.comments[i].user.avatar" dark>mdi-account-circle</v-icon>
<img v-else :src="item.comments[i].user.avatar" alt="avatar">
</v-avatar>
<v-textarea
outlined
v-model="newComent"
color="black"
label="Comentário"
:counter="500"
></v-textarea>
<div class="d-flex">
<v-avatar size="36" color="orange" class="mr-4">
<v-icon v-if="!userData.avatar" dark>mdi-account-circle</v-icon>
<img v-else :src="userData.avatar" alt="avatar">
</v-avatar>

<v-textarea
outlined
v-model="newComent"
class="text-area-coment"
:counter="500"
auto-grow
filled
color="black"
label="Comente no evento 🗯"
rows="1"
></v-textarea>
</div>

<div class="d-flex justify-space-between">
<v-btn color="orange" dark class="ml-a" @click="createComent">
<v-btn color="orange" dark class="ml-a" @click="createComent(cardData)">
Enviar
</v-btn>
</div> -->
</div>

</div>
</v-expansion-panel-content>
Expand All @@ -88,20 +91,43 @@ export default {
props: ['cardData'],
data:() => ({
cardDataArray: [],
newComent:''
newComent:'',
url: process.env.VUE_APP_BASE_URL,
}),
computed:{
...mapGetters({
userData: 'userData'
userData: 'FeedVuex/userData'
})
},
methods:{
createComent(){
createComent(param){
if(!this.newComent){
this.$toast.error("Verifique se existe algum campo vazio", "Atenção!", {
position: "topCenter",
});
}
else{
let body = {
comment:this.newComent
}
let eventId = param.id
console.log(this.url + `/comment/${eventId}`, body)
this.$http.post(this.url + `/comment/${eventId}`, body).then(resp => {
console.log(resp)
})
this.$http.post(this.uploadUrl + '/upload/image', fd)
.then(resp => {
console.log(resp)
this.eventForm.img = resp.data
})
}
}
},
Expand All @@ -112,10 +138,8 @@ export default {
}
</script>

<style lang="scss" scoped>
<style lang="scss">
.text-area-coment{
}
</style>

0 comments on commit fb85d13

Please sign in to comment.