版本号优化

This commit is contained in:
yj 2024-08-23 15:12:42 +08:00
parent 13b31fe8aa
commit a3f183120f
5 changed files with 25 additions and 1 deletions

View File

@ -190,6 +190,10 @@ app.on('ready', () => {
ipcMain.handle('getIsMaximized', () => { ipcMain.handle('getIsMaximized', () => {
return mainWindow.isMaximized(); return mainWindow.isMaximized();
}); });
// 获取版本号
ipcMain.handle('getVersion', () => {
return app.getVersion();
});
// 获取共享屏幕列表 // 获取共享屏幕列表
ipcMain.handle('getSources', async () => { ipcMain.handle('getSources', async () => {
return await desktopCapturer.getSources({ return await desktopCapturer.getSources({

View File

@ -13,6 +13,10 @@ window.electron = {
getIsMaximized: () => { getIsMaximized: () => {
return ipcRenderer.invoke('getIsMaximized') return ipcRenderer.invoke('getIsMaximized')
}, },
// 获取版本号
getVersion: () => {
return ipcRenderer.invoke('getVersion')
},
// 获取共享屏幕列表 // 获取共享屏幕列表
getSources: () => { getSources: () => {
return ipcRenderer.invoke('getSources') return ipcRenderer.invoke('getSources')

View File

@ -12,7 +12,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@for $i from 1 through 4 { @for $i from 1 through 5 {
>div:nth-child(#{$i}) { >div:nth-child(#{$i}) {
@if $i ==1 { @if $i ==1 {
display: flex; display: flex;
@ -119,6 +119,13 @@
} }
@else if $i ==4 { @else if $i ==4 {
flex-shrink: 0;
color: #ccc;
font-size: 16px;
}
@else if $i ==5 {
flex-shrink: 0;
border-top: #565656 solid 1px; border-top: #565656 solid 1px;
padding-top: 10px; padding-top: 10px;
margin-top: 10px; margin-top: 10px;

View File

@ -43,6 +43,7 @@ const Home: React.FC = () => {
}, },
]); ]);
const [userInfo, setUserInfo] = useState<any>({}) const [userInfo, setUserInfo] = useState<any>({})
const [version, setVersion] = useState<string>('')
const [dateInfo, setDateInfo] = useState<{ const [dateInfo, setDateInfo] = useState<{
work: string; work: string;
time: string; time: string;
@ -53,7 +54,11 @@ const Home: React.FC = () => {
specific: '', specific: '',
}) })
useEffect(() => { useEffect(() => {
console.log(window.electron.getVersion());
setUserInfo(user) setUserInfo(user)
window.electron.getVersion().then(res => {
setVersion(res)
})
const updateTime = () => { const updateTime = () => {
setDateInfo({ setDateInfo({
work: dayjs().format('ddd'), work: dayjs().format('ddd'),
@ -121,6 +126,9 @@ const Home: React.FC = () => {
) )
})} })}
</div> </div>
<div>
{version}
</div>
<div> <div>
<div className='drag' title='设置' onClick={() => { <div className='drag' title='设置' onClick={() => {
stupWizardRef.current.changeModal() stupWizardRef.current.changeModal()

1
src/render.d.ts vendored
View File

@ -14,6 +14,7 @@ export interface IElectronAPI {
quit: () => any; quit: () => any;
downFile: (callBack: Function) => void; downFile: (callBack: Function) => void;
quitAndInstall: (callBack: Function) => void; quitAndInstall: (callBack: Function) => void;
getVersion: () => Promise<string>;
oepnWindow: (data: any) => any; oepnWindow: (data: any) => any;
} }