Запрос на бек, поправить логику

This commit is contained in:
iriska-gri committed 2023-12-04 16:59:34 +03:00
1 parent 9550a5ff10
commit f75fe88d1b
3 files changed
+45 -11

No files matched your search

+36 -11
View File
@@ -317,7 +317,7 @@
class="w-100 h-100"
:src="`${burl}${n.img}`"
@click="openImg(n.img)"
@click="openImg(n.id)"
>
</v-img>
@@ -497,15 +497,18 @@
class="flex-column "
>
<v-card class="pa-4">
<v-img
<v-btn density="compact" icon="mdi-plus" @click="forgetgallery('plus')"></v-btn>
<v-btn density="compact" icon="mdi-minus" @click="forgetgallery('minus')"></v-btn>
{{imgsrc}}
{{galleryimges}}
<!-- <v-img
class="d-flex "
:src="`${burl}${imgsrc}`"
class="d-flex h-100"
:src="`${burl}${galleryimges[0].img}`"
>
</v-img>
</v-img> -->
<!-- <v-btn color="primary" block @click="dialogfoto = false">Close Dialog</v-btn> -->
@@ -549,6 +552,7 @@ export default {
const newss=ref([])
const galleryimges=ref([])
const dialogCommentShow = ref(false)
const gallery = ref(false)
@@ -559,7 +563,7 @@ export default {
const page = ref(1)
const selecnews = ref(2)
const route = useRoute()
const imgsrc = ref('')
const imgsrc = ref(1)
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
@@ -598,17 +602,24 @@ export default {
}
const openImg = (img) => {
const galleryimg = (id) => {
getfromserver(`api/navigation/gallery/?id=${id}`, galleryimges)
}
const openImg = (imgid) => {
console.log(imgid);
imgsrc.value = ''
dialogfoto.value = true
imgsrc.value = img
imgsrc.value = imgid
galleryimg(imgid)
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
console.log('----------------111111111111111111111111111111111');
dialogCommentShow.value=!dialogCommentShow.value
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
@@ -679,6 +690,18 @@ export default {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
const forgetgallery = (hu) => {
if (hu =="plus") {
imgsrc.value += 1
}
else if (imgsrc.value !=0 && hu == "minus") {
imgsrc.value -= 1
}
galleryimg(imgsrc.value)
console.log(imgsrc.value, hu, 'ffffffffffffffffffffffff');
}
@@ -709,7 +732,9 @@ export default {
gallery,
openImg,
dialogfoto,
imgsrc
imgsrc,
galleryimges,
forgetgallery