feat: 本次提交更新内容如下

首页构建完成
This commit is contained in:
笔记本里的永平
2025-07-18 22:41:41 +08:00
parent 77148dff3a
commit 0532c3c161
2 changed files with 60 additions and 44 deletions

View File

@@ -1,7 +1,6 @@
.home-page {
padding: 12px;
background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
min-height: 100vh;
}
// 导航栏样式

View File

@@ -1,61 +1,75 @@
import React, { useEffect, useState } from "react";
import { Card, NavBar, TabBar, Grid } from "antd-mobile";
import { NavBar } from "antd-mobile";
import {
AppOutline,
UserOutline,
PieOutline,
ShopbagOutline,
FileOutline,
StarOutline,
StopOutline,
TeamOutline,
LoopOutline,
TravelOutline,
ClockCircleOutline,
} from "antd-mobile-icons";
import MeauMobile from "@/components/MeauMobile/MeauMoible";
import Layout from "@/components/Layout/Layout";
import style from "./index.module.scss";
import LineChart from "@/components/LineChart";
import { getPlanStats } from "./api";
const todayStats = [
{
label: "朋友圈",
value: 12,
icon: <FileOutline style={{ fontSize: 16, color: "#ff6b35" }} />,
color: "#ff6b35",
},
{
label: "群发",
value: 8,
icon: <StarOutline style={{ fontSize: 16, color: "#ffd700" }} />,
color: "#ffd700",
},
{
label: "转化率",
value: "85%",
icon: <StopOutline style={{ fontSize: 16, color: "#4caf50" }} />,
color: "#4caf50",
},
{
label: "活跃度",
value: "98%",
icon: <TeamOutline style={{ fontSize: 16, color: "#2196f3" }} />,
color: "#2196f3",
},
];
import {
getPlanStats,
getSevenDayStats,
getTodayStats,
getDashboard,
} from "./api";
const Home: React.FC = () => {
const [sceneStats, setSceneStats] = useState<any[]>([]);
const [todayStats, setTodayStats] = useState<any[]>([]);
const [dashboard, setDashboard] = useState<any>({});
const [sevenDayStats, setSevenDayStats] = useState<any>({});
useEffect(() => {
getDashboard().then((res: any) => {
setDashboard(res);
});
getPlanStats({ num: 4 }).then((res: any) => {
// console.log(res);
setSceneStats(res);
});
getSevenDayStats().then((res: any) => {
setSevenDayStats(res);
});
getTodayStats().then((res: any) => {
const todayStatsData = [
{
label: "朋友圈",
value: res.momentsNum,
icon: <LoopOutline style={{ fontSize: 16, color: "#ff6b35" }} />,
color: "#ff6b35",
},
{
label: "群发",
value: res.groupPushNum,
icon: <TravelOutline style={{ fontSize: 16, color: "#ffd700" }} />,
color: "#ffd700",
},
{
label: "转化率",
value: res.passRate,
icon: <LoopOutline style={{ fontSize: 16, color: "#4caf50" }} />,
color: "#4caf50",
},
{
label: "活跃度",
value: res.sysActive,
icon: (
<ClockCircleOutline style={{ fontSize: 16, color: "#2196f3" }} />
),
color: "#2196f3",
},
];
setTodayStats(todayStatsData);
});
}, []);
return (
<Layout
header={
<NavBar back={null} style={{ background: "transparent" }}>
<NavBar back={null} style={{ background: "#fff" }}>
<div className={style["nav-title"]}>
<span className={style["nav-text"]}></span>
</div>
@@ -73,8 +87,9 @@ const Home: React.FC = () => {
/>
</div>
<div className={style["stat-content"]}>
<div className={style["stat-value"]}>0</div>
<div className={style["stat-label"]}></div>
<div className={style["stat-value"]}>{dashboard.deviceNum}</div>
</div>
</div>
<div className={style["stat-card"]}>
@@ -84,19 +99,21 @@ const Home: React.FC = () => {
/>
</div>
<div className={style["stat-content"]}>
<div className={style["stat-value"]}>0</div>
<div className={style["stat-label"]}></div>
<div className={style["stat-value"]}>{dashboard.wechatNum}</div>
</div>
</div>
<div className={style["stat-card"]}>
<div className={style["stat-icon"]}>
<TeamOutline
<ClockCircleOutline
style={{ fontSize: 18, color: "var(--primary-color)" }}
/>
</div>
<div className={style["stat-content"]}>
<div className={style["stat-value"]}>0</div>
<div className={style["stat-label"]}>线</div>
<div className={style["stat-value"]}>
{dashboard.aliveWechatNum}
</div>
</div>
</div>
</div>
@@ -151,8 +168,8 @@ const Home: React.FC = () => {
</div>
<div className={style["chart-container"]}>
<LineChart
xData={["周一", "周二", "周三", "周四", "周五", "周六", "周日"]}
yData={[120, 150, 180, 200, 230, 210, 190]}
xData={sevenDayStats.date}
yData={sevenDayStats.allNum}
/>
</div>
</div>