Загрузка

This commit is contained in:
iriska-gri committed 2024-01-23 14:38:45 +03:00
1 parent 5a664524d8
commit 31b7ea59c3
19 files changed
+204 -1076

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "front",
"version": "0.0.41",
"version": "0.0.42",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "front",
"version": "0.0.41",
"version": "0.0.42",
"dependencies": {
"@mdi/font": "7.0.96",
"@vuelidate/core": "^2.0.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "front",
"version": "0.0.41",
"version": "0.0.42",
"scripts": {
"dev": "vite",
"build": "vite build",
@@ -11,45 +11,30 @@
/>
</v-card-text>
<v-divider/>
<v-row class="ma-3 h-100" no-gutters>
<v-card-text class="pa-0 d-flex flex-column h-100">
<v-row no-gutters>
<v-col lg=8 class="px-0 ">
<v-card-actions class="pa-0">
<v-list-item class="pt-2 pl-1">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${users.login}.jpg`)"
/>
</template>
<v-list-item-title class="pt-2">
{{users.fio}}
</v-list-item-title>
<v-list-item-subtitle class="pb-2">
{{users.post}}
</v-list-item-subtitle>
</v-list-item>
</v-card-actions>
<list-user :author=users />
</v-col>
<v-col class="pt-5 text-center">
<v-col class="pt-8 text-center">
<span class="subheading text-h6">
{{users.count}}
</span>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
import listUser from '@/components/UI//fiousercard/listUser.vue'
export default {
components: { listUser },
props: {
name: {
@@ -0,0 +1,44 @@
<template>
<div>
<v-icon
size="x-small"
class="me-1"
icon="mdi-account"
@click="open=true"
/>
<span class="text-caption me-2">
{{splitname(author)}}
</span>
<info-user-card
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
</template>
<script>
import {splitname} from '@/utils/universal_functions'
import { ref } from 'vue'
export default {
props: {
author: {
type: Object,
default: {}
}
},
setup() {
const open = ref(false)
return {
splitname,
open
}
}
}
</script>
<style>
</style>
@@ -0,0 +1,56 @@
<template>
<div style="height:68%">
<v-list-item class="pl-4 h-100 pointer" @click="open=true">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
/>
</template>
<v-list-item-title class="text-body-1 font-weight-medium pt-2">
{{author.fio}}
</v-list-item-title>
<v-list-item-subtitle class="pb-2">
{{author.post}}
</v-list-item-subtitle>
</v-list-item>
<info-user-card
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
</template>
<script>
import { ref } from 'vue'
import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
export default {
props: {
author: {
type: Object,
default: {}
},
},
setup(){
const open = ref(false)
return {
open,
checkremote,
spravURL
}
}
}
</script>
<style>
</style>
@@ -4,7 +4,6 @@
variant="text"
v-for="x in onlineuser"
:key="x"
height="50"
>
<v-avatar
@@ -30,11 +29,9 @@ import { baseWS } from '@/utils/axios-api'
import {useAccountStore} from '@/store/AccountStore'
import { spravURL } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
import InfoUserCard from './UI/infoUserCard.vue'
export default {
components: { InfoUserCard},
setup(){
const loging = ref('')
@@ -0,0 +1,48 @@
<template>
<div>
<v-card
class="bg-transparent"
density="compact"
:prepend-avatar="checkremote(`${spravURL}${author.login}.jpg`)"
:title="author.fio"
:subtitle="author.post"
variant="text" @click="open=true"
/>
<info-user-card
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
</template>
<script>
import { ref } from 'vue'
import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
export default {
props: {
author: {
type: Object,
default: {}
},
},
setup(){
const open = ref(false)
return {
open,
checkremote,
spravURL
}
}
}
</script>
<style>
</style>
+2 -1
View File
@@ -1,3 +1,4 @@
import myHelper from '@/components/UI/my-helper';
import InfoUserCard from '@/components/UI/infoUserCard.vue';
export default [myHelper]
export default [myHelper, InfoUserCard,]
@@ -82,6 +82,8 @@ import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
export default {
name: "InfoUserCard",
props: {
opendialog: {
type: Boolean,
+5 -10
View File
@@ -28,16 +28,8 @@
md=12
sm=12
>
<!-- <div class="d-flex">
<v-icon size="x-small" class="me-1" icon="mdi-account"/>
<p class="text-caption me-2">
{{splitname(news.author)}}
</p>
</div> -->
<v-icon size="x-small" class="me-1" icon="mdi-account"/>
<span class="text-caption me-2">
{{splitname(news.author)}}
</span>
<ico-user :author="news.author"/>
</v-col>
<v-col
lg=7
@@ -130,11 +122,14 @@ import {useAccountStore} from '@/store/AccountStore'
import { axiosApiInstance } from '@/utils/axios-api'
import {splitname} from '@/utils/universal_functions'
import moment from 'moment'
import icoUser from '@/components/UI/fiousercard/icoUser.vue'
const accountStore = useAccountStore()
export default {
components: { icoUser },
props: {
news: {
+11 -17
View File
@@ -49,21 +49,14 @@ class="px-3 ddd" >
<v-list class="py-0">
<v-list-subheader>{{key}} </v-list-subheader>
</v-list>
<div
v-for="item in x"
:key="item"
>
<list-user :author=item />
<!-- <vcard-user :author = item /> -->
</div>
<v-card
v-for="item in x"
:key="item"
class="bg-transparent "
density="compact"
:prepend-avatar="checkremote(`${spravURL}${item.login}.jpg`)"
:title="item.fio"
:subtitle="item.post"
variant="text"
@click="getcard(item.login)"
>
</v-card>
</div>
@@ -99,11 +92,12 @@ import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
import { axiosApiInstance } from '@/utils/axios-api'
import CardUsers from '@/components/cardUsers.vue'
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
import listUser from '@/components/UI//fiousercard/listUser.vue'
export default {
components: {
CardUsers
CardUsers, VcardUser,listUser
},
props: {
@@ -112,7 +106,7 @@ export default {
default: ''
},
namepos: {
type: Text,
type: String,
default: ''
}
+8 -18
View File
@@ -46,13 +46,7 @@
<v-card
v-else class="h-100 w-100 d-flex justify-center flex-column"
:image="`${burl}/media/newsimage/2023/09/28/sea.jpg`">
<!-- <v-img
:src="`${burl}/media/newsimage/2023/09/28/sea.jpg`"
gradient="to bottom, rgba(0,0,0,.1), rgba(0,0,0,.5)"
height="200px"
cover
> -->
<v-row class="flex-grow-0">
<v-col class="py-0">
<v-switch
@@ -65,10 +59,9 @@
</v-col>
</v-row>
<v-row class="ma-3">
<!-- <v-col class="fiction flex-column d-flex align-self-center"> -->
<v-card-text class="d-flex flex-column align-self-center " v-if="changeData">
<!-- <v-row> -->
<!-- <v-col class="pr-0"> -->
<v-file-input
accept=".xlsx"
@@ -79,9 +72,7 @@
hide-details
class="pt-2 ml-0 text-white"
/>
<!-- </v-col> -->
<!-- <v-col class="text-center"> -->
<v-btn
class="align-self-center"
icon="mdi-google-play text-white"
@@ -92,11 +83,10 @@
@click="onPickFile('roundfilse')"
/>
<!-- </v-col> -->
<!-- </v-row> -->
</v-card-text>
<v-card-text v-else class="w-100">
<!-- class="text-h5 text-white text-center h-100 text-sm-overline" -->
<v-row
class="text-white text-center text-lg-h5 h-100"
align-content="center"
@@ -106,9 +96,9 @@
</v-row>
</v-card-text>
<!-- </v-col> -->
</v-row>
<!-- </v-img> -->
@@ -50,13 +50,11 @@
import { ref } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { useRoute } from 'vue-router'
import myHelper from './UI/my-helper.vue'
import newsCard from './UI/news-card.vue'
export default {
components: {
myHelper,
newsCard
},
+6 -13
View File
@@ -81,14 +81,15 @@
>
<v-list-item class="w-100">
<template v-slot:prepend>
<v-avatar
<ico-user :author="newsFull.author"/>
<!-- <v-avatar
color="loading_avatar"
:image="checkremote(`${spravURL}${newsFull.author.login}.jpg`)"
size="25"
/>
<v-list-item-title class="text-caption pl-2">
{{splitname(newsFull.author)}}
</v-list-item-title>
</v-list-item-title> -->
</template>
<template v-slot:append>
<div class="justify-self-end">
@@ -244,7 +245,7 @@
{{dateformat(y.cdate)}}
</v-col>
<v-col class="pa-0 pr-2 text-end text-subtitle-2 ">
<v-col class="pa-0 text-end text-subtitle-2 " >
{{ accountStore.user.login!=y.author.login?'':splitname(y.author) }}
</v-col>
@@ -451,12 +452,13 @@ import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
import {useAccountStore} from '@/store/AccountStore'
import { format } from 'date-fns'
import icoUser from '@/components/UI/fiousercard/icoUser.vue'
const accountStore = useAccountStore()
export default {
components: { icoUser },
setup(){
@@ -472,15 +474,6 @@ export default {
axiosApiInstance.get(`api/navigation/newscrossroad/?id=${route.query.id}`).then(result => {
newsFull.value=result.data.result[0]
// 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)
// ]
// )
if (newsFull.value.gallery.length> 0) {
gallery.value = true
}
+1 -2
View File
@@ -75,7 +75,6 @@ import { ref, watch, onBeforeUpdate, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
import { useRoute } from 'vue-router'
@@ -83,7 +82,7 @@ import newsCard from './UI/news-card.vue'
const accountStore = useAccountStore()
export default {
components: { myHelper,
components: {
newsCard
},
-950
View File
@@ -1,950 +0,0 @@
<template>
<v-row class="justify-center">
<v-col
v-if="route.path == '/news' && 'id' in route.query?false:true"
class="flex-column"
lg="6"
>
<div class="d-flex flex-column py-3 h-100 ">
<v-row class=" flex-grow-1 d-flex h-0 overflow-auto">
<v-col class="pa-0 ">
<v-card
class=" rounded-0"
v-for="(x, i) in newss.result" :key=i
>
<v-card-title class="pt-0 pb-1">
{{x.title}}
</v-card-title>
<!-- :to='`/news?id=${x.id}`' -->
<v-btn
color="more_details_btn"
variant="text"
@click="nextnews(x.id)"
size="small"
append-icon="mdi-step-forward-2"
>
Подробнее
</v-btn>
<v-img
:src="`${burl}${x.link}`"
height="350px"
width="96%"
class="mx-auto"
cover
/>
<v-list-item class="w-100">
<template v-slot:prepend>
<v-avatar
color="loading_avatar"
:image="checkremote( `${spravURL}${x.author.login}.jpg`)"
size="25"
>
</v-avatar>
<v-list-item-title class="text-caption">{{splitname(x.author)}}</v-list-item-title>
</template>
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && 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 class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && 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 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>
<div >
<v-divider/>
<v-card-text>
<div v-html=formatText(x.text)>
</div>
</v-card-text>
<v-divider/>
<v-expand-transition>
<div v-show="x.showComment" v-if="x.comment.length>0">
<div
v-for = "(y, key) in x.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, x.id)"
/>
</v-col>
</v-row>
</div>
</div>
</v-expand-transition>
</div>
</v-card>
</v-col>
</v-row>
<v-row class="flex-grow-0" v-show="route.path == '/news' && 'id' in route.query?false:true">
<v-col class="ma-0 pa-0 pt-2">
<v-pagination
v-model="page"
:length="newss.allnews"
prev-icon="mdi-menu-left"
next-icon="mdi-menu-right"
@click="pagelistNews"
/>
</v-col>
<v-col class="ma-0 flex-grow-0 mwidth mt-1 pa-0">
<v-select
hide-details
density="compact"
v-model="selecnews"
variant="underlined"
:items="['10', '20', '30', '40', '100']"
/>
</v-col>
</v-row>
</div>
</v-col>
<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-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"> {{x.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}${x.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}${x.author.login}.jpg`)"
size="25"
>
</v-avatar>
<v-list-item-title class="text-caption">{{splitname(x.author)}}</v-list-item-title>
</template>
<template v-slot:append>
<div class="justify-self-end">
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && 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 class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && 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 class="me-1" icon="mdi-message-text-outline"/>
<span class="subheading">{{ x.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="x.text" v-html=formatText(x.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="x.gallery.length>0">
<v-col
v-for="e in x.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="x.comment.length>0">
<v-col class="pa-0">
<v-card-text class="pt-0">
<div
v-for = "(y, key) in x.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, x.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(x.id)"
/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col> -->
</v-row>
</v-col>
<v-dialog
v-model="dialogCommentShow"
persistent
width="550"
>
<v-card>
<v-card-title class="text-h5">
Прокоментировать новость
</v-card-title>
<v-card-text>
<v-textarea
variant="solo"
hide-details
rows="5"
v-model="textcomment"
></v-textarea>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="modal_btn"
variant="text"
@click="dialogCommentShow = false"
>
Отмена
</v-btn>
<v-btn
color="modal_btn"
variant="text"
@click="addComment(idnews)"
>
Отправить
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<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=newss.result[0].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 !=newss.result[0].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>
</v-row>
</template>
<script>
import {checkremote} from '@/utils/universal_functions'
import { ref, watch, onBeforeUpdate, onMounted } from 'vue'
import {useAccountStore} from '@/store/AccountStore'
import {getfromserver} from '@/utils/universal_functions'
import { baseURL } from '@/utils/axios-api'
import myHelper from './UI/my-helper.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import { format } from 'date-fns'
import { useRoute } from 'vue-router'
import { spravURL } from '@/utils/axios-api'
const accountStore = useAccountStore()
export default {
components: { myHelper},
setup(){
const divs = ref([])
onBeforeUpdate(() => {
divs.value = []
})
const newss=ref([])
const dialogCommentShow = ref(false)
const gallery = ref(false)
const burl = baseURL.slice(0,-1)
const textcomment = ref('')
const idnews = ref(0)
const page = ref(1)
const selecnews = ref(6)
const route = useRoute()
const colors = []
const switchComGal =ref(false)
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
if (route.path == '/news' && 'id' in route.query){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}&id=${route.query.id}`
}
getfromserver(str, newss)
const loadNews = (path) => {
axiosApiInstance.get(path).then(result => {
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(str)
const toggleIncrementLike = (news, scores) => {
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==news)].scores= result.data
})
}
const addComment = (idnew) => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnew, text: textcomment.value}).then(result => {
dialogCommentShow.value=false
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
textcomment.value=""
}
const deletComment = (id, news) => {
axiosApiInstance.post(`api/navigation/news/`, {delid: id, news: news}).then(result => {
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
})
}
const pagelistNews =() => {
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`, newss)
}
watch(()=>route.query,(newValue,oldValue)=>{
if(newValue){
str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
getfromserver(str, newss)
}
}, {deep:true})
watch(()=>selecnews ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${newValue.value}`, newss)
}
}, {deep:true})
watch(()=>accountStore.cod2user ,(newValue,oldValue)=>{
if(newValue){
getfromserver(`api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`,newss)
}
}, {deep:true})
const dateformat = (datas) => {
return format(new Date(datas), 'dd.MM.yyyy HH:mm')
}
const openComent = (news) => {
dialogCommentShow.value=!dialogCommentShow.value
idnews.value = news
}
const formatText= (text) => {
return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`)
}
const nextnews = (idnews) => {
console.log(route);
}
const limitText=(text)=> {
const t = text.split(' ').slice(0, 25)
return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}`
}
const splitname = (name) => {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
// ------------------------------ Галерея
const galleryimges=ref([])
const dialogfoto = ref(false)
const indximg = ref('')
const openImg = (idimg) => {
dialogfoto.value = true
indximg.value = newss.value.result[0].gallery.findIndex(e=>e.id == idimg)
}
watch(()=>indximg ,(newValue,oldValue)=>{
if(newValue){
galleryimges.value = newss.value.result[0].gallery[newValue.value]
}
}, {deep:true})
const imagesIn = () => {
return newss.value.result[0].gallery.length
}
// Лайки на фотографии
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 => {
newss.value.result[0].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
}
const heartIcoAll = (image) => {
return image.likes.filter(e=>e.user==accountStore.user.login).length==1
}
return {
newss,
burl,
limitText,
toggleIncrementLike,
dialogCommentShow,
accountStore,
dateformat,
splitname,
textcomment,
openComent,
addComment,
idnews,
deletComment,
pagelistNews,
divs,
page,
selecnews,
checkremote,
route,
spravURL,
formatText,
gallery,
openImg,
dialogfoto,
galleryimges,
indximg,
toggleLike,
heartIco,
heartIcoAll,
toggleLikeAll,
imagesIn,
switchComGal,
nextnews
}
}
}
</script>
<style >
.comgal .v-switch__thumb {
color: white!important;
}
.posFooter {
position: sticky;
margin-top: 12px;
background-color: transparent;
bottom: 5px;
}
.newsVH {
height: 92vh;
}
.bgchat {
background-color: #efe9f98a;
}
.bgchatnot {
background-color: #eef9efad;
}
.mwidth {
min-width: 50px;
}
/* .bgf {
background: url("@/assets/message.jpg") repeat-y;
} */
.heigCard {
height: 46vh;
}
.commentHeight {
height: 91.5vh;
}
.h_cards {
height: 86vh;
}
.place-it{
place-items: center;
}
</style>
@@ -31,28 +31,10 @@
</template>
<template v-slot:append>
<template v-if="accountStore.cod2user">
<v-card
class="bg-transparent"
color="black_and_white"
density="compact"
:prepend-avatar="accountStore.user.photo"
:title="accountStore.user.fio"
:subtitle="accountStore.user.post"
variant="text" @click="getcard" />
<v-dialog
v-model="menuGetUserDialog"
persistent width="600">
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="accountStore.user.login"
@menusClose="menuGetUserDialog = false" />
</v-dialog>
<vcard-user
:author = accountStore.user
/>
<v-tooltip location="bottom">
<template v-slot:activator="{ props }">
<v-btn
@@ -307,22 +289,22 @@
<script>
import { ref, computed, onMounted} from 'vue'
import { ref, computed} from 'vue'
import uf from '@/utils/universal_functions'
import { useAccountStore } from '@/store/AccountStore'
import { useMainmenuStore } from '@/store/MainmenuStore'
import { useAppStore } from '@/store/app'
import { useTheme } from "vuetify";
import AuthForm from '@/components/UI/Auth-form.vue'
import OnlineUsers from '@/components/onlineUsers.vue'
import CardUsers from '@/components/cardUsers.vue'
import OnlineUsers from '@/components/UI/fiousercard/onlineUsers.vue'
import CardLike from '@/components/cardLike.vue'
import { clearAxios } from '@/utils/axios-api'
import { useRouter } from 'vue-router'
import { baseURL } from '@/utils/axios-api'
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
export default {
components: { AuthForm, OnlineUsers, CardUsers, CardLike },
components: { AuthForm, OnlineUsers, CardLike, VcardUser },
mixins: [uf],
@@ -335,7 +317,7 @@ export default {
const accountStore = useAccountStore()
const drawer = ref(true)
const drawer_right = ref(true)
const menuGetUserDialog = ref(false)
const LikeDialog = ref(false)
const rail = ref(false)
const showTooltip = ref(false)
@@ -434,9 +416,6 @@ export default {
return new URL(`@/assets/FNS-logo-xs.png`, import.meta.url).href;
})
const getcard = async () => {
menuGetUserDialog.value = true
}
@@ -450,8 +429,6 @@ export default {
toggleTheme,
navigations,
imageSrc,
getcard,
menuGetUserDialog,
LikeDialog,
scrimg,
appStore,
+1 -2
View File
@@ -4,7 +4,7 @@
class="flex-column d-flex"
>
<!-- <news-list-news/> -->
<news-crossroad/>
</v-col>
@@ -21,7 +21,6 @@ export default {
components: {
newsCrossroad
// NewsListNews
},
setup(){
pagecounter()
Binary file not shown.