feat: 完善仪表盘热门模块区块内容
1.完善仪表盘热门模块区块内容 2.sys_log 表增加 module 字段索引 3.优化总计区块图标
@ -16,8 +16,11 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseMapper;
|
||||
import top.charles7c.cnadmin.monitor.model.entity.LogDO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
|
||||
/**
|
||||
@ -31,7 +34,14 @@ public interface LogMapper extends BaseMapper<LogDO> {
|
||||
/**
|
||||
* 查询仪表盘总计信息
|
||||
*
|
||||
* @return 总计信息
|
||||
* @return 仪表盘总计信息
|
||||
*/
|
||||
DashboardTotalVO selectDashboardTotal();
|
||||
|
||||
/**
|
||||
* 查询仪表盘热门模块列表
|
||||
*
|
||||
* @return 仪表盘热门模块列表
|
||||
*/
|
||||
List<DashboardPopularModuleVO> selectListDashboardPopularModule();
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* 仪表盘-热门模块信息
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2023/9/9 9:52
|
||||
*/
|
||||
@Data
|
||||
public class DashboardPopularModuleVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 模块
|
||||
*/
|
||||
@Schema(description = "模块", example = "角色管理")
|
||||
private String module;
|
||||
|
||||
/**
|
||||
* 浏览量(PV)
|
||||
*/
|
||||
@Schema(description = "浏览量(PV)", example = "1234")
|
||||
private Long pvCount;
|
||||
|
||||
/**
|
||||
* 较昨日新增 PV(百分比)
|
||||
*/
|
||||
@Schema(description = "较昨日新增(百分比)", example = "23.4")
|
||||
private BigDecimal newPvFromYesterday;
|
||||
|
||||
/**
|
||||
* 今日浏览量(PV)
|
||||
*/
|
||||
@JsonIgnore
|
||||
private Long todayPvCount;
|
||||
|
||||
/**
|
||||
* 昨日浏览量(PV)
|
||||
*/
|
||||
@JsonIgnore
|
||||
private Long yesterdayPvCount;
|
||||
}
|
@ -26,7 +26,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
/**
|
||||
* 仪表盘总计信息
|
||||
* 仪表盘-总计信息
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2023/9/8 21:32
|
||||
@ -51,7 +51,7 @@ public class DashboardTotalVO implements Serializable {
|
||||
/**
|
||||
* 今日浏览量(PV)
|
||||
*/
|
||||
@Schema(description = "今日浏览量", example = "1234")
|
||||
@Schema(description = "今日浏览量(PV)", example = "1234")
|
||||
private Long todayPvCount;
|
||||
|
||||
/**
|
||||
|
@ -18,6 +18,7 @@ package top.charles7c.cnadmin.monitor.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
import top.charles7c.cnadmin.system.model.vo.DashboardAnnouncementVO;
|
||||
|
||||
@ -36,6 +37,13 @@ public interface DashboardService {
|
||||
*/
|
||||
DashboardTotalVO getTotal();
|
||||
|
||||
/**
|
||||
* 查询热门模块列表
|
||||
*
|
||||
* @return 热门模块列表
|
||||
*/
|
||||
List<DashboardPopularModuleVO> listPopularModule();
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
package top.charles7c.cnadmin.monitor.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import top.charles7c.cnadmin.common.model.query.PageQuery;
|
||||
import top.charles7c.cnadmin.common.model.vo.PageDataVO;
|
||||
import top.charles7c.cnadmin.monitor.model.query.LoginLogQuery;
|
||||
@ -79,4 +81,11 @@ public interface LogService {
|
||||
* @return 仪表盘总计信息
|
||||
*/
|
||||
DashboardTotalVO getDashboardTotal();
|
||||
|
||||
/**
|
||||
* 查询仪表盘热门模块列表
|
||||
*
|
||||
* @return 仪表盘热门模块列表
|
||||
*/
|
||||
List<DashboardPopularModuleVO> listPopularModule();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
import top.charles7c.cnadmin.monitor.service.DashboardService;
|
||||
import top.charles7c.cnadmin.monitor.service.LogService;
|
||||
@ -58,6 +59,20 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
return totalVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardPopularModuleVO> listPopularModule() {
|
||||
List<DashboardPopularModuleVO> popularModuleList = logService.listPopularModule();
|
||||
for (DashboardPopularModuleVO popularModule : popularModuleList) {
|
||||
Long todayPvCount = popularModule.getTodayPvCount();
|
||||
Long yesterdayPvCount = popularModule.getYesterdayPvCount();
|
||||
BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount);
|
||||
BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100)
|
||||
: NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1);
|
||||
popularModule.setNewPvFromYesterday(newPvFromYesterday);
|
||||
}
|
||||
return popularModuleList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardAnnouncementVO> listAnnouncement() {
|
||||
return announcementService.listDashboard();
|
||||
|
@ -150,6 +150,11 @@ public class LogServiceImpl implements LogService {
|
||||
return logMapper.selectDashboardTotal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardPopularModuleVO> listPopularModule() {
|
||||
return logMapper.selectListDashboardPopularModule();
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据
|
||||
*
|
||||
|
@ -8,4 +8,18 @@
|
||||
(SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = CURDATE()) AS todayPvCount,
|
||||
(SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS yesterdayPvCount
|
||||
</select>
|
||||
|
||||
<select id="selectListDashboardPopularModule"
|
||||
resultType="top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO">
|
||||
SELECT
|
||||
`module`,
|
||||
COUNT(*) AS pvCount,
|
||||
SUM(CASE WHEN DATE(`create_time`) = CURDATE() THEN 1 ELSE 0 END) AS todayPvCount,
|
||||
SUM(CASE WHEN DATE(`create_time`) = DATE_SUB(CURDATE(), INTERVAL 1 DAY) THEN 1 ELSE 0 END) AS yesterdayPvCount
|
||||
FROM `sys_log`
|
||||
GROUP BY `module`
|
||||
HAVING `module` != '验证码' AND `module` != '登录'
|
||||
ORDER BY `pvCount` DESC
|
||||
LIMIT 10
|
||||
</select>
|
||||
</mapper>
|
@ -33,7 +33,7 @@ public interface AnnouncementMapper extends BaseMapper<AnnouncementDO> {
|
||||
/**
|
||||
* 查询仪表盘公告列表
|
||||
*
|
||||
* @return 公告列表
|
||||
* @return 仪表盘公告列表
|
||||
*/
|
||||
List<DashboardAnnouncementVO> selectDashboardList();
|
||||
}
|
@ -25,7 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum;
|
||||
|
||||
/**
|
||||
* 仪表盘公告信息
|
||||
* 仪表盘-公告信息
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2023/8/20 10:55
|
||||
|
@ -37,7 +37,7 @@ public interface AnnouncementService
|
||||
/**
|
||||
* 查询仪表盘公告列表
|
||||
*
|
||||
* @return 公告列表
|
||||
* @return 仪表盘公告列表
|
||||
*/
|
||||
List<DashboardAnnouncementVO> listDashboard();
|
||||
}
|
@ -10,6 +10,12 @@ export interface DashboardTotalRecord {
|
||||
newPvFromYesterday: number;
|
||||
}
|
||||
|
||||
export interface DashboardPopularModuleRecord {
|
||||
module: string;
|
||||
pvCount: number;
|
||||
newPvFromYesterday: number;
|
||||
}
|
||||
|
||||
export interface DashboardAnnouncementRecord {
|
||||
id: string;
|
||||
title: string;
|
||||
@ -20,6 +26,12 @@ export function getTotal() {
|
||||
return axios.get<DashboardTotalRecord>(`${BASE_URL}/total`);
|
||||
}
|
||||
|
||||
export function listPopularModule() {
|
||||
return axios.get<DashboardPopularModuleRecord[]>(
|
||||
`${BASE_URL}/popular/module`
|
||||
);
|
||||
}
|
||||
|
||||
export function listAnnouncement() {
|
||||
return axios.get<DashboardAnnouncementRecord[]>(`${BASE_URL}/announcement`);
|
||||
}
|
||||
|
BIN
continew-admin-ui/src/assets/icons/png/data.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
continew-admin-ui/src/assets/icons/png/hot.png
Normal file
After Width: | Height: | Size: 8.8 KiB |
BIN
continew-admin-ui/src/assets/icons/png/popularity.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
continew-admin-ui/src/assets/icons/png/same-city.png
Normal file
After Width: | Height: | Size: 13 KiB |
@ -1 +0,0 @@
|
||||
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><path d="M18 36C8.06 36 0 27.94 0 18S8.06 0 18 0s18 8.06 18 18-8.06 18-18 18z" fill="url(#svg_0d83078816__paint0_linear_0:672)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10 11a1 1 0 00-1 1v13a1 1 0 001 1h16a1 1 0 001-1V12a1 1 0 00-1-1H10zm2.229 8.66a.2.2 0 01.038-.281l4.074-3.063a.2.2 0 01.25.007l2.357 1.99a.2.2 0 00.253.006l3.252-2.54a.2.2 0 01.277.03l.994 1.194a.2.2 0 01-.029.285l-4.497 3.57a.2.2 0 01-.25 0l-2.438-1.979a.2.2 0 00-.245-.005l-2.807 2.066a.2.2 0 01-.277-.039l-.952-1.24z" fill="#fff"/><defs><linearGradient id="svg_0d83078816__paint0_linear_0:672" x1="-6.786" y1="21.575" x2="20.433" y2="43.68" gradientUnits="userSpaceOnUse"><stop stop-color="#599AFF"/><stop offset="1" stop-color="#3D89FF"/></linearGradient></defs></svg>
|
Before Width: | Height: | Size: 812 B |
@ -1 +0,0 @@
|
||||
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><circle cx="18" cy="18" r="18" fill="url(#svg_2b62ab03ed__paint0_linear_0:735)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.677 8.55c.073.666-.154 1.497-.547 2.526-.981 2.573-5.63 3.229-5.63 9.993 0 .36.049.676.126.964.362 3.35 3.404 5.967 7.101 5.967 3.943 0 7.39-3.426 7.704-7 .223-2.54.003-4.697-2.106-6.561l-.432.203a3.888 3.888 0 01-.448 1.743 3.58 3.58 0 01-.26.408c-.025.037-.05.073-.079.108a3.773 3.773 0 01-.277.312c-.04.04-.078.082-.121.122-.098.09-.201.176-.308.257-.035.026-.074.051-.11.077-.096.067-.193.13-.293.19l-.128.075c-.146.08-.298.158-.465.23.091-.177.172-.362.247-.552.02-.05.036-.101.055-.152.056-.153.106-.308.15-.465l.039-.145c.051-.2.095-.404.127-.614l.003-.012a7.227 7.227 0 00-.054-2.423c-.345-1.79-1.425-3.791-3.448-5.678l-.846.427z" fill="#fff"/><ellipse cx="17.188" cy="8.5" rx=".512" ry=".5" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M23.373 14.515a.25.25 0 10-.457.204l.457-.204z" fill="#fff"/><circle cx="18" cy="18" r="18" fill="url(#svg_2b62ab03ed__paint1_linear_0:735)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M22.216 12.662c2.09 1.93 3.284 4.69 3.284 7.586C25.5 24.53 22.142 28 18 28c-4.142 0-7.5-3.47-7.5-7.752 0-5.768 6.427-7.844 6.427-12.248.191.048.38.108.563.18 2.421.95 3.773 5.44 2.854 7.942a4.395 4.395 0 001.872-3.46z" fill="#fff"/><defs><linearGradient id="svg_2b62ab03ed__paint0_linear_0:735" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient><linearGradient id="svg_2b62ab03ed__paint1_linear_0:735" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient></defs></svg>
|
Before Width: | Height: | Size: 1.8 KiB |
@ -1 +0,0 @@
|
||||
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><circle cx="18" cy="18" r="18" fill="url(#svg_60fdab9bf6__paint0_linear_0:667)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.677 8.55c.073.665-.154 1.497-.547 2.526-.981 2.573-5.63 3.229-5.63 9.993 0 .36.049.676.126.964.362 3.35 3.404 5.967 7.101 5.967 3.943 0 7.39-3.426 7.704-7 .223-2.54.003-4.697-2.106-6.561l-.432.203a3.888 3.888 0 01-.448 1.743 3.588 3.588 0 01-.26.408c-.025.037-.05.073-.079.108a3.773 3.773 0 01-.277.312c-.04.04-.078.082-.121.122-.098.09-.201.176-.308.257-.035.026-.074.051-.11.077a4.45 4.45 0 01-.421.265c-.146.08-.298.158-.465.23.091-.177.172-.362.247-.552.02-.05.036-.101.055-.152.056-.153.106-.308.15-.465l.039-.145c.051-.2.095-.404.127-.614l.003-.012a7.227 7.227 0 00-.054-2.423c-.345-1.79-1.425-3.791-3.448-5.678l-.846.427z" fill="#fff"/><ellipse cx="17.188" cy="8.5" rx=".512" ry=".5" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M23.373 14.515a.25.25 0 10-.457.204l.457-.204z" fill="#fff"/><circle cx="18" cy="18" r="18" fill="url(#svg_60fdab9bf6__paint1_linear_0:667)"/><rect x="8.5" y="17.5" width="4" height="9" rx="1" fill="#fff"/><rect x="16" y="9.5" width="4" height="17" rx="1" fill="#fff"/><rect x="23.5" y="13.5" width="4" height="13" rx="1" fill="#fff"/><defs><linearGradient id="svg_60fdab9bf6__paint0_linear_0:667" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient><linearGradient id="svg_60fdab9bf6__paint1_linear_0:667" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient></defs></svg>
|
Before Width: | Height: | Size: 1.7 KiB |
@ -1 +0,0 @@
|
||||
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><circle cx="18" cy="18" r="18" fill="url(#svg_1300b2c8f8__paint0_linear_0:785)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M21.792 13.04c0 1.401-.546 2.67-1.428 3.583.445.087.884.199 1.313.334-.88 1.037-1.415 2.424-1.415 4.008 0 1.349 1.036 3.022 2.298 4.56-1.394.255-3.267.475-5.582.475-4.39 0-7.19-.791-8.148-1.113a.472.472 0 01-.318-.525c.198-1.3 1.078-5.483 4.337-6.887.393-.17.789-.318 1.185-.447a5.118 5.118 0 01-1.87-3.988c0-2.783 2.155-5.04 4.814-5.04 2.659 0 4.814 2.257 4.814 5.04z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M25.496 25.818C24.42 24.902 22 22.642 22 20.846 22 18.538 23.6 17 26 17s4 1.923 4 3.846c0 1.506-2.452 3.955-3.517 4.947a.739.739 0 01-.987.025zm.508-3.345c.828 0 1.5-.688 1.5-1.538 0-.85-.672-1.538-1.5-1.538s-1.5.688-1.5 1.538c0 .85.672 1.539 1.5 1.539z" fill="#fff"/><defs><linearGradient id="svg_1300b2c8f8__paint0_linear_0:785" x1="-6.027" y1="16.545" x2="17.227" y2="42.116" gradientUnits="userSpaceOnUse"><stop stop-color="#5ED1D1"/><stop offset="1" stop-color="#39C4C4"/></linearGradient></defs></svg>
|
Before Width: | Height: | Size: 1.1 KiB |
@ -5,8 +5,8 @@
|
||||
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
|
||||
>
|
||||
<a-space>
|
||||
<a-avatar :size="54" class="col-avatar">
|
||||
<svg-icon icon-class="popularity" />
|
||||
<a-avatar :size="50" class="col-avatar">
|
||||
<img :src="PvCountIcon" alt="PvCountIcon" />
|
||||
</a-avatar>
|
||||
<a-statistic
|
||||
:title="$t('workplace.pvCount')"
|
||||
@ -26,8 +26,8 @@
|
||||
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
|
||||
>
|
||||
<a-space>
|
||||
<a-avatar :size="54" class="col-avatar">
|
||||
<svg-icon icon-class="same-city" />
|
||||
<a-avatar :size="50" class="col-avatar">
|
||||
<img :src="IpCountIcon" alt="IpCountIcon" />
|
||||
</a-avatar>
|
||||
<a-statistic
|
||||
:title="$t('workplace.ipCount')"
|
||||
@ -47,8 +47,8 @@
|
||||
:span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }"
|
||||
>
|
||||
<a-space>
|
||||
<a-avatar :size="54" class="col-avatar">
|
||||
<svg-icon icon-class="hot" />
|
||||
<a-avatar :size="50" class="col-avatar">
|
||||
<img :src="TodayPvCountIcon" alt="TodayPvCountIcon" />
|
||||
</a-avatar>
|
||||
<a-statistic
|
||||
:title="$t('workplace.todayPvCount')"
|
||||
@ -69,8 +69,8 @@
|
||||
style="border-right: none"
|
||||
>
|
||||
<a-space>
|
||||
<a-avatar :size="54" class="col-avatar">
|
||||
<svg-icon icon-class="data" />
|
||||
<a-avatar :size="50" class="col-avatar">
|
||||
<img :src="NewPvFromYesterdayIcon" alt="NewPvFromYesterdayIcon" />
|
||||
</a-avatar>
|
||||
<a-statistic
|
||||
:title="$t('workplace.newPvFromYesterday')"
|
||||
@ -102,6 +102,10 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { DashboardTotalRecord, getTotal } from '@/api/common/dashboard';
|
||||
import PvCountIcon from '@/assets/icons/png/popularity.png';
|
||||
import IpCountIcon from '@/assets/icons/png/same-city.png';
|
||||
import TodayPvCountIcon from '@/assets/icons/png/hot.png';
|
||||
import NewPvFromYesterdayIcon from '@/assets/icons/png/data.png';
|
||||
|
||||
const totalData = ref<DashboardTotalRecord>({
|
||||
pvCount: 0,
|
||||
|
@ -6,61 +6,50 @@
|
||||
:body-style="{ padding: '17px 20px 21px 20px' }"
|
||||
>
|
||||
<template #title>
|
||||
{{ $t('workplace.popularContent') }}
|
||||
</template>
|
||||
<template #extra>
|
||||
<a-link>{{ $t('workplace.viewMore') }}</a-link>
|
||||
{{ $t('workplace.popularModule') }}
|
||||
</template>
|
||||
<a-space direction="vertical" :size="10" fill>
|
||||
<a-radio-group
|
||||
v-model:model-value="type"
|
||||
type="button"
|
||||
@change="typeChange as any"
|
||||
>
|
||||
<a-radio value="text">
|
||||
{{ $t('workplace.popularContent.text') }}
|
||||
</a-radio>
|
||||
<a-radio value="image">
|
||||
{{ $t('workplace.popularContent.image') }}
|
||||
</a-radio>
|
||||
<a-radio value="video">
|
||||
{{ $t('workplace.popularContent.video') }}
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
<a-table
|
||||
:data="renderList"
|
||||
:data="dataList"
|
||||
:pagination="false"
|
||||
:bordered="false"
|
||||
:scroll="{ x: '100%', y: '264px' }"
|
||||
:scroll="{ x: '100%', y: '310px' }"
|
||||
>
|
||||
<template #columns>
|
||||
<a-table-column title="排名" data-index="key"></a-table-column>
|
||||
<a-table-column title="内容标题" data-index="title">
|
||||
<a-table-column title="排名">
|
||||
<template #cell="{ rowIndex }">
|
||||
{{ rowIndex + 1 }}
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="模块" data-index="module">
|
||||
<template #cell="{ record }">
|
||||
<a-typography-paragraph
|
||||
:ellipsis="{
|
||||
rows: 1,
|
||||
}"
|
||||
>
|
||||
{{ record.title }}
|
||||
{{ record.module }}
|
||||
</a-typography-paragraph>
|
||||
</template>
|
||||
</a-table-column>
|
||||
<a-table-column title="点击量" data-index="clickNumber">
|
||||
</a-table-column>
|
||||
<a-table-column title="总浏览量" data-index="pvCount" />
|
||||
<a-table-column
|
||||
title="日涨幅"
|
||||
data-index="increases"
|
||||
data-index="newPvFromYesterday"
|
||||
:sortable="{
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
}"
|
||||
>
|
||||
<template #cell="{ record }">
|
||||
<div class="increases-cell">
|
||||
<span>{{ record.increases }}%</span>
|
||||
<span>{{ record.newPvFromYesterday }}%</span>
|
||||
<icon-caret-up
|
||||
v-if="record.increases !== 0"
|
||||
style="color: #f53f3f; font-size: 8px"
|
||||
v-if="record.newPvFromYesterday > 0"
|
||||
style="color: rgb(var(--red-6)); font-size: 8px"
|
||||
/>
|
||||
<icon-caret-down
|
||||
v-if="record.newPvFromYesterday < 0"
|
||||
style="color: rgb(var(--green-6)); font-size: 8px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -75,27 +64,27 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import useLoading from '@/hooks/loading';
|
||||
import { queryPopularList } from '@/api/common/dashboard';
|
||||
import { listPopularModule } from '@/api/common/dashboard';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
|
||||
const type = ref('text');
|
||||
const { loading, setLoading } = useLoading();
|
||||
const renderList = ref<TableData[]>();
|
||||
const fetchData = async (contentType: string) => {
|
||||
const dataList = ref<TableData[]>();
|
||||
|
||||
/**
|
||||
* 查询热门模块列表
|
||||
*/
|
||||
const getList = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data } = await queryPopularList({ type: contentType });
|
||||
renderList.value = data;
|
||||
const { data } = await listPopularModule();
|
||||
dataList.value = data;
|
||||
} catch (err) {
|
||||
// you can report use errorHandler or other
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
const typeChange = (contentType: string) => {
|
||||
fetchData(contentType);
|
||||
};
|
||||
fetchData('text');
|
||||
getList();
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
@ -10,7 +10,7 @@
|
||||
<a-grid-item
|
||||
:span="{ xs: 24, sm: 24, md: 24, lg: 12, xl: 12, xxl: 12 }"
|
||||
>
|
||||
<PopularContent />
|
||||
<PopularModule />
|
||||
</a-grid-item>
|
||||
<a-grid-item
|
||||
:span="{ xs: 24, sm: 24, md: 24, lg: 12, xl: 12, xxl: 12 }"
|
||||
@ -45,7 +45,7 @@
|
||||
import Banner from './components/banner.vue';
|
||||
import DataPanel from './components/data-panel.vue';
|
||||
import ContentChart from './components/content-chart.vue';
|
||||
import PopularContent from './components/popular-content.vue';
|
||||
import PopularModule from './components/popular-module.vue';
|
||||
import CategoriesPercent from './components/categories-percent.vue';
|
||||
import RecentlyVisited from './components/recently-visited.vue';
|
||||
import QuickOperation from './components/quick-operation.vue';
|
||||
|
@ -23,10 +23,7 @@ export default {
|
||||
'workplace.loadMore': 'More',
|
||||
'workplace.viewMore': 'More',
|
||||
'workplace.contentData': 'Content Data',
|
||||
'workplace.popularContent': 'Popular Content',
|
||||
'workplace.popularContent.text': 'text',
|
||||
'workplace.popularContent.image': 'image',
|
||||
'workplace.popularContent.video': 'video',
|
||||
'workplace.popularModule': 'Popular Module',
|
||||
'workplace.categoriesPercent': 'Categories Percent',
|
||||
'workplace.unit.pecs': 'pecs',
|
||||
'workplace.unit.times': 'times',
|
||||
|
@ -23,10 +23,7 @@ export default {
|
||||
'workplace.loadMore': '加载更多',
|
||||
'workplace.viewMore': '查看更多',
|
||||
'workplace.contentData': '内容数据',
|
||||
'workplace.popularContent': '线上热门内容',
|
||||
'workplace.popularContent.text': '文本',
|
||||
'workplace.popularContent.image': '图片',
|
||||
'workplace.popularContent.video': '视频',
|
||||
'workplace.popularModule': '热门模块',
|
||||
'workplace.categoriesPercent': '内容类型占比',
|
||||
'workplace.unit.pecs': '个',
|
||||
'workplace.unit.times': '次',
|
||||
|
@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import top.charles7c.cnadmin.common.model.vo.R;
|
||||
import top.charles7c.cnadmin.monitor.annotation.Log;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
import top.charles7c.cnadmin.monitor.service.DashboardService;
|
||||
import top.charles7c.cnadmin.system.model.vo.DashboardAnnouncementVO;
|
||||
@ -56,6 +57,12 @@ public class DashboardController {
|
||||
return R.ok(dashboardService.getTotal());
|
||||
}
|
||||
|
||||
@Operation(summary = "查询热门模块列表", description = "查询热门模块列表")
|
||||
@GetMapping("/popular/module")
|
||||
public R<List<DashboardPopularModuleVO>> listPopularModule() {
|
||||
return R.ok(dashboardService.listPopularModule());
|
||||
}
|
||||
|
||||
@Operation(summary = "查询公告列表", description = "查询公告列表")
|
||||
@GetMapping("/announcement")
|
||||
public R<List<DashboardAnnouncementVO>> listAnnouncement() {
|
||||
|
@ -133,6 +133,7 @@ CREATE TABLE IF NOT EXISTS `sys_log` (
|
||||
`create_user` bigint(20) UNSIGNED DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_module`(`module`) USING BTREE,
|
||||
INDEX `idx_client_ip`(`client_ip`) USING BTREE,
|
||||
INDEX `idx_create_time`(`create_time`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统日志表';
|
||||
|