This commit is contained in:
parent
f0c79d64cd
commit
440f19b436
|
|
@ -194,14 +194,17 @@ const App: React.FC = () => {
|
|||
}, [navigate])
|
||||
}
|
||||
useEffect(() => {
|
||||
document.addEventListener('keydown', (event) => {
|
||||
document.addEventListener('keydown', async (event) => {
|
||||
if (event.keyCode == 122) {
|
||||
event.preventDefault();
|
||||
} else if (((event.ctrlKey && event.keyCode == 82) || event.keyCode == 116) && window.electron.getEnv() !== 'development') {
|
||||
} else if (((event.ctrlKey && event.keyCode == 82) || event.keyCode == 116)) {
|
||||
let env = await window.electron.getEnv()
|
||||
if (env !== 'development') {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
document.getElementsByTagName('title')[0].innerText = getTitle()
|
||||
getTitle()
|
||||
}, [])
|
||||
const handleResize = (): void => {
|
||||
setWindowSize({
|
||||
|
|
|
|||
|
|
@ -14,10 +14,11 @@ const Code = forwardRef((props: any, ref: any) => {
|
|||
<>
|
||||
<Popover
|
||||
placement="bottom"
|
||||
onOpenChange={(e: boolean) => {
|
||||
onOpenChange={async (e: boolean) => {
|
||||
setBaseImage('')
|
||||
if (e) {
|
||||
GetQrcode(roomNum, window.electron.getEnv() === 'development' ? 'trial' : 'release').then(res => {
|
||||
let env = await window.electron.getEnv()
|
||||
GetQrcode(roomNum, env === 'development' ? 'trial' : 'release').then(res => {
|
||||
if (res.code === 200) {
|
||||
setBaseImage(res.data)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,8 @@ const VideoComponents = () => {
|
|||
}, [darkLightEnhancement]);
|
||||
useEffect(() => {
|
||||
if (typeof virtualBackground.sourceIndex === 'number') {
|
||||
if (window.electron.getEnv() === 'development') {
|
||||
window.electron.getEnv().then(res=>{
|
||||
if (res === 'development') {
|
||||
window.electron.getAppPath().then((res: string) => {
|
||||
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${virtualBackground.sourceIndex + 1}.png`);
|
||||
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
|
||||
|
|
@ -262,6 +263,7 @@ const VideoComponents = () => {
|
|||
color: Number(virtualBackground.color),
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
|
||||
background_source_type: 1,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import styles from '@/components/UpdateModal/index.module.scss'
|
|||
import ImageUrl from '@/utils/package/imageUrl';
|
||||
import { getUpdateUrl } from '@/utils/package/public';
|
||||
import { Button, Flex, Modal, Progress } from 'antd';
|
||||
import { forwardRef, useImperativeHandle, useState, memo } from "react";
|
||||
import { forwardRef, useImperativeHandle, useState, memo, useEffect } from "react";
|
||||
|
||||
const UpdateModal = forwardRef((props: any, ref: any) => {
|
||||
useImperativeHandle(ref, () => ({
|
||||
|
|
@ -44,7 +44,12 @@ const UpdateModal = forwardRef((props: any, ref: any) => {
|
|||
const [isUpdateModal, setIsUpdateModal] = useState(false);
|
||||
const [progress, setProgress] = useState(0); // 下载进度值
|
||||
const [updateContent, setUpdateContent] = useState('') // 版本更新内容
|
||||
|
||||
const [env, setEnv] = useState('')
|
||||
useEffect(() => {
|
||||
window.electron.getEnv().then(res => {
|
||||
setEnv(res)
|
||||
})
|
||||
}, [])
|
||||
function getContent() {
|
||||
fetch(`${getUpdateUrl()}/update.txt?t=${+new Date()}`) // 配置服务器地址
|
||||
.then(async response => {
|
||||
|
|
@ -90,7 +95,7 @@ const UpdateModal = forwardRef((props: any, ref: any) => {
|
|||
style={{ width: '100%', height: '40px', marginBottom: '10px' }}
|
||||
className={`m-ant-btn`}
|
||||
>立即更新</Button>
|
||||
{window.electron.getEnv() === "development" ? <div className={styles.button2} onClick={() => setIsUpdateModal(false)}>暂不更新</div> : null}
|
||||
{env === "development" ? <div className={styles.button2} onClick={() => setIsUpdateModal(false)}>暂不更新</div> : null}
|
||||
</div> : progress < 100 ?
|
||||
<div style={{ margin: '20px 0' }}>
|
||||
下载进度:{progress}%
|
||||
|
|
|
|||
|
|
@ -40,13 +40,16 @@ const Login: React.FC = () => {
|
|||
roomNum: '',
|
||||
})
|
||||
const [nameModal, setNameModal] = useState(false)
|
||||
|
||||
const [env, setEnv] = useState('')
|
||||
useEffect(() => {
|
||||
window.electron.setMainWindowSize({
|
||||
width: 752,
|
||||
height: 520,
|
||||
key: 'login'
|
||||
})
|
||||
window.electron.getEnv().then(res => {
|
||||
setEnv(res)
|
||||
})
|
||||
if (storage.getItem('login')) {
|
||||
const login = JSON.parse(storage.getItem('login') as string);
|
||||
const data = {
|
||||
|
|
@ -201,7 +204,7 @@ const Login: React.FC = () => {
|
|||
<>
|
||||
<div className={styles.login}>
|
||||
<div className={styles.loginBg}>
|
||||
{window.electron.getEnv() ? <img src={window.electron.getEnv() === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" /> : null}
|
||||
{env ? <img src={env === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" /> : null}
|
||||
</div>
|
||||
<div className={styles.loginContent}>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export interface IElectronAPI {
|
|||
startLoad: () => any;
|
||||
updateHandle: () => any;
|
||||
getVersion: () => Promise<string>;
|
||||
getEnv: () => string;
|
||||
getEnv: () => Promise<string>;
|
||||
isVisible: () => Promise<string>;
|
||||
setRegistry: (uuid: string) => any;
|
||||
getRegistry: () => any;
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ export const storageSeeting: any = {
|
|||
},
|
||||
}
|
||||
|
||||
export const getUpdateUrl = () => {
|
||||
switch (window.electron.getEnv()) {
|
||||
export const getUpdateUrl = async () => {
|
||||
let env = await window.electron.getEnv()
|
||||
switch (env) {
|
||||
case 'xy':
|
||||
return 'https://meeting-api.23544.com/meeting/xysz'
|
||||
case 'development':
|
||||
|
|
@ -68,15 +69,21 @@ export const getUpdateUrl = () => {
|
|||
return 'https://meeting-api.23544.com/meeting/update'
|
||||
}
|
||||
}
|
||||
export const getTitle = () => {
|
||||
switch (window.electron.getEnv()) {
|
||||
export const getTitle = async () => {
|
||||
let env = await window.electron.getEnv()
|
||||
let str;
|
||||
switch (env) {
|
||||
case 'xy':
|
||||
return '湖北襄阳四中教研平台'
|
||||
str = '湖北襄阳四中教研平台'
|
||||
break;
|
||||
case 'development':
|
||||
return '智汇享'
|
||||
str = '智汇享'
|
||||
break;
|
||||
default:
|
||||
return '智汇享'
|
||||
str = '智汇享'
|
||||
break;
|
||||
}
|
||||
document.getElementsByTagName('title')[0].innerText = str
|
||||
}
|
||||
export const compareVersions = (version1: string, version2: string): number => {
|
||||
const v1Parts = version1.split('.').map(Number);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
import Request from './request'
|
||||
import { constant } from '@/config'
|
||||
let baseURL = !location.hostname.includes('meeting-api.23544.com') ? 'http://192.168.2.9:5192' : 'https://meeting-api.23544.com/pc'
|
||||
// 实例化
|
||||
const req = new Request({
|
||||
baseURL: window.electron.getEnv() === 'development' ? 'http://192.168.2.9:5192' : 'https://meeting-api.23544.com/pc',
|
||||
baseURL,
|
||||
timeout: constant.CONFIG_REQUEST_TIMEOUT_TIME as number,
|
||||
interceptors: {
|
||||
// 请求拦截器
|
||||
|
|
@ -21,5 +22,4 @@ const request = (config: any) => {
|
|||
}
|
||||
return req.request<any>(config)
|
||||
}
|
||||
|
||||
export default request
|
||||
|
|
|
|||
Loading…
Reference in New Issue