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

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

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>
+94 -45
View File
@@ -1,9 +1,10 @@
<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-row class="d-flex flex-row ma-0">
<v-col class=" flex-column d-flex "> <v-col class="flex-column d-flex">
<v-row class="flex-grow-0"> <v-row class="flex-grow-0">
<v-col class="pb-0 pr-0 "> <v-col class="pb-0 pr-0 ">
<v-card <v-card
@@ -16,7 +17,6 @@
{{newsFull.title}} {{newsFull.title}}
</v-col> </v-col>
<v-col class="pa-0 pr-3 pt-1 flex-grow-1 d-flex flex-column flex-wrap"> <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"
@@ -25,15 +25,18 @@
<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">{{ newsFull.comment.length }}</span> <span class="pl-3">
{{ newsFull.comment.length }}
</span>
</template> </template>
<span>Чат</span> <span>
Чат
</span>
</v-tooltip> </v-tooltip>
</template> </template>
<template v-slot:append> <template v-slot:append>
@@ -44,14 +47,16 @@
:icon="'mdi-image'" :icon="'mdi-image'"
color="teal-darken-2" color="teal-darken-2"
/> />
<span class="pl-3">{{newsFull.gallery.length}}</span> <span class="pl-3">
{{newsFull.gallery.length}}
</span>
</template> </template>
<span>
<span>Галерея</span> Галерея
</span>
</v-tooltip> </v-tooltip>
</template> </template>
</v-switch> </v-switch>
</v-col> </v-col>
</v-row> </v-row>
</v-card-title> </v-card-title>
@@ -74,19 +79,34 @@
<template v-slot:prepend> <template v-slot:prepend>
<v-avatar <v-avatar
color="loading_avatar" color="loading_avatar"
:image="checkremote( `${spravURL}${newsFull.author.login}.jpg`)" :image="checkremote(`${spravURL}${newsFull.author.login}.jpg`)"
size="25" size="25"
> />
</v-avatar> <v-list-item-title class="text-caption">
<v-list-item-title class="text-caption">{{splitname(newsFull.author)}}</v-list-item-title> {{splitname(newsFull.author)}}
</v-list-item-title>
</template> </template>
<template v-slot:append> <template v-slot:append>
<div class="justify-self-end"> <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> <v-icon
<span class="subheading me-2">{{newsFull.scores.filter(e=> e.score==true).length}}</span> class="me-1"
<span class="me-1">·</span> :icon="newsFull.scores.filter(e=> e.user==accountStore.user.login && e.score == true).length>0?'mdi-thumb-up':'mdi-thumb-up-outline'"
<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)"/> @click="toggleIncrementLike(newsFull.id, true)"
<span class="subheading me-2">{{newsFull.scores.filter(e=> e.score==false).length}}</span> />
<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> </div>
</template> </template>
</v-list-item> </v-list-item>
@@ -94,7 +114,9 @@
<v-row class="ma-0 my-3 overflow-auto h-0"> <v-row class="ma-0 my-3 overflow-auto h-0">
<v-col class="pa-0"> <v-col class="pa-0">
<v-card-text class="pt-0"> <v-card-text class="pt-0">
<div v-if="newsFull.text" v-html=formatText(newsFull.text)> <div
v-if="newsFull.text"
v-html=formatText(newsFull.text)>
</div> </div>
<div v-else> <div v-else>
<v-row> <v-row>
@@ -108,32 +130,27 @@
</v-card-text> </v-card-text>
</v-col> </v-col>
</v-row> </v-row>
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
</v-col> </v-col>
<v-col class="flex-column d-flex " <v-col class="flex-column d-flex">
>
<v-row <v-row
class="d-flex flex-column " class="d-flex flex-column "
v-if="gallery" v-if="gallery"
> >
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
<v-card <v-card
class="h-100 flex-column pa-3 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" class="flex-column d-flex ma-3"
> >
<v-row
<v-row style="height:250px" class="justify-space-between " v-if="newsFull.gallery.length>0"> 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
@@ -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
@@ -417,7 +437,7 @@ export default {
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,9 +447,12 @@ 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>