рейтинг

This commit is contained in:
iriska-gri committed 2024-03-05 16:10:09 +03:00
1 parent ed7da81b23
commit 98825f27c9
1 file changed
+48 -21
@@ -16,17 +16,22 @@
>
<template v-slot:header.name>
<!-- <my-helper :pretext="tabledata"/> -->
<v-switch label="Всего"
false-value='unic'
true-value='total'
v-model="untot"></v-switch>
</template>
<template v-slot:item.name="{ value }">
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-1">
{{ value }}
</span>
</template>
<template v-slot:item.now="{ value, item }">
<v-switch
:label="untot"
false-value='уникальные'
true-value='всего'
hide-details
v-model="untot"
class="myleft ml-n4"
/>
</template>
<template v-slot:item.name="{ value }">
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-1">
{{ value }}
</span>
</template>
<template v-slot:item.now="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
@@ -35,8 +40,8 @@
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" class="cursor-help font-weight-medium text-subtitle-1 " >
{{value}}
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
{{value}}
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
</span>
</template>
@@ -67,7 +72,7 @@
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" class="cursor-help font-weight-medium text-subtitle-1" >
<span v-bind="props" :class="'untot'=='уникальные'?getColorPeriod1(value):getColorPeriod2(value)" class="cursor-help font-weight-medium text-subtitle-1" >
{{value}}
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
</span>
@@ -129,14 +134,14 @@ export default {
}
])
const untot=ref('unic')
const untot=ref('уникальные')
let headers = ref([
{ title: '', align: 'start', key: 'name' },
{ title: 'сегодня', align: 'center', key: 'now',
value: item => `${untot.value=='unic'?item.now.unic.size:item.now.total}`,
value: item => `${untot.value=='уникальные'?item.now.unic.size:item.now.total}`,
},
{ title: 'за период', align: 'center', key: 'period',
value: item => `${untot.value=='unic'?item.period.unic.size:item.period.total}` },
value: item => `${untot.value=='уникальные'?item.period.unic.size:item.period.total}` },
])
const datas = ()=>{
@@ -181,8 +186,27 @@ export default {
const modelrating = ref(false)
const getColorAll = (pages) => {
const getColorTooday1 = (pages) => {
if (pages > 10) return 'text-green'
else if (pages > 5) return 'text-orange'
else return 'text-red'
}
const getColorPeriod1 = (pages) => {
console.log(pages, 'ssssssssssssssssssssssssssssssss');
if (pages > 30) return 'text-green'
else if (pages > 15) return 'text-orange'
else return 'text-red'
}
const getColorTooday2 = (pages) => {
if (pages > 50) return 'text-green'
else if (pages > 25) return 'text-orange'
else return 'text-red'
}
const getColorPeriod2 = (pages) => {
console.log(pages, 'ssssssssssssssssssssssssssssssss');
if (pages > 100) return 'text-green'
else if (pages > 50) return 'text-orange'
else return 'text-red'
@@ -199,7 +223,7 @@ export default {
if (sortBy.value!==undefined && sortBy.value.length>0){
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
if (untot.value=='unic'){
if (untot.value=='уникальные'){
arr.sort((a,b)=>{
if (a[sortBy.value[0].key].unic.size>b[sortBy.value[0].key].unic.size) return factor[0]
@@ -232,7 +256,10 @@ export default {
customSort,
untot,
modelrating,
getColorAll,
getColorTooday1,
getColorPeriod1,
getColorTooday2,
getColorPeriod2,
getColorNow,
headers,
datas