Комметнарии

This commit is contained in:
iriska-gri committed 2023-10-09 17:00:12 +03:00
1 parent eb48b4360c
commit a5cf33553b
10 files changed
+163 -87

No files matched your search

+11 -11
View File
@@ -69,15 +69,15 @@ export default {
}
,
eventRender: function(eventObj, $el) {
$el.popover({
title: eventObj.title,
content: eventObj.description,
trigger: 'hover',
placement: 'top',
container: 'body'
});
},
// eventRender: function(eventObj, $el) {
// $el.popover({
// title: eventObj.title,
// content: eventObj.description,
// trigger: 'hover',
// placement: 'top',
// container: 'body'
// });
// },
// eventDidMount: function(info) {
@@ -120,7 +120,7 @@ export default {
data.data[x].map(e=>{
let d = new Date(e.planned_date)
// console.log(, 'e---------d.addDays(e.count_days)--------e')
calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]})
}
@@ -128,7 +128,7 @@ export default {
)
}
console.log(data.data , 'genvacation--------------------');
})
}
+97 -42
View File
@@ -3,15 +3,18 @@
<v-card
v-show="pages=='home'"
class="mx-auto mb-0 "
:ref="i"
class="mx-auto"
:class="i>0?'mt-1':''"
v-for="(x, i) in newss" :key= i
>
<v-list-item class="w-100 pl-4 py-2 pt-3">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
image="https://avataaars.io/?avatarStyle=Transparent&topType=ShortHairShortCurly&accessoriesType=Prescription02&hairColor=Black&facialHairType=Blank&clotheType=Hoodie&clotheColor=White&eyeType=Default&eyebrowType=DefaultNatural&mouthType=Default&skinColor=Light"
:image="accountStore.user.photo"
></v-avatar>
</template>
@@ -26,22 +29,52 @@
:src="`${burl}${x.link}`"
height="164px"
cover
width="96%"
width="92%"
class="mx-auto"
/>
<v-list-item class="w-100">
<template v-slot:append>
<div class="justify-self-end">
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.id && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(x.id, true)"></v-icon>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.id && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon size="x-small" class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
<span @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
</div>
</template>
</v-list-item>
<v-card-text class="py-3">
<v-card-text class="py-0">
{{limitText(x.text)}}
</v-card-text>
<v-card-actions>
<v-btn
color="#3E8890"
variant="text"
:to="'/news'"
>
Подробнее
</v-btn>
</v-card-actions>
<!-- :to="'/news'" -->
</v-card>
<!-- ---------------------------------------------------------------------------------- -->
<!-- ------------------------------ @click="scrollMeTo('porto')"---------------------------------------------------- -->
<v-card v-show="pages=='news'"
class="mx-auto rounded-0"
:ref="i"
v-for="(x, i) in newss" :key= i
>
<v-list-item class="w-100 pl-4 py-2 pt-3">
@@ -49,8 +82,7 @@
<v-avatar
color="grey-darken-3"
image="https://avataaars.io/?avatarStyle=Transparent&topType=ShortHairShortCurly&accessoriesType=Prescription02&hairColor=Black&facialHairType=Blank&clotheType=Hoodie&clotheColor=White&eyeType=Default&eyebrowType=DefaultNatural&mouthType=Default&skinColor=Light"
></v-avatar>
:image=accountStore.user.photo></v-avatar>
</template>
<v-list-item-title>{{x.author.fio}}</v-list-item-title>
@@ -101,28 +133,37 @@
<div
v-for = "(y, key) in x.comment"
:key="key"
class="d-flex flex-column py-3"
class="d-flex flex-column pa-3"
>
<!-- :class="accountStore.user.login==y.author.login?'text-end mr-6':''" -->
<v-row class="justify-space-between">
<v-col class="flex-grow-1 text-subtitle-2">{{ splitname(y.author) }}
<v-btn
variant="text"
size="small"
icon='mdi-delete'
color="blue-grey-darken-1"
@click="deletComment(y.id, x.id)"
/></v-col>
<v-col class="flex-grow-2 text-subtitle-2 order-3">{{dateformat(y.cdate)}} </v-col>
<v-col class="flex-grow-0"></v-col>
<v-col class="flex-grow-1 text-nowrap text-subtitle-2 pb-4"
>{{ splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 order-3">{{dateformat(y.cdate)}} </v-col>
</v-row>
<!-- <div style="text-align: center;">
<div style="display: inline-block; text-align: left;">
Centered
Content
</div>
</div> -->
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
<v-alert
class="comWy"
color="#f9f9f9"
:border="accountStore.user.login==y.author.login?'end':'start'"
@@ -133,14 +174,22 @@
{{ y.text }}
</v-alert>
<!-- <v-card
width="400"
:subtitle=splitname(y.author)
:text=y.text
elevation="1"
color="red"
></v-card> -->
</v-col>
<v-col class="flex-grow-0 d-flex pa-0 align-center"
:class="accountStore.user.login==y.author.login?'pa-0':'pa-5'"
>
<v-btn
v-if="accountStore.user.login==y.author.login"
variant="text"
size="small"
icon='mdi-delete'
color="blue-grey-darken-1"
@click="deletComment(y.id, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
@@ -154,6 +203,7 @@
</v-card>
<v-row justify="center">
<v-dialog
v-model="dialogCommentShow"
@@ -193,6 +243,7 @@
</v-card>
</v-dialog>
</v-row>
</v-container>
</template>
@@ -207,6 +258,7 @@ import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
const accountStore = useAccountStore()
export default {
@@ -219,7 +271,6 @@ export default {
}
},
setup(props){
const newss=ref([])
const dialogCommentShow = ref(false)
@@ -238,6 +289,10 @@ export default {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const newses =() => {
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
@@ -245,19 +300,19 @@ export default {
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
dialogCommentShow.value=!dialogCommentShow.value
newss.value[newss.value.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
console.log(result.data, 'result.data-----------------')
})
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
console.log(text.split(' ').slice(0, 25).join(' '));
console.log(t.length<25?'':'...');
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
@@ -270,15 +325,15 @@ export default {
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver("api/navigation/news/",newss)
getfromserver(`api/navigation/news/`,newss)
}
}, {deep:true})
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
// dialogCommentShow.value=!dialogCommentShow.value
newss.value[newss.value.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
console.log(result.data, 'result.data-----------------')
})
@@ -298,8 +353,8 @@ export default {
openComent,
addComment,
idnews,
deletComment
deletComment,
newses
}
}
@@ -312,7 +367,7 @@ export default {
height: 93vh;
}
.comWy {
/* .comWy {
width: 96%;
}
} */
</style>