yangjie #49

Merged
yangqiang merged 71 commits from yangjie into master 2025-03-10 14:21:26 +08:00
4 changed files with 28 additions and 34 deletions
Showing only changes of commit b185bb7d67 - Show all commits

View File

@ -115,7 +115,7 @@ app.on('ready', () => {
uploadToServer: false, uploadToServer: false,
ignoreSystemCrashHandler: false ignoreSystemCrashHandler: false
}) })
if (env === 'development') { if (!buildStatus) {
Object.defineProperty(app, 'isPackaged', { Object.defineProperty(app, 'isPackaged', {
get() { get() {
return true return true
@ -763,14 +763,16 @@ function updateHandle() {
autoUpdater.autoDownload = false // 不自动下载安装包 autoUpdater.autoDownload = false // 不自动下载安装包
autoUpdater.autoInstallOnAppQuit = false // 不自动安装 autoUpdater.autoInstallOnAppQuit = false // 不自动安装
autoUpdater.on('error', function (error) { autoUpdater.on('error', function (error) {
sendUpdateMessage(message.error) sendUpdateMessage(error)
}) })
autoUpdater.on('checking-for-update', function () { autoUpdater.on('checking-for-update', function () {
sendUpdateMessage(message.checking) sendUpdateMessage(message.checking)
}) })
autoUpdater.on('update-available', function (info) { autoUpdater.on('update-available', function (info) {
let messageStr = JSON.stringify({ type: '0' }) let messageStr = JSON.stringify({ type: '0' })
sendUpdateMessage(messageStr) setTimeout(() => {
sendUpdateMessage(messageStr)
}, 2000)
mainWindow.webContents.send('changeLocalStorage', { mainWindow.webContents.send('changeLocalStorage', {
isUpdate: true, isUpdate: true,
}); });

View File

@ -187,7 +187,7 @@ const App: React.FC = () => {
if (location.href.indexOf('/login') !== -1) { if (location.href.indexOf('/login') !== -1) {
window.electron.onStop() window.electron.onStop()
} }
if (location.hash.indexOf('/meeting') === -1) { if (location.hash && location.hash.indexOf('/meeting') === -1) {
window.electron.updateHandle() window.electron.updateHandle()
} }
message.destroy('cameraTemporarily') message.destroy('cameraTemporarily')
@ -288,14 +288,6 @@ const App: React.FC = () => {
storage.removeItem('user') storage.removeItem('user')
navigate('/login') navigate('/login')
} }
} else if (e.key === 'reconnect') {
if (e.value == true) {
if (location.hash.indexOf('/meeting') === -1) {
window.electron.updateHandle()
}
} else {
updateModalRef.current.setProgress()
}
} }
}; };
return ( return (

View File

@ -4,42 +4,41 @@ import { getUpdateUrl } from '@/utils/package/public';
import { Button, Flex, Modal, Progress } from 'antd'; import { Button, Flex, Modal, Progress } from 'antd';
import { forwardRef, useImperativeHandle, useState, memo } from "react"; import { forwardRef, useImperativeHandle, useState, memo } from "react";
const UpdateModal = forwardRef((_props: any, ref: any) => { const UpdateModal = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
changeModal: (data: any) => { changeModal: (data: any) => {
try { try {
let dataJson = JSON.parse(data) let dataJson = JSON.parse(data)
if (dataJson.type === '0') { // 打开弹窗 if (dataJson.type === '0') { // 打开弹窗
setProgress(res => { setProgress(res => {
if (res === 0) { if (res) {
} else {
window.electron.onDownload('1') window.electron.onDownload('1')
} }
if (res === 100) {
if (location.hash.indexOf('/meeting') === -1) {
getContent()
setIsUpdateModal(true)
}
}
return res return res
}) })
} else if (dataJson.type === '1') { // 下载中 返回进度值 } else if (dataJson.type === '1') { // 下载中 返回进度值
if (dataJson.value === 100 && location.hash.indexOf('/meeting') === -1) {
setIsUpdateModal(true)
getContent()
}
setProgress(dataJson.value.toFixed(2)) setProgress(dataJson.value.toFixed(2))
} else if (dataJson.type === '2') { // 下载完成 } else if (dataJson.type === '2') { // 下载完成
if (location.hash.indexOf('/meeting') === -1) {
getContent()
setIsUpdateModal(true)
}
setProgress(100) setProgress(100)
if (location.hash.indexOf('/meeting') === -1) {
setIsUpdateModal(true)
getContent()
}
} else if (dataJson.type === '3') { } else if (dataJson.type === '3') {
getContent() if (location.hash.indexOf('/meeting') === -1) {
setIsUpdateModal(true) setIsUpdateModal(true)
getContent()
}
} }
} catch (error) { } catch (error) {
} }
},
setProgress: () => {
setProgress(0)
} }
})) }))
const [isUpdateModal, setIsUpdateModal] = useState(false); const [isUpdateModal, setIsUpdateModal] = useState(false);
@ -54,9 +53,9 @@ const UpdateModal = forwardRef((_props: any, ref: any) => {
} }
throw new Error('Network response was not ok.'); throw new Error('Network response was not ok.');
}) })
.then(_textContent => { .then(textContent => {
}) })
.catch(_error => { .catch(error => {
}); });
} }
@ -103,7 +102,7 @@ const UpdateModal = forwardRef((_props: any, ref: any) => {
onClick={() => window.electron.onDownload('2')} onClick={() => window.electron.onDownload('2')}
style={{ width: '100%', height: '40px', margin: '20px 0' }} style={{ width: '100%', height: '40px', margin: '20px 0' }}
className={`m-ant-btn`} className={`m-ant-btn`}
></Button> ></Button>
} }
</div> </div>
</Modal> </Modal>

View File

@ -125,13 +125,14 @@
color: #ccc; color: #ccc;
font-size: 16px; font-size: 16px;
display: flex; display: flex;
justify-content: space-between;
align-items: center; align-items: center;
>span:nth-child(2) { >span:nth-child(2) {
background-color: red; background-color: red;
padding: 2px 8px; font-size: 12px;
padding: 0px 4px;
border-radius: 10px; border-radius: 10px;
margin-left: 4px;
} }
} }