Новости

This commit is contained in:
iriska-gri committed 2023-12-14 09:08:31 +03:00
1 parent 78b1c830ed
commit 31b1a9e1c5
5 files changed
+357 -6

No files matched your search

+1 -1
View File
@@ -143,7 +143,7 @@ export default {
},
setup(p
setup(props
, context) {
const accountStore = useAccountStore()
@@ -13,7 +13,9 @@
cols=12
class="d-flex pa-1 flex-column "
>
<news-card :news="x"/>
<my-helper :pretext="x"/>
</v-col>
</v-row>
<v-row class="flex-grow-0 ">
+350 -2
View File
@@ -1,19 +1,367 @@
<template>
<div>{{route.query['id']}}</div>
<div class="d-flex flex-column flex-fill">
<v-row class="d-flex flex-column ">
<v-col class=" flex-column d-flex ">
<v-row class="flex-grow-0">
<v-col class="pb-0 pr-0 ">
<v-card
height="350px"
class="rounded-b-0"
>
<v-card-title class="pt-0 pb-1 flex-column d-flex">
<v-row>
<v-col lg=10 class="pt-4">
{{newsFull.title}}
</v-col>
<v-col class="pa-0 pr-3 pt-1 flex-grow-1 d-flex flex-column flex-wrap">
<v-switch
v-model="gallery"
class="align-self-end comgal"
hide-details
>
<template v-slot:prepend>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-icon
v-bind="props"
icon='mdi-message-text-outline'
color="pink-darken-4"
/>
</template>
<span>Чат</span>
</v-tooltip>
</template>
<template v-slot:append>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<v-icon
v-bind="props"
:icon="'mdi-image'"
color="teal-darken-2"
/>
</template>
<span>Галерея</span>
</v-tooltip>
</template>
</v-switch>
</v-col>
</v-row>
</v-card-title>
<v-img
:src="`${burl}${newsFull.link}`"
height="450px"
width="96%"
class="mx-auto"
cover
/>
</v-card>
</v-col>
</v-row>
<!-- <v-row>
<v-col class="pt-0 pr-0">
<v-card
class="rounded-t-0 flex-column d-flex h-100 Line truncated
>
<v-list-item class="w-100">
<template v-slot:prepend>
<v-avatar
color="loading_avatar"
:image="checkremote( `${spravURL}${newsFull.author.login}.jpg`)"
size="25"
>
</v-avatar>
<v-list-item-title class="text-caption">{{splitname(newsFull.author)}}</v-list-item-title>
</template>
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'" @click="toggleIncrementLike(newsFull.id, true)"></v-icon>
<span class="subheading me-2">{{newsFull.scores.filter(e=> e.score==true).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" :icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(newsFull.id, false)"/>
<span class="subheading me-2">{{newsFull.scores.filter(e=> e.score==false).length}}</span>
<span class="me-1">·</span>
<v-icon class="me-1" icon="mdi-message-text-outline"/>
<span class="subheading">{{ newsFull.comment.length }}</span>
</div>
</template>
</v-list-item>
<v-divider/>
<v-row class="ma-0 my-3 overflow-auto h-0">
<v-col class="pa-0">
<v-card-text class="pt-0">
<div v-if="newsFull.text" v-html=formatText(newsFull.text)>
</div>
<div v-else>
<v-row>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Без описания
</v-col>
</v-row>
</div>
</v-card-text>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
<v-col class="flex-column d-flex "
>
<v-row
class="d-flex flex-column "
v-if="gallery"
>
<v-col class="d-flex flex-column">
<v-card
class="h-100 flex-column d-flex overflow-auto overflow-x-hidden"
>
<div
class="flex-column d-flex ma-3"
>
<v-row style="height:250px" class="justify-space-between " v-if="newsFull.gallery.length>0">
<v-col
v-for="e in newsFull.gallery" :key=e
:lg="Math.floor(Math.random() * (Math.floor(5) - Math.ceil(3)) + Math.ceil(2))"
class="flex-column d-flex pa-0 pb-3"
>
<div
class='h-100 w-100 flex-column d-flex'
>
<v-row>
<v-col class="d-flex">
<v-img
cover
class=" pointer"
:src="`${burl}${e.img}`"
@click="openImg(e.id)"
/>
</v-col>
</v-row>
<v-row class="flex-grow-0 mt-0 align-self-center ">
<v-col class="pa-0 flex-grow-0">
<v-btn
density="compact"
variant="text"
size="small"
:color="heartIcoAll(e)?'red':'black'"
:icon= "heartIcoAll(e)?'mdi-heart':'mdi-heart-outline'"
@click = toggleLikeAll(e.id)
/>
</v-col>
<v-col class="pa-0 pl-1" >
{{e.likes.length}}
</v-col>
</v-row>
</div>
</v-col>
</v-row>
<v-row v-else>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
У новости нет фотографий
</v-col>
</v-row>
</div>
</v-card>
</v-col>
</v-row>
<v-row v-else>
<v-col class="">
<v-card
class="h-100 flex-column d-flex"
>
<v-row class="ma-0 my-3 overflow-auto h-0" v-if="newsFull.comment.length>0">
<v-col class="pa-0">
<v-card-text class="pt-0">
<div
v-for = "(y, key) in newsFull.comment"
:key="key"
class="d-flex flex-column pa-3"
>
<v-row
class="justify-space-between ma-0 align-center bgchat mr-7"
:class="accountStore.user.login==y.author.login?'bgchatnot':'bgchat'"
>
<v-col class="flex-grow-1 text-subtitle-2 pl-2 pa-0 "
>
{{ accountStore.user.login==y.author.login?'':splitname(y.author) }}
</v-col>
<v-col class="pa-0 text-center text-subtitle-2 ">
{{dateformat(y.cdate)}}
</v-col>
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
</v-col>
</v-row>
<div class="text-subtitle-2">
</div>
<v-row>
<v-col class="pr-0">
<v-alert
color="bg_white"
rounded=0
:border="accountStore.user.login==y.author.login?'end':'start'"
:border-color="accountStore.user.login==y.author.login?'success':'deep-purple accent-4'"
elevation=0
>
{{ y.text }}
</v-alert>
</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="delete_btn"
@click="deletComment(y.id, newsFull.id)"
/>
</v-col>
</v-row>
</div>
</v-card-text>
</v-col>
</v-row>
<v-row v-else>
<v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
>
Оставьте первый комментарий
</v-col>
</v-row>
<v-divider/>
<v-row class="flex-grow-0 ma-1">
<v-col>
<v-textarea
label="Комментарий"
no-resize
variant="underlined"
rows="2"
row-height="25"
shaped
hide-details
v-model="textcomment"
/>
</v-col>
<v-col class="flex-grow-0 pl-0 py-0 align-self-center">
<v-btn
variant="text"
density="compact"
icon="mdi-google-play"
color="teal-darken-4"
:disabled="textcomment==''"
@click="addComment(newsFull.id)"
/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>-->
</v-col>
</v-row>
</div>
</template>
<script>
import { useRoute } from 'vue-router'
import { axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue'
import { baseURL } from '@/utils/axios-api'
export default {
setup(){
const route = useRoute()
const newsFull=ref([])
const gallery = ref(false)
const burl = baseURL.slice(0,-1)
const loadNews = () => {
axiosApiInstance.get(`api/navigation/newscrossroad/?id=${route.query.id}`).then(result => {
newsFull.value=result.data.result[0]
// console.log(result.data.result[0], 'vvvvvvvvvvvvvvv');
// newss.value= result.data
// if (newss.value.result[0].gallery.length > 0) {
// newss.value.result[0].gallery.forEach(e=>
// e.bg=colors[Math.floor(Math.random() * colors.length)
// ]
// )
// gallery.value = true
// }
})
}
loadNews()
return {
route
route,
newsFull,
gallery,
burl
}
}
+2 -2
View File
@@ -186,7 +186,7 @@
<v-col v-else class="flex-column d-flex" v-for="(x, i) in newss.result" :key=i>
<v-row>
<v-col class=" flex-column d-flex">
<!-- <v-col class=" flex-column d-flex">
<v-row class="flex-grow-0">
<v-col class="pb-0 pr-0">
<v-card
@@ -496,7 +496,7 @@
</v-col>
</v-row>
</v-col>
</v-col> -->
</v-row>
</v-col>
<v-dialog