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