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

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">
{{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
@@ -88,6 +80,7 @@
:class="news.text.length==0?'align-self-center':'my-3'"
>
<v-card-text class="py-0 px-2">
<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>
</v-card-text>
@@ -13,7 +13,6 @@
cols=12
class="d-flex pa-1 flex-column "
>
<news-card :news="x"/>
</v-col>
+195 -146
View File
@@ -1,140 +1,157 @@
<template>
<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 ">
<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=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">
<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"
/>
<span class="pl-3">{{ newsFull.comment.length }}</span>
</template>
<span>Чат</span>
</v-tooltip>
</template>
<template v-slot:append>
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<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 ">
<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=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">
<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"
/>
<span class="pl-3">
{{ newsFull.comment.length }}
</span>
</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"
/>
<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-bind="props"
:icon="'mdi-image'"
color="teal-darken-2"
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)"
/>
<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-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>
</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>
<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>
</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-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-for="e in newsFull.gallery" :key=e
:lg="Math.floor(Math.random() * (Math.floor(5) - Math.ceil(3)) + Math.ceil(2))"
@@ -147,6 +164,7 @@
>
<v-row>
<v-col class="d-flex">
<v-img
cover
@@ -323,8 +341,10 @@
density="compact"
variant="text"
icon="mdi-cloud-download"
@click="downloadimg(galleryimges.img)"
/>
<my-helper :pretext="galleryimges.img"/>
</v-col>
<v-col class="pa-0 flex-grow-0">
<v-btn
@@ -415,9 +435,9 @@ export default {
const burl = baseURL.slice(0,-1)
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]
// console.log(result.data.result[0], 'vvvvvvvvvvvvvvv');
// newss.value= result.data
// 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 => {
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
}
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 {
route,
newsFull,
gallery,
@@ -543,7 +584,9 @@ export default {
openImg,
dialogfoto,
galleryimges,
indximg
indximg,
toggleIncrementLike,
downloadimg
}
}
@@ -557,4 +600,10 @@ export default {
color: white!important;
}
.h_cards {
height: 86vh;
}
</style>