Шаблоны карточек
This commit is contained in:
1 parent
50ad487a17
commit
bf93e12780
9 files changed
+169
-182
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>
|
||||
<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" >
|
||||
<div>
|
||||
<card-total
|
||||
@@ -36,7 +71,7 @@
|
||||
/>
|
||||
</div>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-row> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -45,112 +80,31 @@ import {splitname} from '@/utils/universal_functions'
|
||||
import starLike from '@/components/UI/feedback/star-like.vue'
|
||||
import CardTotal from '@/components/UI/aboutportal/card-total.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 {
|
||||
|
||||
components: {
|
||||
starLike,
|
||||
CardTotal,
|
||||
TopUser
|
||||
TopUser,
|
||||
PatternCard,
|
||||
CardFeedback
|
||||
},
|
||||
|
||||
props: {
|
||||
props:
|
||||
{
|
||||
feedback: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
|
||||
setup(props, {emit}) {
|
||||
const total = ref(0)
|
||||
const crit = ref({count:0, login:'', fio: '', post: '', info: [], total: 0})
|
||||
const forstar = ref({})
|
||||
setup() {
|
||||
|
||||
|
||||
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)=>{
|
||||
return a+b
|
||||
}, 0)/val.rating.length).toFixed(1)
|
||||
}
|
||||
|
||||
const sorted = Object.values(us)
|
||||
.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 {
|
||||
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: {
|
||||
|
||||
title: {
|
||||
type: Text,
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
|
||||
ico: {
|
||||
type: Text,
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,53 +76,6 @@
|
||||
</span>
|
||||
</td>
|
||||
</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>
|
||||
</v-table>
|
||||
</template>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
:title="'Самые активные пользователи'"
|
||||
:ico="'mdi-star-circle'"
|
||||
>
|
||||
<!-- <template v-slot:filling>
|
||||
<template v-slot:filling>
|
||||
<v-data-table
|
||||
v-model:expanded="expanded"
|
||||
:headers="dessertHeaders"
|
||||
@@ -90,7 +90,7 @@
|
||||
</template>
|
||||
|
||||
</v-data-table>
|
||||
</template> -->
|
||||
</template>
|
||||
</pattern-card>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,54 +1,75 @@
|
||||
<template>
|
||||
|
||||
<v-row class="h-100 ">
|
||||
|
||||
<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].ratings"
|
||||
: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>
|
||||
<v-row
|
||||
v-for="(x, key) in criteria"
|
||||
:key = key
|
||||
class="align-center"
|
||||
no-gutters
|
||||
>
|
||||
|
||||
<v-col class="flex-grow-0">
|
||||
|
||||
</v-col>
|
||||
<v-col class=""
|
||||
|
||||
lg=5
|
||||
>
|
||||
<v-icon
|
||||
size="large"
|
||||
:color="x.color"
|
||||
:icon="x.ico"
|
||||
<v-col lg=12>
|
||||
<v-icon
|
||||
size="x-small"
|
||||
:color="x.color"
|
||||
:icon="x.ico"
|
||||
/>
|
||||
{{x.name}}
|
||||
{{x.name}}
|
||||
</v-col>
|
||||
<v-col
|
||||
|
||||
lg=6
|
||||
>
|
||||
<v-col lg=12>
|
||||
<v-rating
|
||||
v-model="message[key].ratings"
|
||||
:hover="typeof(key) == 'number'"
|
||||
half-increments
|
||||
:readonly="how==''?true:false"
|
||||
readonly
|
||||
:size="16"
|
||||
color="yellow"
|
||||
:density="how==''?'compact':'comfortable'"
|
||||
:density="'comfortable'"
|
||||
/>
|
||||
</v-col>
|
||||
<v-divider v-show="how=='modal'"/>
|
||||
</v-row >
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
|
||||
|
||||
</v-row>
|
||||
</template>
|
||||
</pattern-card-feed>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue'
|
||||
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
|
||||
|
||||
import { computed } from 'vue'
|
||||
|
||||
export default {
|
||||
|
||||
@@ -69,10 +90,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
PatternCardFeed,
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
|
||||
// console.log(useDebugValue(getCurrentComponent().proxy.$options.name) , 'route.path');
|
||||
const message = computed({
|
||||
get: () => props.ratings,
|
||||
set: (value) => emit('update:ratings', value)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<star-like
|
||||
:criteria=feedbackdata.basecrit
|
||||
:rating=feedbackdata.nowrating
|
||||
:ratings=feedbackdata.nowrating
|
||||
how="modal"
|
||||
@update:rating="feedbackdata.nowrating = $event"
|
||||
/>
|
||||
|
||||
@@ -39,8 +39,11 @@
|
||||
/>
|
||||
|
||||
</v-col>
|
||||
<v-col class="bg-red">
|
||||
<my-helper :pretext="feedback"/>
|
||||
<v-col class="d-flex flex-column">
|
||||
<feedmodul
|
||||
:feedback="feedback"
|
||||
/>
|
||||
<!-- <my-helper :pretext="feedback"/> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
</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 CardTotal from '@/components/UI/aboutportal/card-total.vue'
|
||||
// import Feedmodul from '@/components/UI/aboutportal/feedmodul.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -77,7 +81,8 @@ export default {
|
||||
ToolbarFilter,
|
||||
RatingPage,
|
||||
|
||||
CardTotal
|
||||
CardTotal,
|
||||
// Feedmodul
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user