版本号优化

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', () => {
return mainWindow.isMaximized();
});
// 获取版本号
ipcMain.handle('getVersion', () => {
return app.getVersion();
});
// 获取共享屏幕列表
ipcMain.handle('getSources', async () => {
return await desktopCapturer.getSources({

View File

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

View File

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

View File

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

1
src/render.d.ts vendored
View File

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