скачать картинку

This commit is contained in:
iriska-gri committed 2023-12-14 15:36:53 +03:00
1 parent 6505affae8
commit 8f86143710
3 files changed
+196 -155

No files matched your search

+1 -8
View File
@@ -7,14 +7,6 @@
<v-card-title class="pb-1"> <v-card-title class="pb-1">
{{news.title}} {{news.title}}
</v-card-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-row class="flex-grow-0">
<v-col> <v-col>
<v-img <v-img
@@ -88,6 +80,7 @@
:class="news.text.length==0?'align-self-center':'my-3'" :class="news.text.length==0?'align-self-center':'my-3'"
> >
<v-card-text class="py-0 px-2"> <v-card-text class="py-0 px-2">
<div v-if="news.text.length>0" v-html=limitText(news.text)></div> <div v-if="news.text.length>0" v-html=limitText(news.text)></div>
<div v-else class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">Без описания</div> <div v-else class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">Без описания</div>
</v-card-text> </v-card-text>
@@ -13,7 +13,6 @@
cols=12 cols=12
class="d-flex pa-1 flex-column " class="d-flex pa-1 flex-column "
> >
<news-card :news="x"/> <news-card :news="x"/>
</v-col> </v-col>
+195 -146
View File
@@ -1,140 +1,157 @@
<template> <template>
<div
<div v-if="Object.keys(newsFull).length>0" class="d-flex flex-column flex-fill"> 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="d-flex flex-row ma-0">
<v-row class="flex-grow-0"> <v-col class="flex-column d-flex">
<v-col class="pb-0 pr-0 "> <v-row class="flex-grow-0">
<v-card <v-col class="pb-0 pr-0 ">
height="350px" <v-card
class="rounded-b-0" height="350px"
> class="rounded-b-0"
<v-card-title class="pt-0 pb-1 flex-column d-flex"> >
<v-row> <v-card-title class="pt-0 pb-1 flex-column d-flex">
<v-col lg=9 class="pt-4"> <v-row>
{{newsFull.title}} <v-col lg=9 class="pt-4">
</v-col> {{newsFull.title}}
<v-col class="pa-0 pr-3 pt-1 flex-grow-1 d-flex flex-column flex-wrap"> </v-col>
<v-col class="pa-0 pr-3 pt-1 flex-grow-1 d-flex flex-column flex-wrap">
<v-switch <v-switch
v-model="gallery" v-model="gallery"
class="align-self-end comgal" class="align-self-end comgal"
hide-details hide-details
> >
<template v-slot:prepend> <template v-slot:prepend>
<v-tooltip location="top"> <v-tooltip location="top">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-icon
<v-icon v-bind="props"
v-bind="props" icon='mdi-message-text-outline'
icon='mdi-message-text-outline' color="pink-darken-4"
color="pink-darken-4" />
/> <span class="pl-3">
<span class="pl-3">{{ newsFull.comment.length }}</span> {{ newsFull.comment.length }}
</template> </span>
<span>Чат</span> </template>
</v-tooltip> <span>
</template> Чат
<template v-slot:append> </span>
<v-tooltip location="top"> </v-tooltip>
<template v-slot:activator="{ props }"> </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"
/>
<span class="pl-3">
{{newsFull.gallery.length}}
</span>
</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-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 <v-icon
v-bind="props" class="me-1"
:icon="'mdi-image'" :icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'"
color="teal-darken-2" @click="toggleIncrementLike(newsFull.id, true)"
/> />
<span class="pl-3">{{newsFull.gallery.length}}</span> <span class="subheading me-2">
</template> {{newsFull.scores.filter(e=> e.score==true).length}}
</span>
<span>Галерея</span> <span class="me-1">
</v-tooltip> ·
</template> </span>
</v-switch> <v-icon
class="me-1"
</v-col> :icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'"
</v-row> @click="toggleIncrementLike(newsFull.id, false)"
</v-card-title> />
<v-img <span class="subheading me-2">
:src="`${burl}${newsFull.link}`" {{newsFull.scores.filter(e=> e.score==false).length}}
height="450px" </span>
width="96%" </div>
class="mx-auto" </template>
cover </v-list-item>
/> <v-divider/>
</v-card> <v-row class="ma-0 my-3 overflow-auto h-0">
</v-col> <v-col class="pa-0">
</v-row> <v-card-text class="pt-0">
<v-row> <div
<v-col class="pt-0 pr-0"> v-if="newsFull.text"
<v-card v-html=formatText(newsFull.text)>
class="rounded-t-0 flex-column d-flex h-100 Line truncated </div>
> <div v-else>
<v-list-item class="w-100"> <v-row>
<template v-slot:prepend> <v-col
<v-avatar class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
color="loading_avatar" >
:image="checkremote( `${spravURL}${newsFull.author.login}.jpg`)" Без описания
size="25" </v-col>
> </v-row>
</v-avatar> </div>
<v-list-item-title class="text-caption">{{splitname(newsFull.author)}}</v-list-item-title> </v-card-text>
</template> </v-col>
<template v-slot:append> </v-row>
<div class="justify-self-end"> </v-card>
<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> </v-col>
<span class="subheading me-2">{{newsFull.scores.filter(e=> e.score==true).length}}</span> </v-row>
<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>
</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-col>
</v-row> <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 pa-3 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-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 pa-3 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-col
v-for="e in newsFull.gallery" :key=e v-for="e in newsFull.gallery" :key=e
:lg="Math.floor(Math.random() * (Math.floor(5) - Math.ceil(3)) + Math.ceil(2))" :lg="Math.floor(Math.random() * (Math.floor(5) - Math.ceil(3)) + Math.ceil(2))"
@@ -147,6 +164,7 @@
> >
<v-row> <v-row>
<v-col class="d-flex"> <v-col class="d-flex">
<v-img <v-img
cover cover
@@ -323,8 +341,10 @@
density="compact" density="compact"
variant="text" variant="text"
icon="mdi-cloud-download" icon="mdi-cloud-download"
@click="downloadimg(galleryimges.img)"
/> />
<my-helper :pretext="galleryimges.img"/>
</v-col> </v-col>
<v-col class="pa-0 flex-grow-0"> <v-col class="pa-0 flex-grow-0">
<v-btn <v-btn
@@ -415,9 +435,9 @@ export default {
const burl = baseURL.slice(0,-1) const burl = baseURL.slice(0,-1)
const loadNews = () => { const loadNews = () => {
axiosApiInstance.get(`api/navigation/newscrossroad/?id=${route.query.id}`).then(result => { axiosApiInstance.get(`api/navigation/newscrossroad/?id=${route.query.id}`).then(result => {
newsFull.value=result.data.result[0] newsFull.value=result.data.result[0]
// console.log(result.data.result[0], 'vvvvvvvvvvvvvvv');
// newss.value= result.data // newss.value= result.data
// if (newss.value.result[0].gallery.length > 0) { // if (newss.value.result[0].gallery.length > 0) {
@@ -427,10 +447,13 @@ export default {
// ] // ]
// ) // )
// gallery.value = true if (newsFull.value.gallery.length> 0) {
gallery.value = true
// } }
}) })
@@ -507,22 +530,40 @@ export default {
axiosApiInstance.post(`api/navigation/gallery/`, {image: idimage}).then(result => { axiosApiInstance.post(`api/navigation/gallery/`, {image: idimage}).then(result => {
newsFull.value.gallery.filter(e=>e.id ==idimage)[0].likes = result.data newsFull.value.gallery.filter(e=>e.id ==idimage)[0].likes = result.data
}) })
} }
const heartIco = () => { const heartIco = () => {
return galleryimges.value.likes.filter(e=>e.user==accountStore.user.login).length==1 return galleryimges.value.likes.filter(e=>e.user==accountStore.user.login).length==1
} }
const toggleIncrementLike = (news, scores) => {
axiosApiInstance.post(`api/navigation/news/`, {news: news, scores: scores}).then(result => {
newsFull.value.scores= result.data
})
}
const downloadimg = (idimg) => {
let link = document.createElement("a")
link.href = burl+idimg
link.download ='img.jpeg'
link.click()
console.log(burl, idimg,'22222222222222222');
link.remove()
}
// const excelOp = (ex) => {
// axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
// let link = document.createElement("a")
// link.href = baseURL+result.data.path
// link.click()
// link.remove()
// })
// }
return { return {
route, route,
newsFull, newsFull,
gallery, gallery,
@@ -543,7 +584,9 @@ export default {
openImg, openImg,
dialogfoto, dialogfoto,
galleryimges, galleryimges,
indximg indximg,
toggleIncrementLike,
downloadimg
} }
} }
@@ -557,4 +600,10 @@ export default {
color: white!important; color: white!important;
} }
.h_cards {
height: 86vh;
}
</style> </style>