优化更新
This commit is contained in:
parent
1e3107d0e2
commit
ed2c39e7fc
|
|
@ -1,17 +1,17 @@
|
|||
{
|
||||
"name": "WGShare.Metting",
|
||||
"version": "0.4.8",
|
||||
"version": "0.7.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "WGShare.Metting",
|
||||
"version": "0.4.8",
|
||||
"version": "0.7.1",
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.3.7",
|
||||
"@microsoft/signalr": "^8.0.0",
|
||||
"@types/node": "^20.14.9",
|
||||
"agora-electron-sdk": "^4.4.0",
|
||||
"agora-electron-sdk": "4.4.0",
|
||||
"animate.css": "^4.1.1",
|
||||
"antd": "^5.18.2",
|
||||
"axios": "^1.7.2",
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
"dayjs": "^1.11.11",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"electron-updater": "^6.2.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"os": "^0.1.2",
|
||||
"path": "^0.12.7",
|
||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "WGShare.Metting",
|
||||
"private": true,
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.0",
|
||||
"main": "main.js",
|
||||
"authors": "yj",
|
||||
"description": "智汇享",
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
"dayjs": "^1.11.11",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"electron-updater": "^6.2.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"os": "^0.1.2",
|
||||
"path": "^0.12.7",
|
||||
"postcss-px-to-viewport-8-plugin": "^1.2.5",
|
||||
|
|
@ -58,4 +59,4 @@
|
|||
"vite": "^2.8.0",
|
||||
"vite-plugin-resolve": "^2.5.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import { GetSubDpList } from '@/api/Home/User';
|
|||
import FeedBackModel from '@/components/FeedBackModel';
|
||||
import { PostHomeVerLog } from '@/api/Meeting';
|
||||
import Code from '@/components/Code';
|
||||
import { isVersion } from "@/utils/package/public";
|
||||
|
||||
const { setInterval, clearInterval } = require('timers');
|
||||
const fs = require('fs').promises;
|
||||
const { exec } = require('child_process');
|
||||
|
|
@ -308,35 +310,43 @@ const Index: React.FC = () => {
|
|||
<Button type="primary"
|
||||
iconPosition={'end'}
|
||||
onClick={async () => {
|
||||
if (role.ID.includes(userInfo.roleId)) {
|
||||
joinSettingRef.current.changeModal(item.roomNum)
|
||||
} else {
|
||||
storage.setItem('loading', true)
|
||||
postRefresh(() => {
|
||||
getRoomRtcToken(item.roomNum, async (options: any) => {
|
||||
if (options) {
|
||||
await window.electron.getVersion().then(async req => {
|
||||
await PostHomeVerLog({
|
||||
version: req,
|
||||
platformType: 1,
|
||||
roomNum: item.roomNum,
|
||||
})
|
||||
})
|
||||
navigate(`/meeting`, {
|
||||
state: {
|
||||
channelId: item.roomNum,
|
||||
token: options.token,
|
||||
tokenA: options.tokenA,
|
||||
roomId: item.id,
|
||||
roomName: item.roomName,
|
||||
enableMicr: false,
|
||||
enableCamera: false,
|
||||
storage.setItem('loading', true)
|
||||
isVersion((bool: boolean) => {
|
||||
storage.setItem('loading', false)
|
||||
if (bool) {
|
||||
window.electron.onDownload('3')
|
||||
} else {
|
||||
if (role.ID.includes(userInfo.roleId)) {
|
||||
joinSettingRef.current.changeModal(item.roomNum)
|
||||
} else {
|
||||
storage.setItem('loading', true)
|
||||
postRefresh(() => {
|
||||
getRoomRtcToken(item.roomNum, async (options: any) => {
|
||||
if (options) {
|
||||
await window.electron.getVersion().then(async req => {
|
||||
await PostHomeVerLog({
|
||||
version: req,
|
||||
platformType: 1,
|
||||
roomNum: item.roomNum,
|
||||
})
|
||||
})
|
||||
navigate(`/meeting`, {
|
||||
state: {
|
||||
channelId: item.roomNum,
|
||||
token: options.token,
|
||||
tokenA: options.tokenA,
|
||||
roomId: item.id,
|
||||
roomName: item.roomName,
|
||||
enableMicr: false,
|
||||
enableCamera: false,
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}}
|
||||
icon={<img src={ImageUrl.icon9} alt="" />}
|
||||
className='m-ant-btn'>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import ImageUrl from '@/utils/package/imageUrl'
|
|||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { GetCheckoutRoomNum, GetRoomInfo, GetRoomRtcToken } from '@/api/Home/Index';
|
||||
import { ExclamationCircleFilled } from '@ant-design/icons';
|
||||
import { isVersion } from '@/utils/package/public';
|
||||
const { confirm } = Modal;
|
||||
const Login: React.FC = () => {
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -346,46 +347,54 @@ const Login: React.FC = () => {
|
|||
return message.error('参会昵称最多10个字!')
|
||||
}
|
||||
storage.setItem('loading', true)
|
||||
PostAnonLogin(anonInfo).then(async (res) => {
|
||||
if (res.code == 200) {
|
||||
storage.setItem('user', JSON.stringify(res.data))
|
||||
storage.setItem('userLogin', true)
|
||||
await window.electron.startSignalr(res.data)
|
||||
getRoomRtcToken(anonInfo.roomNum, (options: any) => {
|
||||
if (options) {
|
||||
GetRoomInfo(anonInfo.roomNum).then(async (res) => {
|
||||
if (res.code === 200) {
|
||||
setTimeout(() => {
|
||||
isVersion((bool: boolean) => {
|
||||
storage.setItem('loading', false)
|
||||
if (bool) {
|
||||
window.electron.onDownload('3')
|
||||
} else {
|
||||
storage.setItem('loading', true)
|
||||
PostAnonLogin(anonInfo).then(async (res) => {
|
||||
if (res.code == 200) {
|
||||
storage.setItem('user', JSON.stringify(res.data))
|
||||
storage.setItem('userLogin', true)
|
||||
await window.electron.startSignalr(res.data)
|
||||
getRoomRtcToken(anonInfo.roomNum, (options: any) => {
|
||||
if (options) {
|
||||
GetRoomInfo(anonInfo.roomNum).then(async (res) => {
|
||||
if (res.code === 200) {
|
||||
setTimeout(() => {
|
||||
storage.setItem('loading', false)
|
||||
window.electron.getWindowSize().then((res: any) => {
|
||||
window.electron.setMainWindowSize({
|
||||
width: Math.ceil(res.width / 1.5),
|
||||
height: Math.ceil(res.height / 1.3),
|
||||
})
|
||||
})
|
||||
navigate(`/meeting`, {
|
||||
state: {
|
||||
channelId: anonInfo.roomNum,
|
||||
token: options.token,
|
||||
tokenA: options.tokenA,
|
||||
roomId: res.data.id,
|
||||
roomName: res.data.roomName,
|
||||
enableMicr: false,
|
||||
enableCamera: false,
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
storage.setItem('loading', false)
|
||||
}
|
||||
}).catch(() => {
|
||||
storage.setItem('loading', false)
|
||||
window.electron.getWindowSize().then((res: any) => {
|
||||
window.electron.setMainWindowSize({
|
||||
width: Math.ceil(res.width / 1.5),
|
||||
height: Math.ceil(res.height / 1.3),
|
||||
})
|
||||
})
|
||||
navigate(`/meeting`, {
|
||||
state: {
|
||||
channelId: anonInfo.roomNum,
|
||||
token: options.token,
|
||||
tokenA: options.tokenA,
|
||||
roomId: res.data.id,
|
||||
roomName: res.data.roomName,
|
||||
enableMicr: false,
|
||||
enableCamera: false,
|
||||
}
|
||||
})
|
||||
}, 2000)
|
||||
} else {
|
||||
storage.setItem('loading', false)
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
storage.setItem('loading', false)
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
storage.setItem('loading', false)
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
storage.setItem('loading', false)
|
||||
})
|
||||
}}>进入</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
declare module 'react-dom/client';
|
||||
declare module 'crypto-js';
|
||||
declare module 'js-yaml';
|
||||
declare module 'uuid';
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
import path from "path";
|
||||
import storage from "./storage";
|
||||
import axios from "axios";
|
||||
import yaml from 'js-yaml'
|
||||
export const setKeyOpenChildWindow = async (key: string, bool: boolean) => {
|
||||
const openChildWindow = await JSON.parse(storage.getItem('openChildWindow') as string)
|
||||
openChildWindow[key] = bool;
|
||||
|
|
@ -71,4 +73,36 @@ export const getTitle = (env: string) => {
|
|||
default:
|
||||
return '智汇享'
|
||||
}
|
||||
}
|
||||
export const compareVersions = (version1: string, version2: string): number => {
|
||||
const v1Parts = version1.split('.').map(Number);
|
||||
const v2Parts = version2.split('.').map(Number);
|
||||
const maxLength = Math.max(v1Parts.length, v2Parts.length);
|
||||
for (let i = 0; i < maxLength; i++) {
|
||||
const v1 = v1Parts[i] || 0;
|
||||
const v2 = v2Parts[i] || 0;
|
||||
if (v1 > v2) {
|
||||
return 1;
|
||||
} else if (v1 < v2) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
export const isVersion = (callBack: Function) => {
|
||||
axios.get(import.meta.env.VITE_ENV !== 'development' ? 'https://meeting-api.23544.com/meeting/update' : 'http://192.168.2.9:8827/latest.yml').then(res => {
|
||||
if (res.status === 200 && res.data) {
|
||||
const data = yaml.load(res.data); // 解析 YAML 内容
|
||||
window.electron.getVersion().then(req => {
|
||||
if (compareVersions(data.version, req) === -1) {
|
||||
callBack(false)
|
||||
} else {
|
||||
callBack(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
callBack(true)
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue