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