diff --git a/src/front/src/components/news-list-news.vue b/src/front/src/components/news-list-news.vue index 3e6eadc51..253d99ded 100644 --- a/src/front/src/components/news-list-news.vue +++ b/src/front/src/components/news-list-news.vue @@ -317,7 +317,7 @@ class="w-100 h-100" :src="`${burl}${n.img}`" - @click="openImg(n.img)" + @click="openImg(n.id)" > @@ -497,15 +497,18 @@ class="flex-column " > - - + + {{imgsrc}} + {{galleryimges}} + @@ -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 diff --git a/src/navigation/urls.py b/src/navigation/urls.py index 00654d3f8..ece613439 100644 --- a/src/navigation/urls.py +++ b/src/navigation/urls.py @@ -7,6 +7,7 @@ urlpatterns = [ path('links/', LinkAPIView.as_view(), name='LinkAPIView'), path('news/', NewsAPIView.as_view(), name='NewsAPIView'), + path('gallery/', GalleryAPIView.as_view(), name='GalleryAPIView'), path('carousels/', CarouselsAPIView.as_view(), name='CarouselsAPIView'), path('ckeditor/', include('ckeditor_uploader.urls')) diff --git a/src/navigation/views.py b/src/navigation/views.py index cd5e1ea3c..fe8d02b13 100644 --- a/src/navigation/views.py +++ b/src/navigation/views.py @@ -24,6 +24,14 @@ class LinkAPIView(ListAPIView): return Response(serializer.data) +class GalleryAPIView(ListAPIView): + def get(self, request): + + gal = Gallery.objects.filter(id=int(request.GET.get('id'))) + result = GallerySerializer(gal, many=True).data + + return Response(result) + class NewsAPIView(ListAPIView): permission_classes = (AllowAny,)