Шаблоны карточек

This commit is contained in:
iriska-gri committed 2024-02-15 14:53:22 +03:00
1 parent 50ad487a17
commit bf93e12780
9 files changed
+159 -172

No files matched your search

@@ -0,0 +1,22 @@
<template>
<pattern-card-feed
:title="'Оставлено комментариев'"
>
<template v-slot:filling_feedback>
dsd
</template>
</pattern-card-feed>
</template>
<script>
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
export default {
components: {
PatternCardFeed,
}
}
</script>
<style>
</style>
@@ -1,5 +1,40 @@
<template> <template>
<v-row no-gutters class="h-100"> <pattern-card
:title="'Обратная связь'"
:ico="'mdi-comment-multiple-outline'"
>
<template v-slot:filling>
<v-row no-gutters class="flex-column gap">
<v-col lg=3 class="w100">
<star-like
:criteria=feedback.criteria
:ratings=feedback.criteria
/>
</v-col>
<v-col lg=3 class="bg-blue w100">
<card-feedback/>
</v-col>
</v-row>
<my-helper :pretext="feedback"/>
<!-- <v-card class="pa-1 ">
<star-like
v-if="feedback.criteria.length>0"
:criteria=feedback.criteria
:ratings=feedback.criteria
/>
<v-row v-else class="h-100">
<v-col class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light">
Оценок за выбранный период нет
</v-col>
</v-row>
</v-card> -->
</template>
</pattern-card>
<!-- <v-row no-gutters class="h-100">
<v-col class="d-flex flex-column gap" > <v-col class="d-flex flex-column gap" >
<div> <div>
<card-total <card-total
@@ -36,7 +71,7 @@
/> />
</div> </div>
</v-col> </v-col>
</v-row> </v-row> -->
</template> </template>
<script> <script>
@@ -45,112 +80,31 @@ import {splitname} from '@/utils/universal_functions'
import starLike from '@/components/UI/feedback/star-like.vue' import starLike from '@/components/UI/feedback/star-like.vue'
import CardTotal from '@/components/UI/aboutportal/card-total.vue' import CardTotal from '@/components/UI/aboutportal/card-total.vue'
import TopUser from '@/components/UI/aboutportal/top-user.vue' import TopUser from '@/components/UI/aboutportal/top-user.vue'
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
import CardFeedback from '@/components/UI/aboutportal/card-feedback.vue'
export default { export default {
components: { components: {
starLike, starLike,
CardTotal, CardTotal,
TopUser TopUser,
PatternCard,
CardFeedback
}, },
props: { props:
feedback: {
type: Array,
default: () => []
},
name: {
type: String,
default: ''
}
},
setup(props, {emit}) {
const total = ref(0)
const crit = ref({count:0, login:'', fio: '', post: '', info: [], total: 0})
const forstar = ref({})
const average = () => {
let tot = new Set()
let us = {}
let t = 0
const avgfeed =
props.feedback
.reduce((acc, item) => {
if (!acc[item.namecrit]) {
acc[item.namecrit] = {rating: [], ico: '', color: '', name: ''}
}
acc[item.namecrit]['rating'].push(item.rating)
acc[item.namecrit]['ico'] = item.ico
acc[item.namecrit]['color'] = item.color
acc[item.namecrit]['name'] = item.namecrit
tot.add(item.usercom)
if (!us[splitname(item.author)]) {
us[splitname(item.author)] = {login: '', fio: '', post: '', info: new Set()}
}
if (item.comment.length > 0) {
us[splitname(item.author)]['fio']= splitname(item.author)
us[splitname(item.author)]['info'].add(item.comment)
us[splitname(item.author)]['login'] = item.author.login
us[splitname(item.author)]['post'] = item.author.post
}
return acc
}, {})
for (let [key,val] of Object.entries(avgfeed))
{ {
avgfeed[key]['rating'] = (val.rating.reduce((a,b)=>{ feedback: {
return a+b type: Object,
}, 0)/val.rating.length).toFixed(1) default: () => {}
} }
},
const sorted = Object.values(us) setup() {
.sort((a,b) => (b.info.size - a.info.size))
for (let val of sorted) {
t += val.info.size
}
if (sorted[0] === undefined) {
crit.value = {
count: 0, login: '', fio: '', post: '', info: '', total: 0
}
}
else {
crit.value = {
count: sorted[0].info.size, login: sorted[0].login, fio: sorted[0].fio, post: sorted[0].post, info: sorted[0].info, total: 0
}
}
crit.value.total = t
total.value = tot.size
return avgfeed
}
watch(()=>props.feedback ,(newValue,oldValue)=>{
if(newValue){
forstar.value = average()
}
}, {deep:true})
return { return {
average,
total,
crit,
forstar
} }
} }
} }
@@ -0,0 +1,30 @@
<template>
<v-card class="h-100 d-flex">
<v-row no-gutters class="flex-column gap">
<v-col lg=1 class=" bg-blue-grey-darken-1 w100">
{{title}}
</v-col>
<v-col>
<slot name="filling_feedback"></slot>
</v-col>
</v-row>
</v-card>
</template>
<script>
export default {
props: {
title: {
type: String,
default: ''
},
}
}
</script>
<style>
</style>
@@ -31,12 +31,12 @@ export default {
props: { props: {
title: { title: {
type: Text, type: String,
default: '' default: ''
}, },
ico: { ico: {
type: Text, type: String,
default: '' default: ''
} }
} }
@@ -76,53 +76,6 @@
</span> </span>
</td> </td>
</tr> </tr>
<tr
v-for="(val, key) in pages_count.data"
:key="key"
>
<td class="text-left">{{key}}</td>
<td>
<tooltip-text
v-if="val.now.unique.length>0"
:text="modelrating?val.now.unique.length:val.now.countall"
>
<template v-slot:tooltip>
<v-row
no-gutters v-for="n in val.now.unique"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</template>
</tooltip-text>
<span v-else>
0
</span>
</td>
<td>
<tooltip-text
v-if="val.year.unique.length>0"
:text="modelrating?val.year.unique.length:val.year.countall"
>
<template v-slot:tooltip>
<v-row
no-gutters
v-for="n in val.year.unique"
:key="n"
>
<v-col>
{{n}}
</v-col>
</v-row>
</template>
</tooltip-text>
<span v-else>
0
</span>
</td>
</tr>
</tbody> </tbody>
</v-table> </v-table>
</template> </template>
@@ -3,7 +3,7 @@
:title="'Самые активные пользователи'" :title="'Самые активные пользователи'"
:ico="'mdi-star-circle'" :ico="'mdi-star-circle'"
> >
<!-- <template v-slot:filling> <template v-slot:filling>
<v-data-table <v-data-table
v-model:expanded="expanded" v-model:expanded="expanded"
:headers="dessertHeaders" :headers="dessertHeaders"
@@ -90,7 +90,7 @@
</template> </template>
</v-data-table> </v-data-table>
</template> --> </template>
</pattern-card> </pattern-card>
</template> </template>
@@ -1,20 +1,13 @@
<template> <template>
<v-row class="h-100" v-if="how=='modal'">
<v-row class="h-100 ">
<v-col class="d-flex flex-column align-self-center"> <v-col class="d-flex flex-column align-self-center">
<v-row <v-row
v-for="(x, key) in criteria" v-for="(x, key) in criteria"
:key = key :key = key
class="align-center" class="align-center"
> >
<v-col
<v-col class="flex-grow-0"> class="pl-5"
</v-col>
<v-col class=""
lg=5 lg=5
> >
<v-icon <v-icon
@@ -24,31 +17,59 @@
/> />
{{x.name}} {{x.name}}
</v-col> </v-col>
<v-col <v-col lg=6>
lg=6
>
<v-rating <v-rating
v-model="message[key].ratings" v-model="message[key].ratings"
:hover="typeof(key) == 'number'" :hover="typeof(key) == 'number'"
half-increments half-increments
:readonly="how==''?true:false"
color="yellow" color="yellow"
:density="how==''?'compact':'comfortable'" :density="'comfortable'"
/> />
</v-col> </v-col>
<v-divider v-show="how=='modal'"/> <v-divider/>
</v-row> </v-row>
</v-col> </v-col>
</v-row> </v-row>
<pattern-card-feed
v-else
:title="'Оставлено комментариев'"
>
<template v-slot:filling_feedback>
<v-row
v-for="(x, key) in criteria"
:key = key
class="align-center"
no-gutters
>
<v-col lg=12>
<v-icon
size="x-small"
:color="x.color"
:icon="x.ico"
/>
{{x.name}}
</v-col>
<v-col lg=12>
<v-rating
v-model="message[key].ratings"
:hover="typeof(key) == 'number'"
half-increments
readonly
:size="16"
color="yellow"
:density="'comfortable'"
/>
</v-col>
</v-row>
</template>
</pattern-card-feed>
</template> </template>
<script> <script>
import { computed } from 'vue' import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
import { computed } from 'vue'
export default { export default {
@@ -69,10 +90,12 @@ export default {
} }
}, },
components: {
PatternCardFeed,
},
setup(props, { emit }) { setup(props, { emit }) {
// console.log(useDebugValue(getCurrentComponent().proxy.$options.name) , 'route.path');
const message = computed({ const message = computed({
get: () => props.ratings, get: () => props.ratings,
set: (value) => emit('update:ratings', value) set: (value) => emit('update:ratings', value)
+1 -1
View File
@@ -15,7 +15,7 @@
<star-like <star-like
:criteria=feedbackdata.basecrit :criteria=feedbackdata.basecrit
:rating=feedbackdata.nowrating :ratings=feedbackdata.nowrating
how="modal" how="modal"
@update:rating="feedbackdata.nowrating = $event" @update:rating="feedbackdata.nowrating = $event"
/> />
+8 -3
View File
@@ -39,8 +39,11 @@
/> />
</v-col> </v-col>
<v-col class="bg-red"> <v-col class="d-flex flex-column">
<my-helper :pretext="feedback"/> <feedmodul
:feedback="feedback"
/>
<!-- <my-helper :pretext="feedback"/> -->
</v-col> </v-col>
</v-row> </v-row>
</v-col> </v-col>
@@ -66,6 +69,7 @@ import ToolbarFilter from '@/components/UI/aboutportal/toolbar-filter.vue'
import RatingPage from '@/components/UI/aboutportal/rating-page.vue' import RatingPage from '@/components/UI/aboutportal/rating-page.vue'
import CardTotal from '@/components/UI/aboutportal/card-total.vue' import CardTotal from '@/components/UI/aboutportal/card-total.vue'
// import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
export default { export default {
components: { components: {
@@ -77,7 +81,8 @@ export default {
ToolbarFilter, ToolbarFilter,
RatingPage, RatingPage,
CardTotal CardTotal,
// Feedmodul
}, },