Запрос на бек, поправить логику
This commit is contained in:
1 parent
9550a5ff10
commit
f75fe88d1b
3 files changed
+45
-11
No files matched your search
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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'))
|
||||
|
||||
|
||||
@@ -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,)
|
||||
|
||||
|
||||
Reference in new issue
Block a user