yangjie #49
|
|
@ -1,6 +0,0 @@
|
||||||
#基础API 绝对的
|
|
||||||
VITE_BASE_URL_API = 'http://192.168.2.9:5192'
|
|
||||||
#当前IP 相对的
|
|
||||||
VITE_BASE_CURRENT_API = '.'
|
|
||||||
#开发环境
|
|
||||||
VITE_ENV = 'development'
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#基础API 绝对的
|
|
||||||
VITE_BASE_URL_API = 'https://meeting-api.23544.com/pc'
|
|
||||||
#当前IP 相对的
|
|
||||||
VITE_BASE_CURRENT_API = '.'
|
|
||||||
#生产环境
|
|
||||||
VITE_ENV = 'production'
|
|
||||||
6
.env.xy
6
.env.xy
|
|
@ -1,6 +0,0 @@
|
||||||
#基础API 绝对的
|
|
||||||
VITE_BASE_URL_API = 'https://meeting-api.23544.com/pc'
|
|
||||||
#当前IP 相对的
|
|
||||||
VITE_BASE_CURRENT_API = '.'
|
|
||||||
#测试环境
|
|
||||||
VITE_ENV = 'xy'
|
|
||||||
5
main.js
5
main.js
|
|
@ -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 = 'development'; //development production
|
let env = 'production'; //development production xy
|
||||||
let regKey;
|
let regKey;
|
||||||
let connection = null;
|
let connection = null;
|
||||||
let startNumber = 0;
|
let startNumber = 0;
|
||||||
|
|
@ -64,6 +64,9 @@ class AppWindow extends BrowserWindow {
|
||||||
// this.loadFile(path.resolve(__dirname, './dist/index.html'))
|
// this.loadFile(path.resolve(__dirname, './dist/index.html'))
|
||||||
this.once('ready-to-show', () => {
|
this.once('ready-to-show', () => {
|
||||||
this.show();
|
this.show();
|
||||||
|
mainWindow.webContents.send('changeLocalStorage', {
|
||||||
|
env,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14
package.json
14
package.json
|
|
@ -6,16 +6,10 @@
|
||||||
"authors": "yj",
|
"authors": "yj",
|
||||||
"description": "智汇享",
|
"description": "智汇享",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "concurrently \"electron . --env=development\" \"cross-env BROWSER=none vite\"",
|
"dev": "concurrently \"electron .\" \"cross-env BROWSER=none vite\"",
|
||||||
"prod": "concurrently \"electron . --env=production\" \"cross-env BROWSER=none vite\"",
|
"build": "vite build",
|
||||||
"xy": "concurrently \"electron . --env=xy\" \"cross-env BROWSER=none vite\"",
|
|
||||||
"build": "vite build --mode development",
|
|
||||||
"build:prod": "vite build --mode production",
|
|
||||||
"build:xy": "vite build --mode xy",
|
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"build:dev-win": "vite build --mode development & electron-builder -w --config=./config/development.json",
|
"build:electron": "vite build & electron-builder -w --config=./config/development.json"
|
||||||
"build:prod-win": "vite build --mode production & electron-builder -w --config=./config/production.json",
|
|
||||||
"build:prod-win-xy": "vite build --mode xy & electron-builder -w --config=./config/xy.json"
|
|
||||||
},
|
},
|
||||||
"agora_electron": {
|
"agora_electron": {
|
||||||
"platform": "win32",
|
"platform": "win32",
|
||||||
|
|
@ -59,4 +53,4 @@
|
||||||
"vite": "^2.8.0",
|
"vite": "^2.8.0",
|
||||||
"vite-plugin-resolve": "^2.5.1"
|
"vite-plugin-resolve": "^2.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -197,11 +197,11 @@ const App: React.FC = () => {
|
||||||
document.addEventListener('keydown', (event) => {
|
document.addEventListener('keydown', (event) => {
|
||||||
if (event.keyCode == 122) {
|
if (event.keyCode == 122) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else if (((event.ctrlKey && event.keyCode == 82) || event.keyCode == 116) && import.meta.env.VITE_ENV !== 'development') {
|
} else if (((event.ctrlKey && event.keyCode == 82) || event.keyCode == 116) && storage.getItem('env') !== 'development') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.getElementsByTagName('title')[0].innerText = getTitle(import.meta.env.VITE_ENV)
|
document.getElementsByTagName('title')[0].innerText = getTitle(storage.getItem('env') as string)
|
||||||
}, [])
|
}, [])
|
||||||
const handleResize = (): void => {
|
const handleResize = (): void => {
|
||||||
setWindowSize({
|
setWindowSize({
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import ImageUrl from '@/utils/package/imageUrl';
|
||||||
import { Empty, Popover } from 'antd';
|
import { Empty, Popover } from 'antd';
|
||||||
import { GetQrcode } from '@/api/Home/Index';
|
import { GetQrcode } from '@/api/Home/Index';
|
||||||
import { memo, useImperativeHandle, forwardRef, useState } from "react";
|
import { memo, useImperativeHandle, forwardRef, useState } from "react";
|
||||||
|
import { storage } from '@/utils';
|
||||||
const Code = forwardRef((props: any, ref: any) => {
|
const Code = forwardRef((props: any, ref: any) => {
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
getData: () => {
|
getData: () => {
|
||||||
|
|
@ -17,7 +18,7 @@ const Code = forwardRef((props: any, ref: any) => {
|
||||||
onOpenChange={(e: boolean) => {
|
onOpenChange={(e: boolean) => {
|
||||||
setBaseImage('')
|
setBaseImage('')
|
||||||
if (e) {
|
if (e) {
|
||||||
GetQrcode(roomNum, import.meta.env.VITE_ENV === 'development' ? 'trial' : 'release').then(res => {
|
GetQrcode(roomNum, storage.getItem('env') === 'development' ? 'trial' : 'release').then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
setBaseImage(res.data)
|
setBaseImage(res.data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ const VideoComponents = () => {
|
||||||
}, [darkLightEnhancement]);
|
}, [darkLightEnhancement]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof virtualBackground.sourceIndex === 'number') {
|
if (typeof virtualBackground.sourceIndex === 'number') {
|
||||||
if (import.meta.env.VITE_ENV === 'development') {
|
if (storage.getItem('env') === 'development') {
|
||||||
window.electron.getAppPath().then((res: string) => {
|
window.electron.getAppPath().then((res: string) => {
|
||||||
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${virtualBackground.sourceIndex + 1}.png`);
|
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${virtualBackground.sourceIndex + 1}.png`);
|
||||||
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
|
agora.enableVirtualBackground(virtualBackground.isVirtualBackground, {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import styles from '@/components/UpdateModal/index.module.scss'
|
import styles from '@/components/UpdateModal/index.module.scss'
|
||||||
|
import { storage } from '@/utils';
|
||||||
import ImageUrl from '@/utils/package/imageUrl';
|
import ImageUrl from '@/utils/package/imageUrl';
|
||||||
import { getUpdateUrl } from '@/utils/package/public';
|
import { getUpdateUrl } from '@/utils/package/public';
|
||||||
import { Button, Flex, Modal, Progress } from 'antd';
|
import { Button, Flex, Modal, Progress } from 'antd';
|
||||||
|
|
@ -46,7 +47,7 @@ const UpdateModal = forwardRef((props: any, ref: any) => {
|
||||||
const [updateContent, setUpdateContent] = useState('') // 版本更新内容
|
const [updateContent, setUpdateContent] = useState('') // 版本更新内容
|
||||||
|
|
||||||
function getContent() {
|
function getContent() {
|
||||||
fetch(`${getUpdateUrl(import.meta.env.VITE_ENV)}/update.txt?t=${+new Date()}`) // 配置服务器地址
|
fetch(`${getUpdateUrl(storage.getItem('env') as string)}/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())
|
||||||
|
|
@ -90,7 +91,7 @@ const UpdateModal = forwardRef((props: any, ref: any) => {
|
||||||
style={{ width: '100%', height: '40px', marginBottom: '10px' }}
|
style={{ width: '100%', height: '40px', marginBottom: '10px' }}
|
||||||
className={`m-ant-btn`}
|
className={`m-ant-btn`}
|
||||||
>立即更新</Button>
|
>立即更新</Button>
|
||||||
{import.meta.env.VITE_ENV === "development" ? <div className={styles.button2} onClick={() => setIsUpdateModal(false)}>暂不更新</div> : null}
|
{storage.getItem('env') === "development" ? <div className={styles.button2} onClick={() => setIsUpdateModal(false)}>暂不更新</div> : null}
|
||||||
</div> : progress < 100 ?
|
</div> : progress < 100 ?
|
||||||
<div style={{ margin: '20px 0' }}>
|
<div style={{ margin: '20px 0' }}>
|
||||||
下载进度:{progress}%
|
下载进度:{progress}%
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ const Login: React.FC = () => {
|
||||||
<>
|
<>
|
||||||
<div className={styles.login}>
|
<div className={styles.login}>
|
||||||
<div className={styles.loginBg}>
|
<div className={styles.loginBg}>
|
||||||
<img src={import.meta.env.VITE_ENV === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" />
|
<img src={storage.getItem('env') === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.loginContent}>
|
<div className={styles.loginContent}>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ export const agora = {
|
||||||
if (settingData.darkLightEnhancement) agora.setLowlightEnhanceOptions(settingData.darkLightEnhancement.isDarkLightEnhancement, settingData.darkLightEnhancement)
|
if (settingData.darkLightEnhancement) agora.setLowlightEnhanceOptions(settingData.darkLightEnhancement.isDarkLightEnhancement, settingData.darkLightEnhancement)
|
||||||
if (settingData.virtualBackground) {
|
if (settingData.virtualBackground) {
|
||||||
if (typeof settingData.virtualBackground.sourceIndex === 'number') {
|
if (typeof settingData.virtualBackground.sourceIndex === 'number') {
|
||||||
if (import.meta.env.VITE_ENV === 'development') {
|
if (storage.getItem('env') === 'development') {
|
||||||
window.electron.getAppPath().then((res: string) => {
|
window.electron.getAppPath().then((res: string) => {
|
||||||
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${settingData.virtualBackground.sourceIndex + 1}.png`);
|
const imagePath = path.join(res, 'src', 'assets', 'virtualBackground', `${settingData.virtualBackground.sourceIndex + 1}.png`);
|
||||||
agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, {
|
agora.enableVirtualBackground(settingData.virtualBackground.isVirtualBackground, {
|
||||||
|
|
|
||||||
|
|
@ -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(import.meta.env.VITE_ENV)}/latest.yml`).then(res => {
|
axios.get(`${getUpdateUrl(storage.getItem('env') as string)}/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 => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import { AxiosRequestConfig, AxiosResponse } from 'axios'
|
import { AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||||
import Request from './request'
|
import Request from './request'
|
||||||
import { constant } from '@/config'
|
import { constant } from '@/config'
|
||||||
|
import storage from '../package/storage'
|
||||||
// 实例化
|
// 实例化
|
||||||
const req = new Request({
|
const req = new Request({
|
||||||
baseURL: import.meta.env.VITE_BASE_URL_API,
|
baseURL: storage.getItem('env') === 'development' ? 'http://192.168.2.9:5192' : 'https://meeting-api.23544.com/pc',
|
||||||
timeout: constant.CONFIG_REQUEST_TIMEOUT_TIME as number,
|
timeout: constant.CONFIG_REQUEST_TIMEOUT_TIME as number,
|
||||||
interceptors: {
|
interceptors: {
|
||||||
// 请求拦截器
|
// 请求拦截器
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue