новые новости
This commit is contained in:
1 parent
a3f44e04c6
commit
8a10f2aa46
11 files changed
+252
-88
No files matched your search
@@ -133,7 +133,7 @@ export default {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${props.idpos}`).then(data => {
|
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${props.idpos}`).then(data => {
|
||||||
console.log(data.data);
|
|
||||||
t_dailyRound.value = data.data.daily
|
t_dailyRound.value = data.data.daily
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
v-if="accountStore.user.is_staff"
|
v-if="accountStore.user.is_staff"
|
||||||
v-model="changeData"
|
v-model="changeData"
|
||||||
class="pl-3 d-flex justify-end"
|
class="pl-3 d-flex justify-end"
|
||||||
color="teal"
|
color="white"
|
||||||
@click="changeData=!changeData">
|
@click="changeData=!changeData">
|
||||||
</v-switch>
|
</v-switch>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export default {
|
|||||||
|
|
||||||
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => {
|
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => {
|
||||||
info.value = result.data['mess']
|
info.value = result.data['mess']
|
||||||
console.log(info.value, '----------------result.data')
|
|
||||||
})
|
})
|
||||||
showInfo.value = true
|
showInfo.value = true
|
||||||
dailyfiles.value = []
|
dailyfiles.value = []
|
||||||
@@ -134,7 +134,7 @@ export default {
|
|||||||
|
|
||||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
|
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data.data);
|
|
||||||
|
|
||||||
t_dailyRound.value = data.data
|
t_dailyRound.value = data.data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<template>
|
||||||
|
<v-row>
|
||||||
|
<v-col class="d-flex flex-column">
|
||||||
|
<v-row>
|
||||||
|
<v-col>
|
||||||
|
1
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-row class="flex-grow-0">
|
||||||
|
<v-col class="bg-red">
|
||||||
|
<v-pagination
|
||||||
|
v-model="page"
|
||||||
|
:length=newsAll.countpage
|
||||||
|
:total-visible="7"
|
||||||
|
@update:modelValue="loadNewsAll"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
<v-col class="flex-grow-0" LG=2>
|
||||||
|
<v-select
|
||||||
|
hide-details
|
||||||
|
density="compact"
|
||||||
|
v-model="countpage"
|
||||||
|
variant="underlined"
|
||||||
|
:items="[1, 8, 16, 24, 32, 40]"
|
||||||
|
@update:modelValue="loadNewsAll"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<!-- <div>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
{{newsAll.result}}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<v-pagination
|
||||||
|
v-model="page"
|
||||||
|
:length=newsAll.countpage
|
||||||
|
:total-visible="7"
|
||||||
|
@update:modelValue="loadNewsAll"
|
||||||
|
/>
|
||||||
|
<v-select
|
||||||
|
hide-details
|
||||||
|
density="compact"
|
||||||
|
v-model="countpage"
|
||||||
|
variant="underlined"
|
||||||
|
:items="[1, 8, 16, 24, 32, 40]"
|
||||||
|
@update:modelValue="loadNewsAll"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup(){
|
||||||
|
|
||||||
|
const newsAll=ref([])
|
||||||
|
const page = ref(1)
|
||||||
|
const countpage = ref(1)
|
||||||
|
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
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
loadNewsAll()
|
||||||
|
|
||||||
|
return {
|
||||||
|
newsAll,
|
||||||
|
page,
|
||||||
|
countpage,
|
||||||
|
loadNewsAll
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -18,6 +18,17 @@
|
|||||||
{{x.title}}
|
{{x.title}}
|
||||||
|
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
<!-- :to='`/news?id=${x.id}`' -->
|
||||||
|
<v-btn
|
||||||
|
color="more_details_btn"
|
||||||
|
variant="text"
|
||||||
|
|
||||||
|
@click="nextnews(x.id)"
|
||||||
|
size="small"
|
||||||
|
append-icon="mdi-step-forward-2"
|
||||||
|
>
|
||||||
|
Подробнее
|
||||||
|
</v-btn>
|
||||||
<v-img
|
<v-img
|
||||||
:src="`${burl}${x.link}`"
|
:src="`${burl}${x.link}`"
|
||||||
height="350px"
|
height="350px"
|
||||||
@@ -160,7 +171,8 @@
|
|||||||
density="compact"
|
density="compact"
|
||||||
v-model="selecnews"
|
v-model="selecnews"
|
||||||
variant="underlined"
|
variant="underlined"
|
||||||
:items="['10', '20', '30', '40', '100']"/>
|
:items="['10', '20', '30', '40', '100']"
|
||||||
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
@@ -172,6 +184,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col v-else class="flex-column d-flex" v-for="(x, i) in newss.result" :key=i>
|
<v-col v-else class="flex-column d-flex" v-for="(x, i) in newss.result" :key=i>
|
||||||
|
|
||||||
<v-row>
|
<v-row>
|
||||||
<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">
|
||||||
@@ -190,25 +203,35 @@
|
|||||||
class="align-self-end comgal"
|
class="align-self-end comgal"
|
||||||
|
|
||||||
|
|
||||||
color='teal-darken-2'
|
|
||||||
|
|
||||||
|
|
||||||
hide-details
|
hide-details
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<v-icon
|
<v-tooltip location="top">
|
||||||
:icon="gallery?'mdi-image':'mdi-message-text-outline'"
|
<template v-slot:activator="{ props }">
|
||||||
:color="gallery?'teal-darken-2':'pink-darken-4'"
|
<v-icon
|
||||||
|
v-bind="props"
|
||||||
/>
|
icon='mdi-message-text-outline'
|
||||||
<!-- :color="gallery?'teal-darken-2':'pink-darken-4'" -->
|
color="pink-darken-4"
|
||||||
<v-tooltip
|
/>
|
||||||
|
</template>
|
||||||
activator="parent"
|
<span>Чат</span>
|
||||||
location="top">
|
|
||||||
пушкни
|
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:append>
|
||||||
|
<v-tooltip location="top">
|
||||||
|
<template v-slot:activator="{ props }">
|
||||||
|
<v-icon
|
||||||
|
v-bind="props"
|
||||||
|
:icon="'mdi-image'"
|
||||||
|
color="teal-darken-2"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<span>Галерея</span>
|
||||||
|
</v-tooltip>
|
||||||
|
</template>
|
||||||
</v-switch>
|
</v-switch>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -250,8 +273,8 @@
|
|||||||
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
|
<v-icon class="me-1" :icon="x.scores.filter(e=> e.user==accountStore.user.login && e.score == false).length>0?'mdi-thumb-down':'mdi-thumb-down-outline'" @click="toggleIncrementLike(x.id, false)"/>
|
||||||
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
|
<span class="subheading me-2">{{x.scores.filter(e=> e.score==false).length}}</span>
|
||||||
<span class="me-1">·</span>
|
<span class="me-1">·</span>
|
||||||
<v-icon class="me-1" icon="mdi-message-text-outline" @click="openComent(x.id)"/>
|
<v-icon class="me-1" icon="mdi-message-text-outline"/>
|
||||||
<span @click="x.showComment=!x.showComment" class="pointer subheading">{{ x.comment.length }}</span>
|
<span class="subheading">{{ x.comment.length }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
@@ -260,11 +283,17 @@
|
|||||||
<v-col class="pa-0">
|
<v-col class="pa-0">
|
||||||
<v-card-text class="pt-0">
|
<v-card-text class="pt-0">
|
||||||
|
|
||||||
<div v-html=formatText(x.text)>
|
<div v-if="x.text" v-html=formatText(x.text)>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<v-row>
|
||||||
|
<v-col
|
||||||
|
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||||
|
>
|
||||||
|
Без описания
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -273,7 +302,7 @@
|
|||||||
</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 "
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|
||||||
@@ -284,6 +313,7 @@
|
|||||||
>
|
>
|
||||||
<v-col class="d-flex flex-column">
|
<v-col class="d-flex flex-column">
|
||||||
<v-card
|
<v-card
|
||||||
|
|
||||||
class="h-100 flex-column d-flex overflow-auto overflow-x-hidden"
|
class="h-100 flex-column d-flex overflow-auto overflow-x-hidden"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -292,7 +322,7 @@
|
|||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<v-row style="height:250px" class="justify-space-between ">
|
<v-row style="height:250px" class="justify-space-between " v-if="x.gallery.length>0">
|
||||||
|
|
||||||
<v-col
|
<v-col
|
||||||
v-for="e in x.gallery" :key=e
|
v-for="e in x.gallery" :key=e
|
||||||
@@ -334,9 +364,19 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
</v-row>
|
</v-row>
|
||||||
|
<v-row v-else>
|
||||||
|
<v-col
|
||||||
|
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||||
|
>
|
||||||
|
|
||||||
|
У новости нет фотографий
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
</div>
|
</div>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
@@ -346,9 +386,10 @@
|
|||||||
<v-card
|
<v-card
|
||||||
class="h-100 flex-column d-flex"
|
class="h-100 flex-column d-flex"
|
||||||
>
|
>
|
||||||
<v-row class="ma-0 my-3 overflow-auto h-0">
|
<v-row class="ma-0 my-3 overflow-auto h-0" v-if="x.comment.length>0">
|
||||||
<v-col class="pa-0">
|
<v-col class="pa-0">
|
||||||
<v-card-text class="pt-0">
|
<v-card-text class="pt-0">
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-for = "(y, key) in x.comment"
|
v-for = "(y, key) in x.comment"
|
||||||
:key="key"
|
:key="key"
|
||||||
@@ -416,61 +457,45 @@
|
|||||||
</v-card-text>
|
</v-card-text>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<!-- <v-row class="flex-grow-0 ma-1">
|
<v-row v-else>
|
||||||
<v-col class="bg-red">
|
<v-col
|
||||||
|
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
||||||
|
>
|
||||||
|
Оставьте первый комментарий
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-divider/>
|
||||||
|
<v-row class="flex-grow-0 ma-1">
|
||||||
|
<v-col>
|
||||||
|
|
||||||
<v-textarea
|
<v-textarea
|
||||||
variant="solo"
|
label="Комментарий"
|
||||||
hide-details
|
no-resize
|
||||||
rows="2"
|
variant="underlined"
|
||||||
|
rows="2"
|
||||||
|
row-height="25"
|
||||||
|
shaped
|
||||||
|
hide-details
|
||||||
v-model="textcomment"
|
v-model="textcomment"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="flex-grow-0">
|
<v-col class="flex-grow-0 pl-0 py-0 align-self-center">
|
||||||
<v-btn
|
<v-btn
|
||||||
color="modal_btn"
|
|
||||||
variant="text"
|
variant="text"
|
||||||
@click="addComment"
|
density="compact"
|
||||||
>
|
icon="mdi-google-play"
|
||||||
Отправить
|
color="teal-darken-4"
|
||||||
</v-btn>
|
:disabled="textcomment==''"
|
||||||
|
@click="addComment(x.id)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row> -->
|
</v-row>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
<!-- <v-row v-else>
|
|
||||||
<v-col>
|
|
||||||
<v-card
|
|
||||||
class="h-100 flex-column d-flex"
|
|
||||||
>
|
|
||||||
<v-row>
|
|
||||||
|
|
||||||
<v-col
|
|
||||||
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
|
||||||
>
|
|
||||||
Оставьте свой коментарий...
|
|
||||||
</v-col>
|
|
||||||
<v-col>
|
|
||||||
<v-textarea
|
|
||||||
variant="solo"
|
|
||||||
hide-details
|
|
||||||
rows="5"
|
|
||||||
v-model="textcomment"
|
|
||||||
|
|
||||||
></v-textarea>
|
|
||||||
<v-btn
|
|
||||||
color="modal_btn"
|
|
||||||
variant="text"
|
|
||||||
@click="addComment"
|
|
||||||
>
|
|
||||||
Отправить
|
|
||||||
</v-btn>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
</v-card>
|
|
||||||
</v-col>
|
|
||||||
</v-row> -->
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -502,9 +527,10 @@
|
|||||||
Отмена
|
Отмена
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn
|
<v-btn
|
||||||
|
|
||||||
color="modal_btn"
|
color="modal_btn"
|
||||||
variant="text"
|
variant="text"
|
||||||
@click="addComment"
|
@click="addComment(idnews)"
|
||||||
>
|
>
|
||||||
Отправить
|
Отправить
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -662,7 +688,7 @@ export default {
|
|||||||
|
|
||||||
)
|
)
|
||||||
gallery.value = true
|
gallery.value = true
|
||||||
console.log(newss.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -687,9 +713,12 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const addComment = () => {
|
const addComment = (idnew) => {
|
||||||
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
|
|
||||||
dialogCommentShow.value=!dialogCommentShow.value
|
|
||||||
|
|
||||||
|
axiosApiInstance.post(`api/navigation/news/`, {news: idnew, text: textcomment.value}).then(result => {
|
||||||
|
dialogCommentShow.value=false
|
||||||
|
|
||||||
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
||||||
})
|
})
|
||||||
@@ -701,6 +730,7 @@ export default {
|
|||||||
|
|
||||||
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
newss.value.result[newss.value.result.findIndex(e=> e.id==result.data['news'])].comment = result.data.comment
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -748,6 +778,10 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nextnews = (idnews) => {
|
||||||
|
console.log(route);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const limitText=(text)=> {
|
const limitText=(text)=> {
|
||||||
@@ -780,7 +814,7 @@ export default {
|
|||||||
}, {deep:true})
|
}, {deep:true})
|
||||||
|
|
||||||
const imagesIn = () => {
|
const imagesIn = () => {
|
||||||
console.log(newss.value.result[0].gallery.length);
|
|
||||||
return newss.value.result[0].gallery.length
|
return newss.value.result[0].gallery.length
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -852,7 +886,8 @@ export default {
|
|||||||
heartIcoAll,
|
heartIcoAll,
|
||||||
toggleLikeAll,
|
toggleLikeAll,
|
||||||
imagesIn,
|
imagesIn,
|
||||||
switchComGal
|
switchComGal,
|
||||||
|
nextnews
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -861,9 +896,10 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style >
|
<style >
|
||||||
.comgal .v-selection-control, .comgal .v-switch__thumb {
|
|
||||||
|
|
||||||
color: #b86e95;
|
.comgal .v-switch__thumb {
|
||||||
|
|
||||||
|
color: white!important;
|
||||||
|
|
||||||
}
|
}
|
||||||
.posFooter {
|
.posFooter {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- <my-helper :pretext="onlineuser"/> -->
|
<!-- <my-helper :pretext="onlineuser"/> v-for="x in onlineuser" -->
|
||||||
<v-list-item v-for="x in onlineuser"
|
<v-list-item v-for="x in onlineuser"
|
||||||
:key="x"
|
:key="x"
|
||||||
:prepend-avatar="checkremote( `${spravURL}${x}.jpg`)"
|
:prepend-avatar="checkremote( `${spravURL}${x}.jpg`)"
|
||||||
@@ -39,12 +39,11 @@ export default {
|
|||||||
const wsfuncs={onliner:function(data){
|
const wsfuncs={onliner:function(data){
|
||||||
|
|
||||||
let newset = new Set(data)
|
let newset = new Set(data)
|
||||||
console.log(Array.from(newset));
|
|
||||||
let arr= Array.from(newset)
|
let arr= Array.from(newset)
|
||||||
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
arr.splice(arr.findIndex(e=> e == accountStore.user.login), 1)
|
||||||
|
|
||||||
|
|
||||||
console.log(accountStore.user.login,'accountStore');
|
|
||||||
onlineuser.value = arr
|
onlineuser.value = arr
|
||||||
}}
|
}}
|
||||||
const accountStore = useAccountStore()
|
const accountStore = useAccountStore()
|
||||||
|
|||||||
@@ -116,7 +116,6 @@
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
favoritLinks()
|
favoritLinks()
|
||||||
console.log(accountStore.user.is_staff, '=1==1=1=1=1=1=1=1=1=1==1==1=1=1=1=1');
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const favoritLinks = () => {
|
const favoritLinks = () => {
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
class="flex-column d-flex"
|
class="flex-column d-flex"
|
||||||
|
|
||||||
>
|
>
|
||||||
<news-list-news/>
|
<!-- <news-list-news/> -->
|
||||||
|
<news-crossroad/>
|
||||||
|
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -13,12 +14,14 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {pagecounter} from '@/utils/universal_functions'
|
import {pagecounter} from '@/utils/universal_functions'
|
||||||
import NewsListNews from '../components/news-list-news.vue'
|
import newsCrossroad from '../components/news-crossroad.vue'
|
||||||
|
// import NewsListNews from '../components/news-list-news.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
newsCrossroad
|
||||||
|
|
||||||
NewsListNews
|
// NewsListNews
|
||||||
},
|
},
|
||||||
setup(){
|
setup(){
|
||||||
pagecounter()
|
pagecounter()
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 239 KiB |
@@ -9,7 +9,9 @@ urlpatterns = [
|
|||||||
path('news/', NewsAPIView.as_view(), name='NewsAPIView'),
|
path('news/', NewsAPIView.as_view(), name='NewsAPIView'),
|
||||||
path('gallery/', GalleryAPIView.as_view(), name='GalleryAPIView'),
|
path('gallery/', GalleryAPIView.as_view(), name='GalleryAPIView'),
|
||||||
path('carousels/', CarouselsAPIView.as_view(), name='CarouselsAPIView'),
|
path('carousels/', CarouselsAPIView.as_view(), name='CarouselsAPIView'),
|
||||||
path('ckeditor/', include('ckeditor_uploader.urls'))
|
path('ckeditor/', include('ckeditor_uploader.urls')),
|
||||||
|
|
||||||
|
path('newscrossroad/', NewsCrossroadAPIView.as_view(), name='NewsCrossroadAPIView')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,11 @@ class NewsAPIView(ListAPIView):
|
|||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
if request.GET.__contains__('id'):
|
if request.GET.__contains__('id'):
|
||||||
|
print('Получена одна новость по ид')
|
||||||
newsqueryset = News.objects.filter(pk=int(request.GET.get('id')))
|
newsqueryset = News.objects.filter(pk=int(request.GET.get('id')))
|
||||||
allnews = 1
|
allnews = 1
|
||||||
else:
|
else:
|
||||||
|
print('Получены все новости по ид')
|
||||||
newsqueryset = News.objects.all().order_by('-cdate')
|
newsqueryset = News.objects.all().order_by('-cdate')
|
||||||
allnews =newsqueryset.count()
|
allnews =newsqueryset.count()
|
||||||
|
|
||||||
@@ -93,6 +95,35 @@ class NewsAPIView(ListAPIView):
|
|||||||
|
|
||||||
return Response(back)
|
return Response(back)
|
||||||
|
|
||||||
|
|
||||||
|
class NewsCrossroadAPIView(ListAPIView):
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
if request.GET.__contains__('id'):
|
||||||
|
print('Получена одна новость по ид')
|
||||||
|
newsqueryset = News.objects.filter(pk=int(request.GET.get('id')))
|
||||||
|
else:
|
||||||
|
print('Получены все новости по ид')
|
||||||
|
newsqueryset = News.objects.all().order_by('-cdate')
|
||||||
|
countpage = newsqueryset.count()
|
||||||
|
print(countpage,'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
|
||||||
|
if request.GET.get("name") == "/":
|
||||||
|
print('Запрос на новости для главной страницы')
|
||||||
|
newsqueryset = newsqueryset[:10]
|
||||||
|
else:
|
||||||
|
print('Запрос на новости с пагинацией')
|
||||||
|
|
||||||
|
pagesel = int(request.GET.get("page"))*int(request.GET.get("countpage"))
|
||||||
|
|
||||||
|
newsqueryset =newsqueryset[pagesel:pagesel+int(request.GET.get("countpage"))]
|
||||||
|
|
||||||
|
|
||||||
|
result = NewsSerializer(newsqueryset, many=True).data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Response({"result":result, "countpage": round(countpage/int(request.GET.get("countpage")))})
|
||||||
|
|
||||||
class CarouselsAPIView(ListAPIView):
|
class CarouselsAPIView(ListAPIView):
|
||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
serializer_class = CarouselsSerializer
|
serializer_class = CarouselsSerializer
|
||||||
|
|||||||
Reference in new issue
Block a user