gemercheung 2 years ago
parent
commit
ba30eb9204
3 changed files with 30 additions and 15 deletions
  1. 0 2
      src/components.d.ts
  2. 25 12
      src/views/statistic/tab/tab1.vue
  3. 5 1
      src/views/statistic/tab/tab3.vue

+ 0 - 2
src/components.d.ts

@@ -10,7 +10,6 @@ declare module '@vue/runtime-core' {
     AAvatar: typeof import('ant-design-vue/es')['Avatar']
     AButton: typeof import('ant-design-vue/es')['Button']
     ACard: typeof import('ant-design-vue/es')['Card']
-    ACheckboxGroup: typeof import('ant-design-vue/es')['CheckboxGroup']
     ACol: typeof import('ant-design-vue/es')['Col']
     AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
     ADropdown: typeof import('ant-design-vue/es')['Dropdown']
@@ -30,7 +29,6 @@ declare module '@vue/runtime-core' {
     AppstoreOutlined: typeof import('@ant-design/icons-vue')['AppstoreOutlined']
     ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
     ARow: typeof import('ant-design-vue/es')['Row']
-    ASelect: typeof import('ant-design-vue/es')['Select']
     ATable: typeof import('ant-design-vue/es')['Table']
     ATabPane: typeof import('ant-design-vue/es')['TabPane']
     ATabs: typeof import('ant-design-vue/es')['Tabs']

+ 25 - 12
src/views/statistic/tab/tab1.vue

@@ -184,6 +184,13 @@ const initOnlineChart = () => {
           }
         }
       },
+      grid: {
+        left: '2%',
+        right: '2%',
+        top: '2%',
+        bottom: '10%',
+        containLabel: true
+      },
       legend: {
         orient: 'horizontal',
         bottom: 0
@@ -197,7 +204,7 @@ const initOnlineChart = () => {
       },
       series: [
         {
-          name: '人数',
+          name: '各时段在线人数',
           type: 'line',
           smooth: true,
           data: yAxis
@@ -214,6 +221,8 @@ const initRoomVisitChart = () => {
   const ch1X = ch1.map(i => i.dataKey)
   const ch1Y = ch1.map(i => i.dataCount)
   const ch2X = ch2.map(i => i.dataKey)
+
+  const allX = Array.from(new Set(ch1X.concat(ch2X)));
   const ch2Y = ch2.map(i => i.dataCount)
   const ch1Max = Math.max.apply(Math, ch1Y) + 200
   const ch1Min =
@@ -240,7 +249,8 @@ const initRoomVisitChart = () => {
       },
       xAxis: {
         type: 'category',
-        data: ch1X,
+        data: allX,
+
         splitLine: {
           show: true,
           lineStyle: {
@@ -256,7 +266,8 @@ const initRoomVisitChart = () => {
       yAxis: [
         {
           type: 'value',
-          max: ch2X,
+          min: ch1Min,
+          max: ch1Max,
           splitNumber: 4,
           axisTick: {
             show: false
@@ -280,7 +291,7 @@ const initRoomVisitChart = () => {
         {
           smooth: true,
           data: ch1Y,
-          type: 'line',
+          type: 'bar',
           areaStyle: {},
           name: '用户浏览量',
           itemStyle: {
@@ -290,7 +301,7 @@ const initRoomVisitChart = () => {
         {
           smooth: true,
           data: ch2Y,
-          type: 'line',
+          type: 'bar',
           name: '用户分享数',
           areaStyle: {},
           itemStyle: {
@@ -310,7 +321,8 @@ const initRoomMsgChart = () => {
   const ch1Y = ch1.map(i => i.dataCount)
   const ch2X = ch2.map(i => i.dataKey)
   const ch2Y = ch2.map(i => i.dataCount)
-  const ch1Max = Math.max.apply(Math, ch1Y) + 200
+  const allX = Array.from(new Set(ch1X.concat(ch2X)));
+  const ch1Max = Math.max.apply(Math, ch1Y) + 100
   const ch1Min =
     Math.min.apply(Math, ch1Y) === 0 ? 0 : Math.min.apply(Math, ch1Y)
 
@@ -335,7 +347,7 @@ const initRoomMsgChart = () => {
       },
       xAxis: {
         type: 'category',
-        data: ch1X,
+        data: allX,
         splitLine: {
           show: true,
           lineStyle: {
@@ -351,7 +363,8 @@ const initRoomMsgChart = () => {
       yAxis: [
         {
           type: 'value',
-          max: ch2X,
+          min: ch1Min,
+          max: ch1Max,
           splitNumber: 4,
           axisTick: {
             show: false
@@ -375,9 +388,9 @@ const initRoomMsgChart = () => {
         {
           smooth: true,
           data: ch1Y,
-          type: 'bar',
+          type: 'line',
           areaStyle: {},
-          name: '用户留言数',
+          name: '留言数',
           itemStyle: {
             color: '#5ab1ef'
           }
@@ -385,8 +398,8 @@ const initRoomMsgChart = () => {
         {
           smooth: true,
           data: ch2Y,
-          type: 'bar',
-          name: '用户留言数',
+          type: 'line',
+          name: '留言数',
           areaStyle: {},
           itemStyle: {
             color: '#019680'

+ 5 - 1
src/views/statistic/tab/tab3.vue

@@ -48,7 +48,11 @@
               {{ dayjs(text).format('YYYY-MM-DD HH:mm') }}
             </template>
             <template v-if="column.dataIndex === 'texts'">
-              {{ text.join(';') }}
+              {{
+                text.join(';').length > 200
+                  ? text.join(';').substr(0, 200) + '...'
+                  : text.join(';')
+              }}
             </template>
           </template>
         </a-table>