Skip to content

Commit 83ffa6b

Browse files
committed
111
1 parent a9847b9 commit 83ffa6b

File tree

11 files changed

+111
-169
lines changed

11 files changed

+111
-169
lines changed

electron/main/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function createWindow() {
5050
win = new BrowserWindow({
5151
title: '立冬工具',
5252
icon: path.join(process.env.VITE_PUBLIC, 'favicon.ico'),
53-
backgroundColor: 'pink',//窗口背景颜色
53+
// backgroundColor: 'pink',//窗口背景颜色
5454
webPreferences: {
5555
preload,
5656
// Warning: Enable nodeIntegration and disable contextIsolation is not secure in production
@@ -65,7 +65,7 @@ async function createWindow() {
6565
if (VITE_DEV_SERVER_URL) { // #298
6666
win.loadURL(VITE_DEV_SERVER_URL)
6767
// Open devTool if the app is not packaged
68-
// win.webContents.openDevTools()
68+
win.webContents.openDevTools()
6969
} else {
7070
win.loadFile(indexHtml)
7171
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"type": "module",
1414
"scripts": {
1515
"dev": "vite",
16-
"build": "tsc && vite build && electron-builder",
16+
"build": "tsc && vite build && electron-builder -w",
1717
"preview": "vite preview",
1818
"pree2e": "vite build --mode=test",
1919
"e2e": "playwright test"
@@ -33,6 +33,8 @@
3333
"autoprefixer": "^10.4.18",
3434
"electron": "^29.1.1",
3535
"electron-builder": "^24.13.3",
36+
"less": "^4.2.0",
37+
"less-loader": "^12.2.0",
3638
"react": "^18.2.0",
3739
"react-dom": "^18.2.0",
3840
"typescript": "^5.4.2",

src/App.css

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/App.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
.content{
3+
width: 100vvw;
4+
height: 100vh;
5+
text-align: center;
6+
border: 1px solid red;
7+
}
8+
.footer{
9+
width: 90vw;
10+
display: flex;
11+
justify-content: space-around;
12+
}

src/App.tsx

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
1-
import React from 'react';
2-
import LoginPage, { Username, Password, Submit, Title, Logo, Reset } from '@react-login-page/page1';
3-
import LoginLogo from 'react-login-page/logo';
4-
5-
const styles = { height: "100vh",width:"100vw" };
6-
7-
const Demo = () => (
8-
<div style={styles}>
9-
<LoginPage>
10-
<Username name="userUserName" />
11-
<Password placeholder="请输入密码" name="userPassword" />
12-
<Submit>提交</Submit>
13-
<Reset disabled>重置</Reset>
14-
<Title />
15-
<Logo>
16-
<LoginLogo />
17-
</Logo>
18-
</LoginPage>
19-
</div>
20-
);
21-
22-
export default Demo;
1+
import { Button, Form, Image, Input } from "antd"
2+
3+
import LOGIN from '@/assets/login.png';
4+
5+
import "./App.less";
6+
7+
export default () => {
8+
9+
const onFinish = () => {
10+
11+
}
12+
13+
const onFinishFailed = () => {
14+
15+
}
16+
17+
return (
18+
<div className="content">
19+
<h1 style={{ marginTop: "100px" }}>欢迎使用这个软件</h1>
20+
<Form
21+
name="login"
22+
labelCol={{ span: 8 }}
23+
wrapperCol={{ span: 16 }}
24+
style={{ maxWidth: 600, margin: "40px 0" }}
25+
initialValues={{ remember: true }}
26+
onFinish={onFinish}
27+
onFinishFailed={onFinishFailed}
28+
autoComplete="off"
29+
>
30+
<Form.Item
31+
label="请输入开机密码"
32+
name="password"
33+
rules={[{ required: true, message: '请输入开机密码!!!' }]}
34+
>
35+
<Input />
36+
</Form.Item>
37+
</Form>
38+
<div className="footer">
39+
<Button type="default" htmlType="submit">
40+
联系作者
41+
</Button>
42+
<Button type="primary" htmlType="submit">
43+
登陆
44+
</Button>
45+
</div>
46+
</div>
47+
)
48+
49+
}

src/assets/fonts/王强书法体.ttf

3.82 MB
Binary file not shown.

src/assets/login.png

3.86 KB
Loading

src/index.css

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/index.less

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@font-face {
2+
font-family: "HYXJ";
3+
src: url("./assets/fonts/王强书法体.ttf") format("truetype");
4+
}
5+
6+
.ant-form {
7+
font-family: "HYXJ", sans-serif; // 替换 "您的自定义字体" 为想要的字体名称
8+
}
9+
10+
.ant-form .ant-form-item-label {
11+
font-family: "HYXJ", sans-serif;
12+
}
13+
14+
.ant-form .ant-form-item {
15+
font-family: "HYXJ", sans-serif;
16+
}
17+
.ant-prefix {
18+
font-family: "HYXJ", sans-serif;
19+
}
20+
.ant-form-item-required{
21+
font-family: "HYXJ", sans-serif;
22+
}
23+
24+
*{
25+
padding: 0;
26+
margin: 0;
27+
}
28+
29+
30+
html, body {
31+
font-family:"HYXJ";
32+
}
33+
34+

src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import ReactDOM from 'react-dom/client'
33
import App from './App'
44

5-
import './index.css'
5+
import './index.less'
66

77
import './demos/ipc'
88
// If you want use Node.js, the`nodeIntegration` needs to be enabled in the Main process.

vite.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ export default defineConfig(({ command }) => {
6464
renderer: {},
6565
}),
6666
],
67+
css: {
68+
preprocessorOptions: {
69+
less: {
70+
javascriptEnabled: true, // 支持内联 JavaScript
71+
modifyVars: { // 更改主题
72+
}
73+
}
74+
}
75+
}
76+
,
6777
server: process.env.VSCODE_DEBUG && (() => {
6878
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)
6979
return {

0 commit comments

Comments
 (0)