|
@@ -205,60 +205,66 @@ const initTab = async () => {
|
|
|
await statisticStore.fetchRoomVisitChart({
|
|
|
roomTitle: ''
|
|
|
})
|
|
|
-}
|
|
|
-const initOnlineChart = () => {
|
|
|
- const chart1 = document.getElementById('chart-1')
|
|
|
- const data = unref(onelineTimeCount)
|
|
|
- const xAxis = data.map(i => i.dataKey)
|
|
|
- const yAxis = data.map(i => i.dataCount)
|
|
|
- const max = Math.max.apply(Math, yAxis) + 200
|
|
|
- const min =
|
|
|
- Math.min.apply(Math, yAxis) === 0 ? 0 : Math.min.apply(Math, yAxis)
|
|
|
- if (chart1) {
|
|
|
- if (!onlineTimeChart) {
|
|
|
- onlineTimeChart = echarts.init(chart1)
|
|
|
- }
|
|
|
-
|
|
|
- // 绘制图表
|
|
|
- onlineTimeChart.setOption({
|
|
|
- tooltip: {
|
|
|
- trigger: 'axis',
|
|
|
- axisPointer: {
|
|
|
- lineStyle: {
|
|
|
- width: 1,
|
|
|
- color: '#019680'
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- grid: {
|
|
|
- left: '2%',
|
|
|
- right: '2%',
|
|
|
- top: '2%',
|
|
|
- bottom: '10%',
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- legend: {
|
|
|
- orient: 'horizontal',
|
|
|
- bottom: 0
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- data: xAxis
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- min: min,
|
|
|
- max: max
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: t('statistic.aofubt'),
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- data: yAxis
|
|
|
- }
|
|
|
- ]
|
|
|
- })
|
|
|
+ if (unref(userVisitList)?.length || unref(userShareList)?.length) {
|
|
|
+ initRoomVisitChart()
|
|
|
+ }
|
|
|
+ if (unref(userMsgCountList)?.length || unref(userMsgManList)?.length) {
|
|
|
+ initRoomMsgChart()
|
|
|
}
|
|
|
}
|
|
|
+// const initOnlineChart = () => {
|
|
|
+// const chart1 = document.getElementById('chart-1')
|
|
|
+// const data = unref(onelineTimeCount)
|
|
|
+// const xAxis = data.map(i => i.dataKey)
|
|
|
+// const yAxis = data.map(i => i.dataCount)
|
|
|
+// const max = Math.max.apply(Math, yAxis) + 200
|
|
|
+// const min =
|
|
|
+// Math.min.apply(Math, yAxis) === 0 ? 0 : Math.min.apply(Math, yAxis)
|
|
|
+// if (chart1) {
|
|
|
+// if (!onlineTimeChart) {
|
|
|
+// onlineTimeChart = echarts.init(chart1)
|
|
|
+// }
|
|
|
+
|
|
|
+// // 绘制图表
|
|
|
+// onlineTimeChart.setOption({
|
|
|
+// tooltip: {
|
|
|
+// trigger: 'axis',
|
|
|
+// axisPointer: {
|
|
|
+// lineStyle: {
|
|
|
+// width: 1,
|
|
|
+// color: '#019680'
|
|
|
+// }
|
|
|
+// }
|
|
|
+// },
|
|
|
+// grid: {
|
|
|
+// left: '2%',
|
|
|
+// right: '2%',
|
|
|
+// top: '2%',
|
|
|
+// bottom: '10%',
|
|
|
+// containLabel: true
|
|
|
+// },
|
|
|
+// legend: {
|
|
|
+// orient: 'horizontal',
|
|
|
+// bottom: 0
|
|
|
+// },
|
|
|
+// xAxis: {
|
|
|
+// data: xAxis
|
|
|
+// },
|
|
|
+// yAxis: {
|
|
|
+// min: min,
|
|
|
+// max: max
|
|
|
+// },
|
|
|
+// series: [
|
|
|
+// {
|
|
|
+// name: t('statistic.aofubt'),
|
|
|
+// type: 'line',
|
|
|
+// smooth: true,
|
|
|
+// data: yAxis
|
|
|
+// }
|
|
|
+// ]
|
|
|
+// })
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
const initRoomVisitChart = () => {
|
|
|
const chart = document.getElementById('chart-2')
|
|
@@ -472,25 +478,23 @@ watch(
|
|
|
)
|
|
|
onMounted(async () => {
|
|
|
watchEffect(() => {
|
|
|
- if (unref(onelineTimeCount)?.length) {
|
|
|
- initOnlineChart()
|
|
|
- }
|
|
|
- if (unref(userVisitList)?.length || unref(userShareList)?.length) {
|
|
|
- initRoomVisitChart()
|
|
|
- }
|
|
|
- if (unref(userMsgCountList)?.length || unref(userMsgManList)?.length) {
|
|
|
- initRoomMsgChart()
|
|
|
- }
|
|
|
+ // if (unref(onelineTimeCount)?.length) {
|
|
|
+ // initOnlineChart()
|
|
|
+ // }
|
|
|
})
|
|
|
|
|
|
window.onresize = function () {
|
|
|
//自适应大小
|
|
|
- onlineTimeChart && onlineTimeChart.resize()
|
|
|
- roomUseVisitChart && roomUseVisitChart.resize()
|
|
|
- roomMsgChart && roomMsgChart.resize()
|
|
|
+ handleResize()
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+const handleResize = () => {
|
|
|
+ onlineTimeChart && onlineTimeChart.resize()
|
|
|
+ roomUseVisitChart && roomUseVisitChart.resize()
|
|
|
+ roomMsgChart && roomMsgChart.resize()
|
|
|
+}
|
|
|
+
|
|
|
const handleFinish = async () => {
|
|
|
await statisticStore.fetchRoomVisitChart({
|
|
|
timeList: formState.userTime
|