Skip to content

Commit 0cc4361

Browse files
committed
fix:electron build
1 parent 108a9a1 commit 0cc4361

7 files changed

Lines changed: 41 additions & 21 deletions

File tree

chat2db-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/chat2db/Chat2DB"
88
},
99
"author": "fjy, hexi",
10-
"main": "src/main/main.js",
10+
"main": "src/main/dist/index.js",
1111
"scripts": {
1212
"build": "npm run build:web && npm run build:main",
1313
"build:desktop": "npm run build:web:desktop && npm run build:main:prod",

chat2db-client/src/blocks/AppTitleBar/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { memo } from 'react';
22
import styles from './index.less';
33
import classnames from 'classnames';
44
import CustomLayout from '@/components/CustomLayout';
5+
import Iconfont from '@/components/Iconfont';
56

67
interface IProps {
78
className?: string;
@@ -21,6 +22,17 @@ export default memo<IProps>((props) => {
2122
<div>
2223
<CustomLayout />
2324
</div>
25+
{/* <div className={styles.windowsCloseBar}>
26+
<div>
27+
<Iconfont code="icon-minimize" />
28+
</div>
29+
<div>
30+
<Iconfont code="icon-minimize" />
31+
</div>
32+
<div>
33+
<Iconfont code="icon-minimize" />
34+
</div>
35+
</div> */}
2436
</div>
2537
);
2638
});

chat2db-client/src/layouts/GlobalLayout/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import '@/styles/var.less';
33

44
.loadingBox {
5-
height: 100vh;
5+
flex: 1;
66
width: 100vw;
77
display: flex;
88
justify-content: center;

chat2db-client/src/layouts/GlobalLayout/index.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,34 @@ const GlobalLayout = () => {
6363

6464
// 等待状态页面
6565
if (serviceStatus === ServiceStatus.PENDING || curUser === null) {
66-
return <Spin className={styles.loadingBox} size="large" />;
66+
return (
67+
<div className={styles.app}>
68+
<AppTitleBar className={styles.appTitleBar} />
69+
<Spin className={styles.loadingBox} size="large" />;
70+
</div>
71+
);
6772
}
6873

6974
// 错误状态页面
7075
if (serviceStatus === ServiceStatus.FAILURE) {
7176
return (
72-
<div className={styles.loadingBox}>
73-
<Button type="primary" onClick={restartPolling} style={{ marginBottom: 20 }}>
74-
<SyncOutlined />
75-
{i18n('common.text.tryToRestart')}
76-
</Button>
77-
<div className={styles.contact}>
78-
{i18n('common.text.contactUs')}
79-
<GithubOutlined className={styles.icon} onClick={() => window.open('https://github.com/chat2db/Chat2DB')} />
80-
<Tooltip
81-
placement="bottom"
82-
title={<img style={{ width: 200, height: 200 }} src="https://sqlgpt.cn/_static/img/chat2db_wechat.png" />}
83-
>
84-
<WechatOutlined className={styles.icon} />
85-
</Tooltip>
77+
<div className={styles.app}>
78+
<AppTitleBar className={styles.appTitleBar} />
79+
<div className={styles.loadingBox}>
80+
<Button type="primary" onClick={restartPolling} style={{ marginBottom: 20 }}>
81+
<SyncOutlined />
82+
{i18n('common.text.tryToRestart')}
83+
</Button>
84+
<div className={styles.contact}>
85+
{i18n('common.text.contactUs')}
86+
<GithubOutlined className={styles.icon} onClick={() => window.open('https://github.com/chat2db/Chat2DB')} />
87+
<Tooltip
88+
placement="bottom"
89+
title={<img style={{ width: 200, height: 200 }} src="https://sqlgpt.cn/_static/img/chat2db_wechat.png" />}
90+
>
91+
<WechatOutlined className={styles.icon} />
92+
</Tooltip>
93+
</div>
8694
</div>
8795
</div>
8896
);

chat2db-client/src/main/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function createWindow() {
2626
minHeight: 720,
2727
show: false,
2828
frame: false, // 无边框
29-
titleBarStyle: 'hidden',
29+
titleBarStyle: 'hiddenInset',
3030
webPreferences: {
3131
webSecurity: false,
3232
spellcheck: false, // 禁用拼写检查器

chat2db-client/src/main/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function loadMainResource(mainWindow) {
2121
} else {
2222
mainWindow.loadURL(
2323
url.format({
24-
pathname: path.join(__dirname, '../..', `./versions/${readVersion()}`, `./dist/index.html`),
24+
pathname: path.join(__dirname, '../../..', `./versions/${readVersion()}`, `./dist/index.html`),
2525
protocol: 'file:',
2626
slashes: true,
2727
}),

chat2db-client/src/main/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
entry: './index.js',
55
output: {
66
filename: 'main.js',
7-
path: path.resolve(__dirname),
7+
path: path.resolve(__dirname, 'dist'),
88
},
9-
target: 'electron-main'
9+
target: 'electron-main',
1010
};

0 commit comments

Comments
 (0)