feat: 优化模板

This commit is contained in:
NICE CODE BY DEV 2024-04-09 18:06:18 +08:00
parent ae3c4abac2
commit 3657364146
7 changed files with 77 additions and 36 deletions

View File

@ -22,27 +22,28 @@
"chokidar": "^3.6.0",
"clear-module": "^4.1.2",
"lodash": "^4.17.21",
"normalize.css": "^8.0.1",
"umi": "^4.0.42"
},
"devDependencies": {
"@testing-library/jest-dom": "^5",
"@testing-library/react": "^14",
"@tsconfig/node21": "^21.0.3",
"@types/jest": "^29",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/testing-library__jest-dom": "^5.14.5",
"@umijs/plugin-electron": "^0.2.0",
"@umijs/plugins": "^4.1.8",
"cross-env": "^7",
"electron": "29.1.6",
"typescript": "^5",
"jest": "^29",
"jest-environment-jsdom": "^29",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-packagejson": "^2.4.3",
"jest": "^29",
"@types/jest": "^29",
"ts-node": "^10",
"cross-env": "^7",
"jest-environment-jsdom": "^29",
"@testing-library/jest-dom": "^5",
"@testing-library/react": "^14",
"@types/testing-library__jest-dom": "^5.14.5",
"@umijs/plugins": "^4.1.8"
"typescript": "^5"
},
"publishConfig": {
"access": "public",

View File

@ -17,6 +17,9 @@ dependencies:
lodash:
specifier: ^4.17.21
version: 4.17.21
normalize.css:
specifier: ^8.0.1
version: 8.0.1
umi:
specifier: ^4.0.42
version: 4.1.8(@babel/core@7.24.4)(@types/node@20.12.2)(@types/react@18.2.73)(eslint@8.57.0)(jest@29.7.0)(prettier@2.8.8)(react-dom@18.2.0)(react@18.2.0)(stylelint@14.16.1)(typescript@5.4.4)(webpack@5.91.0)
@ -3422,7 +3425,7 @@ packages:
'@types/history': 4.7.11
'@types/react': 18.2.73
'@types/react-router': 5.1.20
redux: 3.7.2
redux: 4.2.1
dev: true
/@types/react-router@5.1.20:
@ -9081,6 +9084,10 @@ packages:
engines: {node: '>=10'}
dev: true
/normalize.css@8.0.1:
resolution: {integrity: sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==}
dev: false
/npm-run-path@4.0.1:
resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
engines: {node: '>=8'}

1
src/app.ts Normal file
View File

@ -0,0 +1 @@
import 'normalize.css'

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>形体结构化视频数据分析系统</title>
</head>
<body>
<div id="app"></div>
<webview id="" src="http://10.0.0.96:30003/" />
</body>
</html>

View File

@ -1,18 +1,61 @@
import { Link, Outlet } from 'umi';
import { Outlet, history } from 'umi';
import { Layout, Menu, theme, Image, Affix } from 'antd'
import avatar from '../assets/avatar.jpg';
import styles from './index.less';
export default function Layout() {
const { Header, Content, Footer } = Layout;
const items = [
{
key: '/',
label: '首页'
},
{
key: '/docs',
label: '上传页'
}
]
export default function BaseLayout() {
const {
token: { colorBgContainer, borderRadiusLG },
} = theme.useToken();
return (
<div className={styles.navs}>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<Link to="/docs">upLoad</Link>
</li>
</ul>
<Outlet />
<Layout>
<Affix>
<Header style={{ height: '32px', display: 'flex', alignItems: 'center' }}>
<div style={{ marginRight: '12px', height: '32px' }}>
<Image style={{ fontSize: 0 }} src={avatar} alt="nicecode" width={'24px'} preview={false} />
</div>
<Menu
style={{ height: '32px', lineHeight: '32px' }}
theme="dark"
mode="horizontal"
defaultSelectedKeys={['2']}
items={items}
onClick={item => history.push(item.key)}
/>
</Header>
</Affix>
<Content style={{ padding: '0 24px' }}>
<div
style={{
background: colorBgContainer,
minHeight: 280,
padding: 24,
borderRadius: borderRadiusLG,
}}
>
<Outlet />
</div>
</Content>
<Footer style={{ textAlign: 'center' }}>
nicecode ©{new Date().getFullYear()} Created by dev
</Footer>
</Layout>
</div>
);
}

View File

@ -3,10 +3,11 @@ import { BrowserWindowConstructorOptions } from 'electron';
export default {
browserWindow: {
title: 'nicecode 客户端模板',
titleBarStyle: 'hidden',
titleBarOverlay: {
color: '#2f3241',
symbolColor: '#74b1be',
height: 48
height: 32
},
maximizable: false,
webPreferences: {

View File

@ -1,4 +1,4 @@
import { Button } from 'antd';
import { Button, message } from 'antd';
import avatar from '../assets/avatar.jpg';
export default function HomePage() {
@ -13,7 +13,7 @@ export default function HomePage() {
</p>
<Button
onClick={async () => {
window.alert(await window.$api.getPlatform());
message.info(await window.$api.getPlatform());
}}
>
what is my platform?