From 0cc4361f39d33a2301f308cff9399ddaf8b8c3b3 Mon Sep 17 00:00:00 2001 From: shanhexi Date: Mon, 8 Jan 2024 15:52:21 +0800 Subject: [PATCH] fix:electron build --- chat2db-client/package.json | 2 +- .../src/blocks/AppTitleBar/index.tsx | 12 ++++++ .../src/layouts/GlobalLayout/index.less | 2 +- .../src/layouts/GlobalLayout/index.tsx | 38 +++++++++++-------- chat2db-client/src/main/index.js | 2 +- chat2db-client/src/main/utils.js | 2 +- chat2db-client/src/main/webpack.config.js | 4 +- 7 files changed, 41 insertions(+), 21 deletions(-) diff --git a/chat2db-client/package.json b/chat2db-client/package.json index 861eff341..2813bca64 100644 --- a/chat2db-client/package.json +++ b/chat2db-client/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/chat2db/Chat2DB" }, "author": "fjy, hexi", - "main": "src/main/main.js", + "main": "src/main/dist/index.js", "scripts": { "build": "npm run build:web && npm run build:main", "build:desktop": "npm run build:web:desktop && npm run build:main:prod", diff --git a/chat2db-client/src/blocks/AppTitleBar/index.tsx b/chat2db-client/src/blocks/AppTitleBar/index.tsx index ad0c72e5f..7372dfa0a 100644 --- a/chat2db-client/src/blocks/AppTitleBar/index.tsx +++ b/chat2db-client/src/blocks/AppTitleBar/index.tsx @@ -2,6 +2,7 @@ import React, { memo } from 'react'; import styles from './index.less'; import classnames from 'classnames'; import CustomLayout from '@/components/CustomLayout'; +import Iconfont from '@/components/Iconfont'; interface IProps { className?: string; @@ -21,6 +22,17 @@ export default memo((props) => {
+ {/*
+
+ +
+
+ +
+
+ +
+
*/} ); }); diff --git a/chat2db-client/src/layouts/GlobalLayout/index.less b/chat2db-client/src/layouts/GlobalLayout/index.less index a0350d923..f54a4bdf5 100644 --- a/chat2db-client/src/layouts/GlobalLayout/index.less +++ b/chat2db-client/src/layouts/GlobalLayout/index.less @@ -2,7 +2,7 @@ @import '@/styles/var.less'; .loadingBox { - height: 100vh; + flex: 1; width: 100vw; display: flex; justify-content: center; diff --git a/chat2db-client/src/layouts/GlobalLayout/index.tsx b/chat2db-client/src/layouts/GlobalLayout/index.tsx index c8e23c942..5b11e1904 100644 --- a/chat2db-client/src/layouts/GlobalLayout/index.tsx +++ b/chat2db-client/src/layouts/GlobalLayout/index.tsx @@ -63,26 +63,34 @@ const GlobalLayout = () => { // 等待状态页面 if (serviceStatus === ServiceStatus.PENDING || curUser === null) { - return ; + return ( +
+ + ; +
+ ); } // 错误状态页面 if (serviceStatus === ServiceStatus.FAILURE) { return ( -
- -
- {i18n('common.text.contactUs')}: - window.open('https://github.com/chat2db/Chat2DB')} /> - } - > - - +
+ +
+ +
+ {i18n('common.text.contactUs')}: + window.open('https://github.com/chat2db/Chat2DB')} /> + } + > + + +
); diff --git a/chat2db-client/src/main/index.js b/chat2db-client/src/main/index.js index 88ab15e7d..a423d0b44 100644 --- a/chat2db-client/src/main/index.js +++ b/chat2db-client/src/main/index.js @@ -26,7 +26,7 @@ function createWindow() { minHeight: 720, show: false, frame: false, // 无边框 - titleBarStyle: 'hidden', + titleBarStyle: 'hiddenInset', webPreferences: { webSecurity: false, spellcheck: false, // 禁用拼写检查器 diff --git a/chat2db-client/src/main/utils.js b/chat2db-client/src/main/utils.js index 3dd6ae18d..ff02b2be7 100644 --- a/chat2db-client/src/main/utils.js +++ b/chat2db-client/src/main/utils.js @@ -21,7 +21,7 @@ function loadMainResource(mainWindow) { } else { mainWindow.loadURL( url.format({ - pathname: path.join(__dirname, '../..', `./versions/${readVersion()}`, `./dist/index.html`), + pathname: path.join(__dirname, '../../..', `./versions/${readVersion()}`, `./dist/index.html`), protocol: 'file:', slashes: true, }), diff --git a/chat2db-client/src/main/webpack.config.js b/chat2db-client/src/main/webpack.config.js index 28e0dc227..c598563e0 100644 --- a/chat2db-client/src/main/webpack.config.js +++ b/chat2db-client/src/main/webpack.config.js @@ -4,7 +4,7 @@ module.exports = { entry: './index.js', output: { filename: 'main.js', - path: path.resolve(__dirname), + path: path.resolve(__dirname, 'dist'), }, - target: 'electron-main' + target: 'electron-main', };