yangjie #49
|
|
@ -9,7 +9,9 @@
|
||||||
"dev": "concurrently \"electron .\" \"cross-env BROWSER=none vite\"",
|
"dev": "concurrently \"electron .\" \"cross-env BROWSER=none vite\"",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"build:electron": "vite build & electron-builder -w --config=./config/development.json"
|
"build:dev": "vite build & electron-builder -w --config=./config/development.json",
|
||||||
|
"build:prod": "vite build & electron-builder -w --config=./config/production.json",
|
||||||
|
"build:xy": "vite build & electron-builder -w --config=./config/xy.json"
|
||||||
},
|
},
|
||||||
"agora_electron": {
|
"agora_electron": {
|
||||||
"platform": "win32",
|
"platform": "win32",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ImageUrl from '@/utils/package/imageUrl';
|
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, useEffect } from "react";
|
||||||
import { storage } from '@/utils';
|
import { storage } from '@/utils';
|
||||||
const Code = forwardRef((props: any, ref: any) => {
|
const Code = forwardRef((props: any, ref: any) => {
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
|
|
@ -10,15 +10,19 @@ const Code = forwardRef((props: any, ref: any) => {
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
const [baseImage, setBaseImage] = useState('');
|
const [baseImage, setBaseImage] = useState('');
|
||||||
|
const [env, setEnv] = useState('')
|
||||||
const [roomNum, setRoomNum] = useState(props.roomNum);
|
const [roomNum, setRoomNum] = useState(props.roomNum);
|
||||||
|
useEffect(() => {
|
||||||
|
setEnv(storage.getItem('env') as string)
|
||||||
|
}, [])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Popover
|
<Popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
onOpenChange={(e: boolean) => {
|
onOpenChange={(e: boolean) => {
|
||||||
setBaseImage('')
|
setBaseImage('')
|
||||||
if (e) {
|
if (e && env) {
|
||||||
GetQrcode(roomNum, storage.getItem('env') === 'development' ? 'trial' : 'release').then(res => {
|
GetQrcode(roomNum, env === 'development' ? 'trial' : 'release').then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
setBaseImage(res.data)
|
setBaseImage(res.data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ 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';
|
||||||
import { forwardRef, useImperativeHandle, useState, memo } from "react";
|
import { forwardRef, useImperativeHandle, useState, memo, useEffect } from "react";
|
||||||
|
|
||||||
const UpdateModal = forwardRef((props: any, ref: any) => {
|
const UpdateModal = forwardRef((props: any, ref: any) => {
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
|
|
@ -42,10 +42,14 @@ const UpdateModal = forwardRef((props: any, ref: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
const [env, setEnv] = useState('')
|
||||||
const [isUpdateModal, setIsUpdateModal] = useState(false);
|
const [isUpdateModal, setIsUpdateModal] = useState(false);
|
||||||
const [progress, setProgress] = useState(0); // 下载进度值
|
const [progress, setProgress] = useState(0); // 下载进度值
|
||||||
const [updateContent, setUpdateContent] = useState('') // 版本更新内容
|
const [updateContent, setUpdateContent] = useState('') // 版本更新内容
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setEnv(storage.getItem('env') as string)
|
||||||
|
}, [])
|
||||||
function getContent() {
|
function getContent() {
|
||||||
fetch(`${getUpdateUrl()}/update.txt?t=${+new Date()}`) // 配置服务器地址
|
fetch(`${getUpdateUrl()}/update.txt?t=${+new Date()}`) // 配置服务器地址
|
||||||
.then(async response => {
|
.then(async response => {
|
||||||
|
|
@ -91,7 +95,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>
|
||||||
{storage.getItem('env') === "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> : progress < 100 ?
|
||||||
<div style={{ margin: '20px 0' }}>
|
<div style={{ margin: '20px 0' }}>
|
||||||
下载进度:{progress}%
|
下载进度:{progress}%
|
||||||
|
|
|
||||||
|
|
@ -203,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={env === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" />
|
{env ? <img src={env === 'xy' ? ImageUrl.icon53 : ImageUrl.icon1} alt="" /> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.loginContent}>
|
<div className={styles.loginContent}>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ export const storageSeeting: any = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getUpdateUrl = () => {
|
export const getUpdateUrl = () => {
|
||||||
switch (storage.getItem('env')) {
|
let env = storage.getItem('env');
|
||||||
|
switch (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':
|
||||||
|
|
@ -69,7 +70,8 @@ export const getUpdateUrl = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const getTitle = () => {
|
export const getTitle = () => {
|
||||||
switch (storage.getItem('env')) {
|
let env = storage.getItem('env');
|
||||||
|
switch (env) {
|
||||||
case 'xy':
|
case 'xy':
|
||||||
return '湖北襄阳四中教研平台'
|
return '湖北襄阳四中教研平台'
|
||||||
case 'development':
|
case 'development':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue