Новости
This commit is contained in:
1 parent
1878b19462
commit
f4da4b8fa3
5 files changed
+90
-11
No files matched your search
@@ -70,7 +70,7 @@ export default {
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage
|
||||
countetnews.value = result.data.countpage/countpage.value
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<template>
|
||||
|
||||
<div>{{route.query['id']}}</div>
|
||||
</template>
|
||||
|
||||
@@ -15,7 +14,7 @@ export default {
|
||||
return {
|
||||
|
||||
route
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="flex-column d-flex">
|
||||
<v-row class="flex-grow-0 ma-3 mb-0">
|
||||
<v-col class="flex-column d-flex pa-0 flex-wrap">
|
||||
Всего новостей: {{countetnews}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-0 h-0 overflow-auto">
|
||||
<v-col
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
class="pb-1 pt-0">
|
||||
<news-card :news="x"/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<!-- <div>
|
||||
<div class= "pa-3">
|
||||
Всего новостей: {{countetnews}}
|
||||
</div>
|
||||
<div
|
||||
v-for="(x, key) in newsAll"
|
||||
:key="key"
|
||||
class="pb-2"
|
||||
>
|
||||
<news-card :news="x"/>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import { useRoute } from 'vue-router'
|
||||
import newsCard from './UI/news-card.vue'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
newsCard
|
||||
},
|
||||
|
||||
setup(){
|
||||
|
||||
const newsAll=ref([])
|
||||
const countetnews = ref(0)
|
||||
const page = ref(1)
|
||||
const countpage = ref(8)
|
||||
const route = useRoute()
|
||||
|
||||
const loadNewsAll = () => {
|
||||
axiosApiInstance.get( `api/navigation/newscrossroad/?name=${route.path}&page=${page.value-1}&countpage=${countpage.value}`).then(result => {
|
||||
newsAll.value= result.data.result
|
||||
countetnews.value = result.data.countpage
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
loadNewsAll()
|
||||
|
||||
return {
|
||||
newsAll,
|
||||
countetnews,
|
||||
page,
|
||||
countpage,
|
||||
loadNewsAll,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -32,10 +32,10 @@
|
||||
<v-card class="h-100 d-flex flex-column">
|
||||
|
||||
|
||||
<v-row class="d-flex h-0 overflow-auto">
|
||||
<v-col>
|
||||
|
||||
<News-list-home />
|
||||
<v-row class="d-flex">
|
||||
<v-col class="flex-column d-flex">
|
||||
<news-home/>
|
||||
<!-- <News-list-home /> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
@@ -86,6 +86,7 @@
|
||||
import CarouselNumbers from '@/components/carousel-numbers.vue'
|
||||
import CalendarFull from '@/components/UI/Calendar-full.vue'
|
||||
import NewsListHome from '@/components/news-list-home.vue'
|
||||
import NewsHome from '@/components/news-home.vue'
|
||||
import LoadRound from '@/components/load-round.vue'
|
||||
import DigitalLetna from '@/components/digital-letna.vue'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
@@ -102,7 +103,8 @@
|
||||
NewsListHome,
|
||||
LoadRound,
|
||||
DigitalLetna,
|
||||
EventCalendar
|
||||
EventCalendar,
|
||||
NewsHome
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
countpage = newsqueryset.count()
|
||||
if request.GET.get("name") == "/":
|
||||
print('Запрос на новости для главной страницы')
|
||||
newsqueryset = newsqueryset[:10]
|
||||
newsqueryset = newsqueryset[:2]
|
||||
else:
|
||||
print('Запрос на новости с пагинацией')
|
||||
|
||||
@@ -121,8 +121,8 @@ class NewsCrossroadAPIView(ListAPIView):
|
||||
|
||||
|
||||
|
||||
return Response({"result":result, "countpage": round(countpage/int(request.GET.get("countpage")))})
|
||||
|
||||
return Response({"result":result, "countpage": countpage})
|
||||
# round(countpage/int(request.GET.get("countpage")))
|
||||
def post(self, request):
|
||||
|
||||
if 'scores' in request.data:
|
||||
|
||||
Reference in new issue
Block a user