Алерт
This commit is contained in:
1 parent
db9a6e1c35
commit
67224546d4
4 files changed
+55
-160
No files matched your search
@@ -1,148 +0,0 @@
|
|||||||
<template>
|
|
||||||
<v-row class="h-100" v-if="how=='modal'">
|
|
||||||
<v-col class="d-flex flex-column align-self-center">
|
|
||||||
<v-row
|
|
||||||
v-for="(x, key) in criteria"
|
|
||||||
:key = key
|
|
||||||
class="align-center"
|
|
||||||
>
|
|
||||||
<v-col
|
|
||||||
class="pl-5"
|
|
||||||
lg=5
|
|
||||||
>
|
|
||||||
<v-icon
|
|
||||||
size="large"
|
|
||||||
:color="x.color"
|
|
||||||
:icon="x.ico"
|
|
||||||
/>
|
|
||||||
{{x.name}}
|
|
||||||
</v-col>
|
|
||||||
<v-col lg=6>
|
|
||||||
|
|
||||||
<v-rating
|
|
||||||
v-model="message[key].rating"
|
|
||||||
:hover="typeof(key) == 'number'"
|
|
||||||
half-increments
|
|
||||||
color="yellow"
|
|
||||||
:density="'comfortable'"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
<v-divider/>
|
|
||||||
</v-row>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
<pattern-card-feed
|
|
||||||
v-else
|
|
||||||
:title="'Средняя оценка'"
|
|
||||||
>
|
|
||||||
<template v-slot:filling_feedback>
|
|
||||||
|
|
||||||
<div v-if="criteria.length!=0" class="pt-1">
|
|
||||||
<v-row
|
|
||||||
class="align-center flex-column scoreheight"
|
|
||||||
no-gutters
|
|
||||||
>
|
|
||||||
<div class="flex-column d-flex pa-0"
|
|
||||||
v-for="(x, key) in criteria"
|
|
||||||
:key = key
|
|
||||||
>
|
|
||||||
|
|
||||||
<v-col lg=1 class="text-subtitle-1 font-weight-regular cursor-default w100 pa-0">
|
|
||||||
<v-icon
|
|
||||||
size="small"
|
|
||||||
:color="x.color"
|
|
||||||
:icon="x.ico"
|
|
||||||
/>
|
|
||||||
{{x.name}}
|
|
||||||
</v-col>
|
|
||||||
<v-col lg=2 class=" w100 pa-0 ">
|
|
||||||
|
|
||||||
<v-rating
|
|
||||||
v-model="message[key].ratings"
|
|
||||||
:hover="typeof(key) == 'number'"
|
|
||||||
half-increments
|
|
||||||
|
|
||||||
readonly
|
|
||||||
:size="25"
|
|
||||||
color="yellow"
|
|
||||||
:density="'comfortable'"
|
|
||||||
/>
|
|
||||||
</v-col>
|
|
||||||
</div>
|
|
||||||
</v-row>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="d-flex flex-column" v-else>
|
|
||||||
<v-row
|
|
||||||
|
|
||||||
class="align-center flex-column scoreheight gap mt-n2"
|
|
||||||
no-gutters
|
|
||||||
>
|
|
||||||
<v-col
|
|
||||||
class="text-h6 pt-8 text-grey text-center align-self-center text--lighten-1 font-weight-light"
|
|
||||||
>
|
|
||||||
За выбранный период оценок нет
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
</v-row>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
|
||||||
</pattern-card-feed>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
|
|
||||||
|
|
||||||
import { computed } from 'vue'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
|
|
||||||
props: {
|
|
||||||
criteria: {
|
|
||||||
type: Object,
|
|
||||||
default: {}
|
|
||||||
},
|
|
||||||
|
|
||||||
ratings: {
|
|
||||||
type: Object,
|
|
||||||
default: {}
|
|
||||||
},
|
|
||||||
|
|
||||||
how: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
components: {
|
|
||||||
PatternCardFeed,
|
|
||||||
},
|
|
||||||
|
|
||||||
setup(props, { emit }) {
|
|
||||||
|
|
||||||
|
|
||||||
const message = computed({
|
|
||||||
get: () => props.ratings,
|
|
||||||
set: (value) => emit('update:rating', value)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
|
||||||
message
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.scoreheight {
|
|
||||||
min-height: 150px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -60,6 +60,7 @@ import { ref, onMounted, computed } from 'vue'
|
|||||||
import { axiosApiInstance } from '@/utils/axios-api'
|
import { axiosApiInstance } from '@/utils/axios-api'
|
||||||
|
|
||||||
import FeedstarLike from '@/components/UI/feedback/feedstar-like.vue'
|
import FeedstarLike from '@/components/UI/feedback/feedstar-like.vue'
|
||||||
|
import { useAlertStore } from '@/store/AboutPortalFilter'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { FeedstarLike },
|
components: { FeedstarLike },
|
||||||
@@ -74,6 +75,7 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
setup(props, {emit}) {
|
setup(props, {emit}) {
|
||||||
|
const feedalert = useAlertStore().alert
|
||||||
const feedbackdata= ref({nowcomment: {comment: '' }, nowrating: []})
|
const feedbackdata= ref({nowcomment: {comment: '' }, nowrating: []})
|
||||||
|
|
||||||
function f_feedbackdata() {
|
function f_feedbackdata() {
|
||||||
@@ -122,11 +124,35 @@ export default {
|
|||||||
function feedSend() {
|
function feedSend() {
|
||||||
|
|
||||||
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
|
axiosApiInstance.post(`api/feedback/feedbackdata/`, {nowrating : feedbackdata.value.nowrating, nowcomment: feedbackdata.value.nowcomment} ).then(data => {})
|
||||||
|
feedalert.alert = true
|
||||||
|
textFromAlert()
|
||||||
|
|
||||||
menusCloses()
|
menusCloses()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {feedbackdata, average, menusCloses, myLabel, feedSend}
|
const textFromAlert = () => {
|
||||||
|
if (feedbackdata.value.nowcomment.id ==null) {
|
||||||
|
feedalert.text = "Оценка отправлена, спасибо за участие"
|
||||||
|
feedalert.ico = "mdi-redo-variant"
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
feedalert.text = "Оценка обновлена"
|
||||||
|
feedalert.ico = "mdi-refresh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
feedbackdata,
|
||||||
|
average,
|
||||||
|
menusCloses,
|
||||||
|
myLabel,
|
||||||
|
feedSend,
|
||||||
|
feedalert
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,28 +2,44 @@
|
|||||||
|
|
||||||
<v-alert
|
<v-alert
|
||||||
color="#C51162"
|
color="#C51162"
|
||||||
icon="mdi-material-design"
|
:icon=feedalert.ico
|
||||||
theme="dark"
|
theme="dark"
|
||||||
border
|
|
||||||
width = "500"
|
width = "500"
|
||||||
position="fixed"
|
position="fixed"
|
||||||
class="bottom-alert"
|
location = "bottom"
|
||||||
v-model="feedalert"
|
class="mb-2"
|
||||||
closable
|
v-model="feedalert.alert"
|
||||||
>
|
:text=feedalert.text
|
||||||
Оценка отправлена, спасибо за участие
|
variant = "tonal"
|
||||||
|
density="compact"
|
||||||
|
>
|
||||||
</v-alert>
|
</v-alert>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, computed} from 'vue'
|
import { ref, computed, watch} from 'vue'
|
||||||
|
import { useAlertStore } from '@/store/AboutPortalFilter'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
|
|
||||||
const feedalert = ref(true)
|
const feedalert = useAlertStore().alert
|
||||||
|
|
||||||
|
watch(()=>feedalert ,(newValue,oldValue)=>{
|
||||||
|
console.log(feedalert, 'dsfsdfsdf')
|
||||||
|
|
||||||
|
}, {deep:true})
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
feedalert.alert = false
|
||||||
|
feedalert.text=""
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
feedalert
|
feedalert
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ export const usePortalFilterStore = defineStore('filter', () => {
|
|||||||
|
|
||||||
export const useAlertStore = defineStore('uniAlert', () => {
|
export const useAlertStore = defineStore('uniAlert', () => {
|
||||||
|
|
||||||
const alert = ref({ "alert": true,
|
const alert = ref({ "alert": false,
|
||||||
"text": new Date(),
|
"text": '',
|
||||||
|
"ico": 'mdi-plus'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user