Комментарии

This commit is contained in:
iriska-gri committed 2024-03-01 15:47:35 +03:00
1 parent ded62ab55d
commit 309b44a0e5
12 files changed
+193 -181

No files matched your search

@@ -8,7 +8,7 @@
<template v-slot:filling_feedback>
<v-row no-gutters>
<v-col class="bg-teal-lighten-4 align-self-center">
<list-user :author= "top.author" :from_which="'top_comment'"/>
<!-- <list-user :author= "top.author" :from_which="'top_comment'"/> -->
</v-col>
<v-col class="align-self-center pl-0">
<v-table density="compact" class="pa-0">
@@ -52,8 +52,9 @@
</thead>
<tbody >
<tr >
<th class="text-center">{{top.comment}}</th>
<th class="text-center">{{top.score}}</th>
<th class="text-center">{{top.comment.textarr.length}}</th>
</tr>
</tbody>
</v-table>
@@ -9,14 +9,14 @@
<v-row no-gutters class="flex-column gap">
<v-col lg=1 class="w100">
<v-card variant="flat" class="text-caption">
Последний комментарий оставлен <span class="text-body-1 font-weight-bold">{{formaComaTime(feedback.last_comment.time_create)}}</span>
<!-- Последний комментарий оставлен <span class="text-body-1 font-weight-bold">{{formaComaTime(feedback.last_comment.time_create)}}</span> -->
</v-card>
</v-col>
<v-col lg=3 class="w100">
<star-like
<!-- <star-like
:criteria=feedback.criteria
:ratings=feedback.criteria
/>
/> -->
</v-col>
<v-col
lg=2 class="w100"
@@ -27,12 +27,14 @@
<card-feedback :data="x"/>
</v-col>
<v-col class="d-flex flex-column">
<card-top-comment :top=dataTopUser />
<my-helper :pretext="dataTopUser"/>
<!-- <card-top-comment :top=dataTopUser /> -->
</v-col>
</v-row>
<!-- <my-helper :pretext="feedback"/>
<!--
-->
</template>
@@ -41,7 +43,7 @@
</template>
<script>
import { ref, watch } from 'vue'
import { ref, watch, computed } from 'vue'
import {formaComaTime, splitname} from '@/utils/universal_functions'
import starLike from '@/components/UI/feedback/star-like.vue'
@@ -66,16 +68,47 @@ export default {
{
feedback: {
type: Object,
default: () => {}
default: () => {return {feed:[], last_comment:{time_create:'2024-01-01'}}}
}
},
setup(props) {
const dataTopUser = ref({})
const dataTopUser = computed({
get() {
let ob = {}
let tuser = {}
props.feedback.feed.forEach((e) => {
if (!ob[e.author.id]) {
ob[e.author.id] = 0
}
ob[e.author.id] += 1
})
if (Object.keys(ob).length > 0){
let top = Object.keys(ob).reduce((a,b) => ob[a] > ob[b] ? a: b)
let puser = props.feedback.feed.filter(e=> e.author.id == top)
tuser=Object.assign({},puser[puser.length-1])
tuser.fio=splitname(tuser.author)
tuser.score = puser.length
tuser.comment = puser.filter(e=>e.comment.length>0).sort((a,b)=> {return a.id-b.id})
console.log(tuser, 'e');
}
return tuser
}
})
const top_comment = () => {
let topUser =
props.feedback.feed.reduce((acc, item)=> {
let topUser = props.feedback.feed.reduce((acc, item)=> {
if (!acc[item.author.id]) {
acc[item.author.id] ={author: {id: 0, login: "", post: "", fio: ""}, score: 0, comment: {textarr: [], data: '', text: ''}}
}
@@ -92,21 +125,24 @@ export default {
return acc
}, {})
const sorted = Object.entries(topUser)
.sort(([,a],[,b]) => (b.comment.textarr.length - a.comment.textarr.length))
if(Object.keys(topUser).length>0){
const sorted = topUser
.sort((a,b) => (b.comment.textarr.length - a.comment.textarr.length))
dataTopUser.value = sorted[0][1]
}else{
// console.log(props.feedback.feed, sorted, 'dataTopUser.valuedataTopUser.value');
dataTopUser.value =[]
}
}
top_comment()
// top_comment()
return {
formaComaTime,
dataTopUser
@@ -167,7 +167,7 @@ export default {
// console.log(res.labels,"datat");
}
// res.datasets[1].data=[]
console.log(res,"reeeees");
return res
}})
@@ -204,7 +204,7 @@ export default {
let bothuser = new Set([...baseunic].filter(element => crrunic.has(element)))
console.log(baseunic.size,bothuser.size, 'fullper');
return baseunic.size ==0?0:bothuser.size*100/baseunic.size
}
@@ -133,7 +133,7 @@ export default {
let data = []
props.pages_count.forEach((e) => {
console.log(e.visitdate == moment().format("YYYY-MM-DD"));
let ind = data.findIndex(el=>el.name==e.pages)
if(ind==-1){
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}}
@@ -186,7 +186,7 @@ export default {
const customSort= ()=> {
let arr=tabledata.value
console.log(sortBy.value,"error");
if (sortBy.value!==undefined && sortBy.value.length>0){
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
if (untot.value=='unic'){
@@ -164,7 +164,7 @@ export default {
let indt = ob.tooltip.findIndex(elem =>
elem.namepages === e.pages)
console.log(indt,'indtindt')
if (indt == -1) {
ob.tooltip.push({
namepages: e.pages,
@@ -28,6 +28,7 @@
:image="checkremote( `${spravURL}${author.login}.jpg`)"
class="mr-2"
/>
{{splitname(author)}}
</v-chip>
@@ -301,12 +301,12 @@ export default {
const scrimg = ref([])
const screenimg = () => {
if(!accountStore.cod2user){
clearAxios.get(`api/navigation/screensaver/`)
.then(data => {
scrimg.value = data.data[0].img
})
})}
}
screenimg()
+7 -64
View File
@@ -31,7 +31,7 @@
</v-col>
<v-col class="w100 ">
<!-- -------------------------------------------------------------- -->
<my-helper :pretext="alldata.period"/>
<my-helper :pretext="alldata.feedback"/>
<!-- -------------------------------------------------------------- -->
<v-row no-gutters class="h-100 gap">
<v-col class="flex-column d-flex">
@@ -53,9 +53,9 @@
</v-col>
<v-col lg=2 class="d-flex flex-column">
<!-- <feedmodul
:feedback="feedback"
/> -->
<feedmodul
:feedback="alldata.feedback"
/>
</v-col>
</v-row>
</v-col>
@@ -100,63 +100,6 @@ export default {
setup(){
const dataActivusers = [
{
"user": {
"id": 107,
"login": "9966-00-107",
"post": "Старший специалист 1 разряда",
"fio": "Гришина И.С."
},
"info": {
"count": 8909,
"session": 37,
"pages": 90
},
"tooltip": [
{
"namepages": "О портале",
"count": 8424,
"unic": 35
},
{
"namepages": "Портал МИ ФНС России по ЦОД №2",
"count": 376,
"unic": 24
},
{
"namepages": "Отдел кадров и безопасности",
"count": 11,
"unic": 7
},
{
"namepages": "Лента новостей",
"count": 43,
"unic": 8
},
{
"namepages": "Об инспекции",
"count": 22,
"unic": 8
},
{
"namepages": "Часто задаваемые вопросы",
"count": 17,
"unic": 2
},
{
"namepages": "Безопасность",
"count": 8,
"unic": 2
},
{
"namepages": "Разделы безопасности",
"count": 8,
"unic": 4
}
]
},
]
const dataLineChart = ref({})
const cardtotal = ref(
@@ -187,7 +130,7 @@ setup(){
const filterStore = usePortalFilterStore()
const alldata =ref({period: [], staff: 0, beforperiod: []})
const alldata =ref({period: [], staff: 0, beforperiod: [], feedback: {criteria: [], feed: []}})
const visition = () => {
axiosApiInstance.get(`api/watcher/testwatcher/?start=${formatDash(filterStore.date_period.startdate)}&end=${formatDash(filterStore.date_period.enddate)}`).then(result => {
@@ -265,7 +208,7 @@ setup(){
}
console.log(brdata,'33333333333333');
let bothuser = new Set([...periodusers].filter(element => beforperiodusers.has(element)))
cardtotal.value.crr.data = bothuser.size*100/beforperiodusers.size
sumtraffic(traffic)
@@ -568,7 +511,7 @@ setup(){
// dataChart,
// feedback,
filter: ref('d'),
dataActivusers
}
+4 -4
View File
@@ -25,7 +25,7 @@
<v-btn block class="text-caption" @click="filter='month'">Месяц</v-btn>
<v-btn block class="text-caption" @click="filter='day'">День</v-btn>
<!-- ------------------------------------------------------------------------- -->
<my-helper :pretext="dataActivusers"/>
<my-helper :pretext="feedback"/>
{{filter}}
</v-col>
</v-row>
@@ -44,14 +44,14 @@
</v-col>
<v-col lg=4 class="d-flex flex-column">
<rating-page :pages_count=pages_count />
<!-- <rating-page :pages_count=pages_count /> -->
</v-col>
<v-col lg=4 class="d-flex flex-column ">
<top-user
<!-- <top-user
:activusers = dataActivusers
/>
/> -->
</v-col>
<v-col lg=2 class="d-flex flex-column">