Алерты

This commit is contained in:
iriska-gri committed 2024-03-18 09:58:14 +03:00
1 parent 657b089134
commit c28d94b9b1
12 files changed
+65 -64

No files matched your search

+6 -1
View File
@@ -15,6 +15,7 @@ import pandas as pd
class testView(APIView): class testView(APIView):
def get(self, request): def get(self, request):
"""Пример"""
newsqueryset = News.objects.all().order_by('cdate') newsqueryset = News.objects.all().order_by('cdate')
@@ -72,7 +73,11 @@ class getuserAPIView(APIView):
def get(self, request): def get(self, request):
"""
Параметр: userlogin
Пример: GET /api/accounts/getuser/?userlogin=9966-00-107
Результат: Выдает все данные о пользователе
"""
dt=datetime.now() dt=datetime.now()
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin')) queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
r=CardUserSerializer(queryset).data r=CardUserSerializer(queryset).data
@@ -1,40 +0,0 @@
<template>
<v-alert
width = "500"
position="fixed"
class="bottom-alert"
type="success"
title="Успех!"
text="Файл загружен"
:value="alert"
closable
></v-alert>
</template>
<script>
import { ref } from 'vue'
export default {
// props: {
// alert: {
// type: Boolean,
// default: false
// }
// },
setup(){
defineProps(['alert'])
// defineEmits(['update:alert'])
// const alert = ref(true)
return {defineProps}
}
}
</script>
<style>
.bottom-alert {
bottom: 10px;
left: 40%;
}
</style>
@@ -57,6 +57,7 @@ import { useAppStore } from '@/store/app'
import { ref } from 'vue' import { ref } from 'vue'
export default { export default {
name: "PageCounter",
props: { props: {
rail: { rail: {
+2 -1
View File
@@ -1,5 +1,6 @@
import myHelper from '@/components/UI/my-helper'; import myHelper from '@/components/UI/my-helper';
import InfoUserCard from '@/components/UI/infoUserCard.vue'; import InfoUserCard from '@/components/UI/infoUserCard.vue';
import TooltipText from '@/components/UI/tooltip-text.vue' import TooltipText from '@/components/UI/tooltip-text.vue'
import AlertDefault from '@/layouts/default/alertDefault.vue'
export default [myHelper, InfoUserCard, TooltipText, ] export default [myHelper, InfoUserCard, TooltipText, AlertDefault]
+2
View File
@@ -135,11 +135,13 @@ export default {
if (feedbackdata.value.nowcomment.id ==null) { if (feedbackdata.value.nowcomment.id ==null) {
feedalert.text = "Оценка отправлена, спасибо за участие" feedalert.text = "Оценка отправлена, спасибо за участие"
feedalert.ico = "mdi-redo-variant" feedalert.ico = "mdi-redo-variant"
feedalert.color = "green-darken-4"
} }
else { else {
feedalert.text = "Оценка обновлена" feedalert.text = "Оценка обновлена"
feedalert.ico = "mdi-refresh" feedalert.ico = "mdi-refresh"
feedalert.color="light-blue-darken-4"
} }
} }
@@ -27,11 +27,13 @@
v-if="x.text != '' || x.title != null" v-if="x.text != '' || x.title != null"
class="bgCard h-100 d-flex flex-column" class="bgCard h-100 d-flex flex-column"
> >
<v-card-title v-if="x.title != null" <v-card-title v-if="x.title != null"
class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0"> class="text-h3 text-uppercase titles text-text_carous ma-1 mb-0">
<v-row no-gutters > <v-row no-gutters >
<v-col class="align-self-center"> <v-col class="align-self-center">
{{x.title}} {{x.title}}
</v-col> </v-col>
<v-col class="flex-grow-0"> <v-col class="flex-grow-0">
<v-img <v-img
@@ -40,6 +42,7 @@
:src="`${burl}${x.sender}`" :src="`${burl}${x.sender}`"
cover cover
/> />
<!-- <my-helper :pretext=carous /> -->
</v-col> </v-col>
</v-row> </v-row>
</v-card-title> </v-card-title>
@@ -47,6 +50,7 @@
v-if="x.text != ''" v-if="x.text != ''"
class=" w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0" class=" w-50 flex-grow-0 text-h6 bgText overflow-auto ma-1 pa-0"
> >
<v-textarea <v-textarea
class="text-text_caroustext-black textareas font-weight-medium nocursor" class="text-text_caroustext-black textareas font-weight-medium nocursor"
:model-value=x.text :model-value=x.text
+23 -10
View File
@@ -60,7 +60,8 @@
<v-col></v-col> <v-col></v-col>
<v-col></v-col> <v-col></v-col>
<v-col></v-col> <v-col></v-col>
<v-alert
<!-- <v-alert
width = "500" width = "500"
position="fixed" position="fixed"
class="bottom-alert" class="bottom-alert"
@@ -71,13 +72,9 @@
:color='info=="Файл загружен"?"teal-darken-2":"red-darken-2"' :color='info=="Файл загружен"?"teal-darken-2":"red-darken-2"'
closable closable
></v-alert> ></v-alert> -->
</v-row> </v-row>
<!-- <v-row>
<v-col v-for="(x) in 6" :key=x class=" flex-column d-flex">
{{x}}
</v-col>
</v-row> -->
</v-col> </v-col>
</v-row> </v-row>
@@ -89,6 +86,7 @@ import { ref } from 'vue'
import { baseURL } from '@/utils/axios-api' import { baseURL } from '@/utils/axios-api'
import {getfromserver} from '@/utils/universal_functions' import {getfromserver} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from '@/utils/axios-api'
import { useAlertStore } from '@/store/AboutPortalFilter'
export default { export default {
setup(){ setup(){
@@ -96,7 +94,7 @@ export default {
const visiting = ref({}) const visiting = ref({})
const info = ref('') const info = ref('')
const t_dailyRound = ref('') const t_dailyRound = ref('')
const alert = ref(false) const feedalert = useAlertStore().alert
@@ -124,12 +122,27 @@ export default {
}) })
showInfo.value = true showInfo.value = true
dailyfiles.value = [] dailyfiles.value = []
alert.value = true feedalert.alert = true
textFromAlert()
} }
const textFromAlert = () => {
if (info.value=="Файл загружен") {
feedalert.text = "Файл загружен"
feedalert.ico = "mdi-check"
feedalert.color="green-darken-4"
}
else {
feedalert.text = "Ошибка загрузки"
feedalert.ico = "mdi-alert-circle-outline"
feedalert.color="pink-accent-4"
}
}
const detailRound = () => { const detailRound = () => {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`) axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
@@ -153,7 +166,7 @@ export default {
detailRound, detailRound,
t_dailyRound, t_dailyRound,
showInfo, showInfo,
alert
} }
} }
@@ -276,7 +276,7 @@
</v-card> </v-card>
<alert-default />
</v-main> </v-main>
<v-navigation-drawer v-if="accountStore.cod2user" <v-navigation-drawer v-if="accountStore.cod2user"
v-model="drawer_right" v-model="drawer_right"
@@ -307,7 +307,7 @@ import { clearAxios } from '@/utils/axios-api'
import { baseURL } from '@/utils/axios-api' import { baseURL } from '@/utils/axios-api'
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue' import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
import PageCounter from '../../components/UI/defaultportal/page-counter.vue' import PageCounter from '../../components/UI/defaultportal/page-counter.vue'
import AlertDefault from './alertDefault.vue'
export default { export default {
components: { components: {
@@ -315,8 +315,7 @@ export default {
OnlineUsers, OnlineUsers,
CardLike, CardLike,
VcardUser, VcardUser,
PageCounter, PageCounter
AlertDefault
}, },
mixins: [uf], mixins: [uf],
@@ -1,7 +1,7 @@
<template> <template>
<v-alert <v-alert
color="#C51162" :color=feedalert.color
:icon=feedalert.ico :icon=feedalert.ico
theme="dark" theme="dark"
max-height="40" max-height="40"
@@ -19,10 +19,11 @@
</template> </template>
<script> <script>
import { ref, computed, watch} from 'vue' import { watch} from 'vue'
import { useAlertStore } from '@/store/AboutPortalFilter' import { useAlertStore } from '@/store/AboutPortalFilter'
export default { export default {
name: "AlertDefault",
setup() { setup() {
const feedalert = useAlertStore().alert const feedalert = useAlertStore().alert
@@ -30,9 +31,9 @@ export default {
watch(()=>feedalert ,()=>{ watch(()=>feedalert ,()=>{
setTimeout(function() { setTimeout(function() {
feedalert.text="" feedalert.text=""
feedalert.ico="" feedalert.ico=""
feedalert.color=""
feedalert.alert = false feedalert.alert = false
}, 3000) }, 3000)
+2 -1
View File
@@ -21,7 +21,8 @@ export const useAlertStore = defineStore('uniAlert', () => {
const alert = ref({ "alert": false, const alert = ref({ "alert": false,
"text": '', "text": '',
"ico": 'mdi-plus' "ico": 'mdi-plus',
"color": ''
}) })
Binary file not shown.
+18 -4
View File
@@ -25,10 +25,11 @@ class LinkAPIView(ListAPIView):
class GalleryAPIView(ListAPIView): class GalleryAPIView(ListAPIView):
def get(self, request): """ """
# gal = Gallery.objects.filter(news_id=int(request.GET.get('idnews')))
# result = GallerySerializer(gal, many=True).data
return Response('result') # def get(self, request):
# return Response('result')
def post(self, request): def post(self, request):
gal = ScoreGallery.objects.filter(author=self.request.user, gallery=request.data['image']) gal = ScoreGallery.objects.filter(author=self.request.user, gallery=request.data['image'])
@@ -152,6 +153,19 @@ class NewsCrossroadAPIView(ListAPIView):
return Response(back) return Response(back)
class CarouselsAPIView(ListAPIView): class CarouselsAPIView(ListAPIView):
"""
Выбирает Данные из модели Carousels, у которых стоит параметр публикации, дата начала публикации меньше
или равна сегодняшнему дню и дата окончания больше или равна сегодняшнему дню, с сортировкой по приоритету,
с добавлением информации по дням рождениям, которые будут в текущем месяце, но не меньше сегодняшнего дня.
К дням рождения прибавлется рандомная картинка и рандомный текст
{
"title": "Новость прочее",
"text": "",
"link": "/media/newsimage/default.jpg",
"senders": "senderimage/dr.jpg"
}
"""
permission_classes = (AllowAny,) permission_classes = (AllowAny,)