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

样式构建完成
This commit is contained in:
笔记本里的永平
2025-07-22 16:02:16 +08:00
parent 8bb26032bd
commit ac9aae9200
2 changed files with 85 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
# 基础环境变量示例 # 基础环境变量示例
VITE_API_BASE_URL=http://yishi.com VITE_API_BASE_URL=http://www.yishi.com
VITE_APP_TITLE=Nkebao Base VITE_APP_TITLE=Nkebao Base

View File

@@ -1,11 +1,13 @@
import React, { useEffect, useRef, useState, useCallback } from "react"; import React, { useEffect, useRef, useState, useCallback } from "react";
import { NavBar, Popup, Tabs, Toast, SpinLoading, Dialog } from "antd-mobile"; import { NavBar, Popup, Tabs, Toast, SpinLoading, Dialog } from "antd-mobile";
import { Button, Input, Pagination } from "antd"; import { Button, Input, Pagination } from "antd";
import { useNavigate } from "react-router-dom";
import { AddOutline, DeleteOutline } from "antd-mobile-icons"; import { AddOutline, DeleteOutline } from "antd-mobile-icons";
import { import {
ReloadOutlined, ReloadOutlined,
SearchOutlined, SearchOutlined,
QrcodeOutlined, QrcodeOutlined,
ArrowLeftOutlined,
} from "@ant-design/icons"; } from "@ant-design/icons";
import Layout from "@/components/Layout/Layout"; import Layout from "@/components/Layout/Layout";
import MeauMobile from "@/components/MeauMobile/MeauMoible"; import MeauMobile from "@/components/MeauMobile/MeauMoible";
@@ -43,6 +45,7 @@ const Devices: React.FC = () => {
const [delVisible, setDelVisible] = useState(false); const [delVisible, setDelVisible] = useState(false);
const [delLoading, setDelLoading] = useState(false); const [delLoading, setDelLoading] = useState(false);
const navigate = useNavigate();
// 加载设备列表 // 加载设备列表
const loadDevices = useCallback( const loadDevices = useCallback(
async (reset = false) => { async (reset = false) => {
@@ -173,64 +176,90 @@ const Devices: React.FC = () => {
return ( return (
<Layout <Layout
header={ header={
<NavBar <>
back={null} <NavBar
style={{ background: "#fff" }} back={null}
right={ left={
<Button <div className="nav-title">
size="small" <ArrowLeftOutlined
color="primary" twoToneColor="#1677ff"
onClick={() => setAddVisible(true)} onClick={() => navigate(-1)}
> />
<AddOutline /> </div>
<span style={{ marginLeft: 4, fontSize: 12 }}></span> }
</Button> style={{ background: "#fff" }}
} right={
> <Button
<span style={{ color: "var(--primary-color)", fontWeight: 600 }}> size="small"
color="primary"
</span> onClick={() => setAddVisible(true)}
</NavBar> >
<AddOutline />
<span style={{ marginLeft: 4, fontSize: 12 }}></span>
</Button>
}
>
<span style={{ color: "var(--primary-color)", fontWeight: 600 }}>
</span>
</NavBar>
<div style={{ padding: "12px 12px 0 12px", background: "#fff" }}>
{/* 搜索栏 */}
<div style={{ display: "flex", gap: 8, marginBottom: 12 }}>
<Input
placeholder="搜索设备IMEI/备注"
value={search}
onChange={(e) => setSearch(e.target.value)}
prefix={<SearchOutlined />}
allowClear
style={{ flex: 1 }}
/>
<Button
onClick={() => loadDevices(true)}
icon={<ReloadOutlined />}
>
</Button>
</div>
{/* 筛选和删除 */}
<div style={{ display: "flex", gap: 8, marginBottom: 12 }}>
<Tabs
activeKey={status}
onChange={(k) => setStatus(k as any)}
style={{ flex: 1 }}
>
<Tabs.Tab title="全部" key="all" />
<Tabs.Tab title="在线" key="online" />
<Tabs.Tab title="离线" key="offline" />
</Tabs>
<Button
size="small"
color="danger"
icon={<DeleteOutline />}
disabled={!selected.length}
onClick={() => setDelVisible(true)}
>
</Button>
</div>
</div>
</>
}
footer={
<div style={{ padding: 16, textAlign: "center", background: "#fff" }}>
<Pagination
current={page}
pageSize={20}
total={total}
showSizeChanger={false}
onChange={handlePageChange}
/>
</div>
} }
footer={<MeauMobile activeKey="workspace" />}
loading={loading && devices.length === 0} loading={loading && devices.length === 0}
> >
<div style={{ padding: 12 }}> <div style={{ padding: 12 }}>
{/* 搜索栏 */}
<div style={{ display: "flex", gap: 8, marginBottom: 12 }}>
<Input
placeholder="搜索设备IMEI/备注"
value={search}
onChange={(e) => setSearch(e.target.value)}
prefix={<SearchOutlined />}
allowClear
style={{ flex: 1 }}
/>
<Button onClick={() => loadDevices(true)} icon={<ReloadOutlined />}>
</Button>
</div>
{/* 筛选和删除 */}
<div style={{ display: "flex", gap: 8, marginBottom: 12 }}>
<Tabs
activeKey={status}
onChange={(k) => setStatus(k as any)}
style={{ flex: 1 }}
>
<Tabs.Tab title="全部" key="all" />
<Tabs.Tab title="在线" key="online" />
<Tabs.Tab title="离线" key="offline" />
</Tabs>
<Button
size="small"
color="danger"
icon={<DeleteOutline />}
disabled={!selected.length}
onClick={() => setDelVisible(true)}
>
</Button>
</div>
{/* 设备列表 */} {/* 设备列表 */}
<div style={{ display: "flex", flexDirection: "column", gap: 10 }}> <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
{filtered.map((device) => ( {filtered.map((device) => (
@@ -294,18 +323,7 @@ const Devices: React.FC = () => {
</span> </span>
</div> </div>
))} ))}
{/* 分页组件 */}
{usePagination && (
<div style={{ padding: 16, textAlign: "center" }}>
<Pagination
current={page}
pageSize={20}
total={total}
showSizeChanger={false}
onChange={handlePageChange}
/>
</div>
)}
{/* 无限滚动提示(仅在不分页时显示) */} {/* 无限滚动提示(仅在不分页时显示) */}
{!usePagination && ( {!usePagination && (
<div <div