Browse Source

(*)热点数据功能完善

master
peng.peng 1 year ago
parent
commit
fc0af604be
  1. 2
      api/app/lib/controllers/homepage/index.js
  2. 6
      web/client/src/sections/homePage/components/hotspotData.js
  3. 2
      web/client/src/sections/homePage/components/style.less
  4. 4
      web/client/src/sections/homePage/nav-item.js

2
api/app/lib/controllers/homepage/index.js

@ -221,7 +221,7 @@ function getAccessData(opts) {
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = { message: '获取预警列表失败' }
ctx.body = { message: '获取接入数据统计失败' }
}
}
}

6
web/client/src/sections/homePage/components/hotspotData.js

@ -17,18 +17,18 @@ function HotspotData(props) {
<div className='hotspot_data_container'>
<div className='_img'></div>
<div className='_top1'>
<span className='hotspot_title' title={top3[0].name}>{top3[0].name?.length > 6 ? top3[0].name.substring(0, 6) + '...' : top3[0].name}</span>
<span className='hotspot_title' title={top3[0].name}>{top3[0].name?.length > 8 ? top3[0].name.substring(0, 8) + '...' : top3[0].name}</span>
<div className='hotspot_data_number'>{top3[0].count}</div>
</div>
<div className='_top2'>
{top3?.length > 2 && <>
<span className='hotspot_title' title={top3[2].name}>{top3[2].name?.length > 6 ? top3[2].name.substring(0, 6) + '...' : top3[2].name}</span>
<span className='hotspot_title' title={top3[2].name}>{top3[2].name?.length > 8 ? top3[2].name.substring(0, 8) + '...' : top3[2].name}</span>
<div className='hotspot_data_number'>{top3[2].count}</div>
</>}
</div>
<div className='_top3'>
{top3?.length > 1 && <>
<span className='hotspot_title' title={top3[1].name}>{top3[1].name?.length > 6 ? top3[1].name.substring(0, 6) + '...' : top3[1].name}</span>
<span className='hotspot_title' title={top3[1].name}>{top3[1].name?.length > 8 ? top3[1].name.substring(0, 8) + '...' : top3[1].name}</span>
<div className='hotspot_data_number'>{top3[1].count}</div>
</>}
</div>

2
web/client/src/sections/homePage/components/style.less

@ -199,7 +199,7 @@
._top3 {
position: absolute;
bottom: 34%;
right: 2%;
left: 73%;
}
}

4
web/client/src/sections/homePage/nav-item.js

@ -2,9 +2,9 @@ import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { HomeOutlined } from '@ant-design/icons';
export function getNavItem() {
export function getNavItem({ user }) {
return (
<Menu.Item key="homePage" icon={<HomeOutlined />}>
user?.role == '系统管理员' && <Menu.Item key="homePage" icon={<HomeOutlined />}>
<Link to="/homePage">数据监控平台</Link>
</Menu.Item>
);

Loading…
Cancel
Save