diff --git a/src/front/src/components/UI/aboutportal/rating-page.vue b/src/front/src/components/UI/aboutportal/rating-page.vue new file mode 100644 index 000000000..75aac39bc --- /dev/null +++ b/src/front/src/components/UI/aboutportal/rating-page.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index 51ba68779..e901344fe 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -2,10 +2,11 @@ import {useAccountStore} from '@/store/AccountStore' import axios from "axios"; const spravURL = 'http://10.252.44.33/accounting6/images/photo/' -// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://${window.location.host}/`; -// const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://${window.location.host}/`; -const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`; -const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`; +const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://${window.location.host}/`; +const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://${window.location.host}/`; +// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`; +// const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`; +const safetyURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000': `http://10.252.44.60:9965`; // для релизного меняем 'http://ukd/' // const baseURL = 'http://127.0.0.1:8000/'; @@ -89,4 +90,4 @@ async error => { }) -export { axiosApiInstance, clearAxios, baseURL,spravURL,baseWS } \ No newline at end of file +export { axiosApiInstance, clearAxios, baseURL,spravURL,baseWS, safetyURL } \ No newline at end of file diff --git a/src/front/src/views/AboutPortalPage.vue b/src/front/src/views/AboutPortalPage.vue index b31bdfe4c..fd1136e73 100644 --- a/src/front/src/views/AboutPortalPage.vue +++ b/src/front/src/views/AboutPortalPage.vue @@ -4,25 +4,32 @@ - + - 1 + + {{format1(previous.start)}} - {{format1(previous.end)}} + - + - - - - + - 3 - 4 + + + + visiting- (все данные) + + + + + + 3 + 4 + + + - - - - @@ -181,7 +184,6 @@ import { ref, watch } from 'vue' import {pagecounter, splitname, format1, format2} from '@/utils/universal_functions' - import { axiosApiInstance } from '@/utils/axios-api' import { usePortalFilterStore } from '@/store/AboutPortalFilter' @@ -191,7 +193,7 @@ import TopUser from '@/components/UI/aboutportal/top-user.vue' import LineChart from '@/components/UI/aboutportal/line-chart.vue' import PortalTraffic from '@/components/UI/aboutportal/portal-traffic.vue' import ToolbarFilter from '@/components/UI/aboutportal/toolbar-filter.vue' - +import RatingPage from '@/components/UI/aboutportal/rating-page.vue' export default { components: { @@ -200,17 +202,34 @@ export default { TopUser, LineChart, PortalTraffic, - ToolbarFilter + ToolbarFilter, + RatingPage }, setup(){ const filterStore = usePortalFilterStore() + const visiting = ref([]) const feedback = ref([]) const staff = ref(0) const dataLineChart = ref({}) + const previous = ref({start: new Date(), end: new Date()}) + const pages_count = ref({}) + + const previous_period =() => { + let days_between = Math.floor((new Date(filterStore.date_period.enddate) - new Date(filterStore.date_period.startdate)) / (1000*60*60*24)) + days_between += 1 + if (filterStore.date_period.startdate == filterStore.date_period.enddate) { + days_between = 1 + } + console.log(days_between, 'days_between'); + previous.value.start = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - days_between)) + previous.value.end = new Date(new Date(filterStore.date_period.startdate).setDate(new Date(filterStore.date_period.startdate).getDate() - 1)) + } + + pagecounter() const visition = () => { @@ -219,12 +238,32 @@ setup(){ visiting.value = result.data.result feedback.value = result.data.feedback visitionreduce() + })} visition() const visitionreduce = () => { + previous_period() let lineCharts = {} + // let portal_traffic = { + // now: { + // title: '', + // info: '', + // unique: new Set(), + // percentage_staff: 0, + // comparison_period: new Set(), + // percentage_period: 0 + // }, + // year: { + // title: 'За период', + // info: '', + // unique: new Set(), + // percentage_staff: 0, + // comparison_period: new Set(), + // percentage_period: 0 + // } + // } const groupedData = visiting.value.reduce((acc, item) => { // Данные для графика по фильтру @@ -233,25 +272,53 @@ setup(){ if (!lineCharts[item.visitdate]) { lineCharts[item.visitdate] = {count: 0, unic: []} } + lineCharts[item.visitdate]['count'] +=item.count if (!lineCharts[item.visitdate]['unic'].includes(splitname(item.author))) { lineCharts[item.visitdate]['unic'].push(splitname(item.author)) } - + + // Данные для таблицы по страницам + if (!acc[item.pages]) { + acc[item.pages] = { + now: + {unique: new Set(), countall: 0}, + year: + {unique: new Set(), countall: 0} + } + } + + acc[item.pages].year.unique.add(splitname(item.author)) + acc[item.pages].year.countall += item.count } + + if (item.visitdate == format2(filterStore.date_period.enddate)) { + acc[item.pages].now.unique.add(splitname(item.author)) + acc[item.pages].now.countall += item.count + } + + // Данные для посещаемость портала + if (item.visitdate >= format2(previous.value.start) && item.visitdate <= format2(previous.value.end)){ + // console.log(item.visitdate, '------------------------------'); + } + dataLineChart.value = lineCharts + return acc }, {}) + + // watch(()=>filterStore.date_period,(newValue,oldValue)=>{ - if(newValue){ - visitionreduce() - } - }, {deep:true}) - + if(newValue){ + visitionreduce() + } + }, {deep:true}) + pages_count.value = groupedData + return groupedData } @@ -264,10 +331,11 @@ setup(){ return { visiting, - - + pages_count, visitionreduce, - dataLineChart + dataLineChart, + previous, + format1 // countgrupp, // activuser,