feat: 集成基本功能
This commit is contained in:
parent
ba94d299e3
commit
06421ccfb6
@ -8,6 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
17
package-lock.json
generated
17
package-lock.json
generated
@ -18,11 +18,12 @@
|
||||
"@eslint/js": "^9.39.4",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.0",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"globals": "^17.4.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^8.0.0"
|
||||
}
|
||||
},
|
||||
@ -3448,6 +3449,20 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/update-browserslist-db": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
||||
|
||||
@ -20,11 +20,12 @@
|
||||
"@eslint/js": "^9.39.4",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.0",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"eslint": "^9.39.4",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.2",
|
||||
"globals": "^17.4.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^8.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import { ConfigProvider, App as AntApp } from 'antd'
|
||||
import zhCN from 'antd/locale/zh_CN'
|
||||
import 'antd/dist/reset.css'
|
||||
import './index.css'
|
||||
import App from './App.jsx'
|
||||
import App from './App'
|
||||
import { setMessageApi } from './api'
|
||||
|
||||
// App 组件容器,用于获取 message API
|
||||
@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
import { Card, Row, Col, Statistic, Spin } from 'antd'
|
||||
import { UserOutlined, ShoppingOutlined, DollarOutlined } from '@ant-design/icons'
|
||||
import statsApi from '../api/modules/stats'
|
||||
@ -44,6 +44,7 @@ function Home() {
|
||||
title="总用户数"
|
||||
value={stats.totalUsers}
|
||||
prefix={<UserOutlined />}
|
||||
// @ts-ignore - antd v5 types incomplete
|
||||
styles={{ value: { color: '#3f8600' } }}
|
||||
/>
|
||||
</Card>
|
||||
@ -54,6 +55,7 @@ function Home() {
|
||||
title="今日订单"
|
||||
value={stats.todayOrders}
|
||||
prefix={<ShoppingOutlined />}
|
||||
// @ts-ignore
|
||||
styles={{ value: { color: '#1890ff' } }}
|
||||
/>
|
||||
</Card>
|
||||
@ -1,4 +1,4 @@
|
||||
import { useState } from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { Form, Input, Button, message } from 'antd'
|
||||
import { UserOutlined, LockOutlined } from '@ant-design/icons'
|
||||
@ -80,7 +80,7 @@ function Login({ onLogin }) {
|
||||
)
|
||||
}
|
||||
|
||||
const styles = {
|
||||
const styles: Record<string, React.CSSProperties> = {
|
||||
container: {
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
@ -42,10 +42,8 @@ function Menu2() {
|
||||
}))
|
||||
|
||||
setSaving(true)
|
||||
const response = await settingsApi.save(updatedSettings)
|
||||
if (response.code === 0) {
|
||||
await settingsApi.save(updatedSettings)
|
||||
message.success('保存成功')
|
||||
}
|
||||
} catch (error) {
|
||||
message.error('保存失败: ' + error.message)
|
||||
} finally {
|
||||
21
tsconfig.json
Normal file
21
tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"strict": false,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
11
tsconfig.node.json
Normal file
11
tsconfig.node.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["vite.config.js"]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user