如果账号已在其他地方登录,弹窗是否强制登录&全员观看-活跃用户
This commit is contained in:
parent
32d238fb7f
commit
67682defa8
52
src/App.tsx
52
src/App.tsx
|
|
@ -8,11 +8,11 @@ import Login from '@/page/Login/index'
|
||||||
import Meeting from '@/page/Meeting/index'
|
import Meeting from '@/page/Meeting/index'
|
||||||
import NotFound from '@/page/NotFound/index'
|
import NotFound from '@/page/NotFound/index'
|
||||||
import { storage } from '@/utils'
|
import { storage } from '@/utils'
|
||||||
import { message, Spin } from "antd";
|
import { message, Modal, Spin } from "antd";
|
||||||
import JoinMeetingModal from "@/components/JoinMeetingModal";
|
import JoinMeetingModal from "@/components/JoinMeetingModal";
|
||||||
import UpdateModal from "@/components/UpdateModal";
|
import UpdateModal from "@/components/UpdateModal";
|
||||||
import * as CryptoJS from 'crypto-js';
|
import * as CryptoJS from 'crypto-js';
|
||||||
import { PostLogin } from "@/api/Login";
|
import { GetCheckOnline, PostLogin } from "@/api/Login";
|
||||||
import { agora } from "@/utils/package/agora";
|
import { agora } from "@/utils/package/agora";
|
||||||
import QuitTips from "@/components/QuitTips";
|
import QuitTips from "@/components/QuitTips";
|
||||||
import { GetLeave } from "@/api/Meeting";
|
import { GetLeave } from "@/api/Meeting";
|
||||||
|
|
@ -22,6 +22,8 @@ import ChatSmallWindow from "@/page/Meeting/ChatSmallWindow";
|
||||||
import ChatBigWindow from "@/page/Meeting/ChatBigWindow";
|
import ChatBigWindow from "@/page/Meeting/ChatBigWindow";
|
||||||
import NoticeWindow from "@/page/Meeting/NoticeWindow";
|
import NoticeWindow from "@/page/Meeting/NoticeWindow";
|
||||||
import { getKeyOpenChildWindow, getTitle, setKeyOpenChildWindow, storageSeeting } from "./utils/package/public";
|
import { getKeyOpenChildWindow, getTitle, setKeyOpenChildWindow, storageSeeting } from "./utils/package/public";
|
||||||
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
|
const { confirm } = Modal;
|
||||||
const fs = require('fs').promises;
|
const fs = require('fs').promises;
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
|
|
@ -41,20 +43,44 @@ const App: React.FC = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let userInfo = JSON.parse(storage.getItem('user') as string)
|
let userInfo = JSON.parse(storage.getItem('user') as string)
|
||||||
let loginInfo = JSON.parse(storage.getItem('login') as string)
|
let loginInfo = JSON.parse(storage.getItem('login') as string)
|
||||||
|
const login = () => {
|
||||||
|
PostLogin({
|
||||||
|
account: loginInfo.account,
|
||||||
|
pwd: CryptoJS.MD5(loginInfo.password).toString(CryptoJS.enc.Hex)
|
||||||
|
}).then(async (res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
storage.setItem('user', JSON.stringify(res.data))
|
||||||
|
storage.setItem('userLogin', true)
|
||||||
|
toSrc('/home')
|
||||||
|
await window.electron.startSignalr(res.data)
|
||||||
|
} else {
|
||||||
|
toSrc('/login')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
window.electron.setEnv(import.meta.env.VITE_ENV);
|
window.electron.setEnv(import.meta.env.VITE_ENV);
|
||||||
if (userInfo && !userInfo.isAnonymous) {
|
if (userInfo && !userInfo.isAnonymous) {
|
||||||
if (loginInfo && loginInfo.isAutoLogin) {
|
if (loginInfo && loginInfo.isAutoLogin) {
|
||||||
PostLogin({
|
GetCheckOnline(loginInfo.account).then(req => {
|
||||||
account: loginInfo.account,
|
if (req.code === 200) {
|
||||||
pwd: CryptoJS.MD5(loginInfo.password).toString(CryptoJS.enc.Hex)
|
if (req.data) {
|
||||||
}).then(async (res) => {
|
confirm({
|
||||||
if (res.code === 200) {
|
title: '提示',
|
||||||
storage.setItem('user', JSON.stringify(res.data))
|
icon: <ExclamationCircleFilled />,
|
||||||
storage.setItem('userLogin', true)
|
content: `账号已在其他地方登录,是否强制登陆?`,
|
||||||
toSrc('/home')
|
centered: true,
|
||||||
await window.electron.startSignalr(res.data)
|
okText: '确定',
|
||||||
} else {
|
cancelText: '取消',
|
||||||
toSrc('/login')
|
async onOk() {
|
||||||
|
login()
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
login()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,10 @@ export const PostAnonLogin = (data: any) =>
|
||||||
url: `/auth/anon-login`,
|
url: `/auth/anon-login`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data,
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const GetCheckOnline = (account: string) =>
|
||||||
|
request({
|
||||||
|
url: `/auth/check-online?account=${account}`,
|
||||||
|
method: 'get'
|
||||||
})
|
})
|
||||||
|
|
@ -133,9 +133,11 @@ const StupWizard = forwardRef((_props: any, ref: any) => {
|
||||||
})
|
})
|
||||||
const CurrencyComponents = () => {
|
const CurrencyComponents = () => {
|
||||||
const [optionsValue, setOperationValue] = useState<'hide' | 'quit'>('hide');
|
const [optionsValue, setOperationValue] = useState<'hide' | 'quit'>('hide');
|
||||||
|
const [voiceStimulation, setVoiceStimulation] = useState(true);
|
||||||
const setting = JSON.parse(storage.getItem('setting') as string)
|
const setting = JSON.parse(storage.getItem('setting') as string)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOperationValue(setting.closeSetting)
|
setOperationValue(setting.closeSetting)
|
||||||
|
setVoiceStimulation(setting.voiceStimulation)
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -154,6 +156,33 @@ const CurrencyComponents = () => {
|
||||||
<Radio value={'hide'}>不退出程序,最小化到托盘</Radio>
|
<Radio value={'hide'}>不退出程序,最小化到托盘</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>语音激励 <Popover
|
||||||
|
content={
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
color: 'white'
|
||||||
|
}}>
|
||||||
|
开启语音激励后,会优先显示正在说话的与会成员。
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
title=""
|
||||||
|
>
|
||||||
|
<QuestionCircleOutlined style={{
|
||||||
|
color: 'white',
|
||||||
|
cursor: 'pointer',
|
||||||
|
marginRight: '10px'
|
||||||
|
}} />
|
||||||
|
</Popover></span>
|
||||||
|
<Radio.Group onChange={(e: any) => {
|
||||||
|
setting.voiceStimulation = e.target.value;
|
||||||
|
storage.setItem('setting', JSON.stringify(setting))
|
||||||
|
setVoiceStimulation(e.target.value)
|
||||||
|
}} style={{ flexShrink: 0, margin: '10px 0' }} value={voiceStimulation}>
|
||||||
|
<Radio value={true}>开启</Radio>
|
||||||
|
<Radio value={false}>关闭</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@ import { useEffect, useState } from "react";
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Input, Button, Checkbox, message, Modal } from "antd"
|
import { Input, Button, Checkbox, message, Modal } from "antd"
|
||||||
import { storage } from '@/utils'
|
import { storage } from '@/utils'
|
||||||
import { GetCheckUser, PostAnonLogin, PostLogin } from '@/api/Login'
|
import { GetCheckOnline, GetCheckUser, PostAnonLogin, PostLogin } from '@/api/Login'
|
||||||
import * as CryptoJS from 'crypto-js';
|
import * as CryptoJS from 'crypto-js';
|
||||||
import ImageUrl from '@/utils/package/imageUrl'
|
import ImageUrl from '@/utils/package/imageUrl'
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { GetCheckoutRoomNum, GetRoomInfo, GetRoomRtcToken } from '@/api/Home/Index';
|
import { GetCheckoutRoomNum, GetRoomInfo, GetRoomRtcToken } from '@/api/Home/Index';
|
||||||
|
import { ExclamationCircleFilled } from '@ant-design/icons';
|
||||||
|
const { confirm } = Modal;
|
||||||
const Login: React.FC = () => {
|
const Login: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [accountPasswordStatus, setAccountPasswordStatus] = useState<boolean>(false);
|
const [accountPasswordStatus, setAccountPasswordStatus] = useState<boolean>(false);
|
||||||
|
|
@ -100,7 +102,32 @@ const Login: React.FC = () => {
|
||||||
}
|
}
|
||||||
GetCheckUser(operation.account).then(res => {
|
GetCheckUser(operation.account).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
res.data ? setAccountPasswordStatus(true) : message.error('账号不存在!')
|
if (res.data) {
|
||||||
|
GetCheckOnline(operation.account).then(req => {
|
||||||
|
if (req.code === 200) {
|
||||||
|
if (req.data) {
|
||||||
|
confirm({
|
||||||
|
title: '提示',
|
||||||
|
icon: <ExclamationCircleFilled />,
|
||||||
|
content: `账号已在其他地方登录,是否强制登陆?`,
|
||||||
|
centered: true,
|
||||||
|
okText: '确定',
|
||||||
|
cancelText: '取消',
|
||||||
|
async onOk() {
|
||||||
|
setAccountPasswordStatus(true)
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
setAccountPasswordStatus(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
message.error('账号不存在!')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,10 @@ export const agora = {
|
||||||
},
|
},
|
||||||
// 监测到远端最活跃用户回调。
|
// 监测到远端最活跃用户回调。
|
||||||
onActiveSpeaker: (connection: RtcConnection, uid: number) => {
|
onActiveSpeaker: (connection: RtcConnection, uid: number) => {
|
||||||
onActiveSpeaker?.(connection, uid)
|
const setting = JSON.parse(storage.getItem('setting') as string);
|
||||||
|
if (setting.voiceStimulation) {
|
||||||
|
onActiveSpeaker?.(connection, uid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ export const storageSeeting: any = {
|
||||||
shareFilesPath: path.resolve(__dirname, '../../Downloads/') + '\\', //共享文件保存路径
|
shareFilesPath: path.resolve(__dirname, '../../Downloads/') + '\\', //共享文件保存路径
|
||||||
isShareSavePath: true, //是否下载钱询问每个文件保存的位置
|
isShareSavePath: true, //是否下载钱询问每个文件保存的位置
|
||||||
closeSetting: 'hide', //关闭按钮设置
|
closeSetting: 'hide', //关闭按钮设置
|
||||||
|
voiceStimulation: true, //语音激励
|
||||||
isAINoiseReduction: true, //是否开启ai降噪
|
isAINoiseReduction: true, //是否开启ai降噪
|
||||||
aINoiseReduction: 1, // 降噪模式
|
aINoiseReduction: 1, // 降噪模式
|
||||||
isRecordingTips: true, //是否开启录制提示
|
isRecordingTips: true, //是否开启录制提示
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue