yangjie #49

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

View File

@ -25,7 +25,7 @@ app.allowRendererProcessReuse = false;
let mainWindow = null; let mainWindow = null;
let childWindow = {} let childWindow = {}
let isMaximized = false; let isMaximized = false;
let env = 'production'; //development production xy let env = 'development'; //development production xy
let regKey; let regKey;
let connection = null; let connection = null;
let startNumber = 0; let startNumber = 0;
@ -77,7 +77,7 @@ let tray;
// 检查网络状态 // 检查网络状态
function checkNetworkStatus() { function checkNetworkStatus() {
if (!net.isOnline()) { if (!net.isOnline()) {
dialog.showErrorBox('智汇享-网络连接错误', '当前无网络连接,请检查您的网络设置。'); dialog.showErrorBox(`${env === 'xy' ? '湖北襄阳四中教研平台' : '智汇享'}-网络连接错误', '当前无网络连接,请检查您的网络设置。`);
app.quit(); app.quit();
return false; return false;
} }

View File

@ -201,7 +201,7 @@ const App: React.FC = () => {
event.preventDefault(); event.preventDefault();
} }
}); });
document.getElementsByTagName('title')[0].innerText = getTitle(storage.getItem('env') as string) document.getElementsByTagName('title')[0].innerText = getTitle()
}, []) }, [])
const handleResize = (): void => { const handleResize = (): void => {
setWindowSize({ setWindowSize({

View File

@ -47,7 +47,7 @@ const UpdateModal = forwardRef((props: any, ref: any) => {
const [updateContent, setUpdateContent] = useState('') // 版本更新内容 const [updateContent, setUpdateContent] = useState('') // 版本更新内容
function getContent() { function getContent() {
fetch(`${getUpdateUrl(storage.getItem('env') as string)}/update.txt?t=${+new Date()}`) // 配置服务器地址 fetch(`${getUpdateUrl()}/update.txt?t=${+new Date()}`) // 配置服务器地址
.then(async response => { .then(async response => {
if (response.status === 200) { if (response.status === 200) {
return setUpdateContent(await response.text()) return setUpdateContent(await response.text())

View File

@ -40,6 +40,7 @@ const Login: React.FC = () => {
roomNum: '', roomNum: '',
}) })
const [nameModal, setNameModal] = useState(false) const [nameModal, setNameModal] = useState(false)
const [env, setEnv] = useState('')
useEffect(() => { useEffect(() => {
window.electron.setMainWindowSize({ window.electron.setMainWindowSize({
@ -47,6 +48,7 @@ const Login: React.FC = () => {
height: 520, height: 520,
key: 'login' key: 'login'
}) })
setEnv(storage.getItem('env') as string)
if (storage.getItem('login')) { if (storage.getItem('login')) {
const login = JSON.parse(storage.getItem('login') as string); const login = JSON.parse(storage.getItem('login') as string);
const data = { const data = {
@ -201,7 +203,7 @@ const Login: React.FC = () => {
<> <>
<div className={styles.login}> <div className={styles.login}>
<div className={styles.loginBg}> <div className={styles.loginBg}>
<img src={storage.getItem('env') === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" /> <img src={env === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" />
</div> </div>
<div className={styles.loginContent}> <div className={styles.loginContent}>
<div> <div>

View File

@ -58,8 +58,8 @@ export const storageSeeting: any = {
}, },
} }
export const getUpdateUrl = (env: string) => { export const getUpdateUrl = () => {
switch (env) { switch (storage.getItem('env')) {
case 'xy': case 'xy':
return 'https://meeting-api.23544.com/meeting/xysz' return 'https://meeting-api.23544.com/meeting/xysz'
case 'development': case 'development':
@ -68,8 +68,8 @@ export const getUpdateUrl = (env: string) => {
return 'https://meeting-api.23544.com/meeting/update' return 'https://meeting-api.23544.com/meeting/update'
} }
} }
export const getTitle = (env: string) => { export const getTitle = () => {
switch (env) { switch (storage.getItem('env')) {
case 'xy': case 'xy':
return '湖北襄阳四中教研平台' return '湖北襄阳四中教研平台'
case 'development': case 'development':
@ -95,7 +95,7 @@ export const compareVersions = (version1: string, version2: string): number => {
} }
export const isVersion = (callBack: Function) => { export const isVersion = (callBack: Function) => {
axios.get(`${getUpdateUrl(storage.getItem('env') as string)}/latest.yml`).then(res => { axios.get(`${getUpdateUrl()}/latest.yml`).then(res => {
if (res.status === 200 && res.data) { if (res.status === 200 && res.data) {
const data = yaml.load(res.data); // 解析 YAML 内容 const data = yaml.load(res.data); // 解析 YAML 内容
window.electron.getVersion().then(req => { window.electron.getVersion().then(req => {