Новости с галереей
This commit is contained in:
1 parent
f9b5b7853b
commit
6505affae8
3 files changed
+196
-23
No files matched your search
@@ -7,6 +7,14 @@
|
||||
<v-card-title class="pb-1">
|
||||
{{news.title}}
|
||||
</v-card-title>
|
||||
|
||||
<!-- <my-helper :pretext="userlinks"/> -->
|
||||
<!-- <v-avatar
|
||||
color="loading_avatar"
|
||||
:image="checkremote( `${spravURL}${x.author.login}.jpg`)"
|
||||
size="25"
|
||||
>
|
||||
</v-avatar> -->
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col>
|
||||
<v-img
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
>
|
||||
|
||||
<news-card :news="x"/>
|
||||
<my-helper :pretext="x"/>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-0 ">
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
|
||||
<div class="d-flex flex-column flex-fill">
|
||||
|
||||
<v-row class="d-flex flex-column ma-0">
|
||||
<div v-if="Object.keys(newsFull).length>0" class="d-flex flex-column flex-fill">
|
||||
|
||||
<v-row class="d-flex flex-row ma-0">
|
||||
<v-col class=" flex-column d-flex ">
|
||||
<v-row class="flex-grow-0">
|
||||
<v-col class="pb-0 pr-0 ">
|
||||
@@ -12,11 +12,11 @@
|
||||
>
|
||||
<v-card-title class="pt-0 pb-1 flex-column d-flex">
|
||||
<v-row>
|
||||
<v-col lg=10 class="pt-4">
|
||||
<v-col lg=9 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">
|
||||
<!-- <my-helper :pretext="newsFull.text.length"/> -->
|
||||
|
||||
<v-switch
|
||||
v-model="gallery"
|
||||
class="align-self-end comgal"
|
||||
@@ -25,11 +25,13 @@
|
||||
<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"
|
||||
/>
|
||||
<span class="pl-3">{{ newsFull.comment.length }}</span>
|
||||
</template>
|
||||
<span>Чат</span>
|
||||
</v-tooltip>
|
||||
@@ -42,7 +44,9 @@
|
||||
:icon="'mdi-image'"
|
||||
color="teal-darken-2"
|
||||
/>
|
||||
<span class="pl-3">{{newsFull.gallery.length}}</span>
|
||||
</template>
|
||||
|
||||
<span>Галерея</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
@@ -66,7 +70,7 @@
|
||||
<v-card
|
||||
class="rounded-t-0 flex-column d-flex h-100 Line truncated
|
||||
>
|
||||
<!-- <v-list-item class="w-100">
|
||||
<v-list-item class="w-100">
|
||||
<template v-slot:prepend>
|
||||
<v-avatar
|
||||
color="loading_avatar"
|
||||
@@ -76,19 +80,16 @@
|
||||
</v-avatar>
|
||||
<v-list-item-title class="text-caption">{{splitname(newsFull.author)}}</v-list-item-title>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<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-list-item>
|
||||
<v-divider/>
|
||||
<v-row class="ma-0 my-3 overflow-auto h-0">
|
||||
<v-col class="pa-0">
|
||||
@@ -111,22 +112,22 @@
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<!--</v-col>
|
||||
<v-col class="flex-column d-flex "
|
||||
</v-col>
|
||||
<v-col class="flex-column d-flex "
|
||||
>
|
||||
|
||||
|
||||
|
||||
<v-row
|
||||
<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"
|
||||
class="h-100 flex-column pa-3 d-flex overflow-auto overflow-x-hidden"
|
||||
>
|
||||
<div
|
||||
<div
|
||||
class="flex-column d-flex ma-3"
|
||||
|
||||
|
||||
@@ -282,7 +283,7 @@
|
||||
label="Комментарий"
|
||||
no-resize
|
||||
variant="underlined"
|
||||
rows="2"
|
||||
rows="1"
|
||||
row-height="25"
|
||||
shaped
|
||||
hide-details
|
||||
@@ -304,10 +305,86 @@
|
||||
</v-row>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>-->
|
||||
</v-row>
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row>
|
||||
|
||||
<v-dialog
|
||||
v-model="dialogfoto"
|
||||
width="w-100"
|
||||
height="900"
|
||||
class="flex-column "
|
||||
>
|
||||
<v-card class="pa-4 h-100 flex-column d-flex">
|
||||
<v-row class="flex-grow-0 justify-space-between">
|
||||
<v-col class="py-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-cloud-download"
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="pa-0 flex-grow-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
@click="dialogfoto = false"
|
||||
|
||||
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="flex-grow-0 align-self-center">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-chevron-left"
|
||||
@click = "indximg !=0? indximg -=1:indximg=newsFull.gallery.length-1"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="flex-column h_cards pa-0">
|
||||
<v-img
|
||||
class="d-flex"
|
||||
:src="`${burl}${galleryimges.img}`"
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column flex-grow-0">
|
||||
|
||||
<v-row>
|
||||
<v-col class="flex-column d-flex align-end align-self-center">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
icon="mdi-chevron-right"
|
||||
@click = "indximg !=newsFull.gallery.length-1? indximg +=1:indximg=0"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="flex-grow-1 align-self-center d-flex placeIt">
|
||||
<v-col class="pa-0">
|
||||
<v-btn
|
||||
density="compact"
|
||||
variant="text"
|
||||
:color="heartIco()?'red':'black'"
|
||||
:icon= "heartIco()?'mdi-heart':'mdi-heart-outline'"
|
||||
@click = toggleLike(galleryimges.id)
|
||||
/>
|
||||
</v-col>
|
||||
<v-col class="pa-0 text-overline">
|
||||
{{galleryimges.likes.length}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@@ -315,11 +392,12 @@
|
||||
<script>
|
||||
import { useRoute } from 'vue-router'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { ref } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import {checkremote} from '@/utils/universal_functions'
|
||||
import { spravURL } from '@/utils/axios-api'
|
||||
import {useAccountStore} from '@/store/AccountStore'
|
||||
import { format } from 'date-fns'
|
||||
|
||||
const accountStore = useAccountStore()
|
||||
|
||||
@@ -330,7 +408,7 @@ export default {
|
||||
setup(){
|
||||
|
||||
|
||||
|
||||
const textcomment = ref('')
|
||||
const route = useRoute()
|
||||
const newsFull=ref([])
|
||||
const gallery = ref(false)
|
||||
@@ -371,6 +449,77 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
const dateformat = (datas) => {
|
||||
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
|
||||
}
|
||||
|
||||
const addComment = (idnew) => {
|
||||
|
||||
|
||||
|
||||
axiosApiInstance.post(`api/navigation/newscrossroad/`, {news: idnew, text: textcomment.value}).then(result => {
|
||||
newsFull.value.comment= result.data.comment
|
||||
})
|
||||
textcomment.value=""
|
||||
}
|
||||
|
||||
const deletComment = (id, news) => {
|
||||
axiosApiInstance.post(`api/navigation/newscrossroad/`, {delid: id, news: news}).then(result => {
|
||||
newsFull.value.comment= result.data.comment
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const heartIcoAll = (image) => {
|
||||
return image.likes.filter(e=>e.user==accountStore.user.login).length==1
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------ Галерея
|
||||
const galleryimges=ref([])
|
||||
const dialogfoto = ref(false)
|
||||
const indximg = ref('')
|
||||
|
||||
const openImg = (idimg) => {
|
||||
dialogfoto.value = true
|
||||
indximg.value = newsFull.value.gallery.findIndex(e=>e.id == idimg)
|
||||
}
|
||||
|
||||
watch(()=>indximg ,(newValue,oldValue)=>{
|
||||
if(newValue){
|
||||
galleryimges.value = newsFull.value.gallery[newValue.value]
|
||||
}
|
||||
|
||||
}, {deep:true})
|
||||
|
||||
|
||||
|
||||
|
||||
// Лайки на фотографии
|
||||
|
||||
const toggleLike = (idimage) => {
|
||||
axiosApiInstance.post(`api/navigation/gallery/`, {image: idimage}).then(result => {
|
||||
galleryimges.value.likes= result.data
|
||||
})
|
||||
}
|
||||
|
||||
const toggleLikeAll = (idimage) => {
|
||||
axiosApiInstance.post(`api/navigation/gallery/`, {image: idimage}).then(result => {
|
||||
newsFull.value.gallery.filter(e=>e.id ==idimage)[0].likes = result.data
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
const heartIco = () => {
|
||||
return galleryimges.value.likes.filter(e=>e.user==accountStore.user.login).length==1
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
|
||||
@@ -382,7 +531,19 @@ export default {
|
||||
spravURL,
|
||||
splitname,
|
||||
accountStore,
|
||||
formatText
|
||||
formatText,
|
||||
dateformat,
|
||||
textcomment,
|
||||
addComment,
|
||||
deletComment,
|
||||
heartIcoAll,
|
||||
heartIco,
|
||||
toggleLikeAll,
|
||||
toggleLike,
|
||||
openImg,
|
||||
dialogfoto,
|
||||
galleryimges,
|
||||
indximg
|
||||
|
||||
}
|
||||
}
|
||||
@@ -391,5 +552,9 @@ export default {
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.comgal .v-switch__thumb {
|
||||
|
||||
color: white!important;
|
||||
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user