|
|
|
@ -12,6 +12,8 @@ import { appCache } from '../../../Common/AppCache';
|
|
|
|
|
import { userConfig } from '../../../Editor/UserConfig';
|
|
|
|
|
import { app } from '../../../ApplicationServices/Application';
|
|
|
|
|
import { AppToaster } from '../Toaster';
|
|
|
|
|
import { AppConfirm } from '../Common/Confirm';
|
|
|
|
|
import { FileServer } from '../../../DatabaseServices/FileServer';
|
|
|
|
|
|
|
|
|
|
interface ILoginState
|
|
|
|
|
{
|
|
|
|
@ -53,7 +55,8 @@ export default class Login extends React.Component<{ store?: TopPanelStore; }, I
|
|
|
|
|
handleLogin = async () =>
|
|
|
|
|
{
|
|
|
|
|
if (this.isLoginIng) return;
|
|
|
|
|
if (!this.state.user_name.trim() || !this.state.pass_word.trim())
|
|
|
|
|
let userName = this.state.user_name.trim();
|
|
|
|
|
if (!userName || !this.state.pass_word.trim())
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "用户名和密码不能为空",
|
|
|
|
@ -63,6 +66,26 @@ export default class Login extends React.Component<{ store?: TopPanelStore; }, I
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let oldName = localStorage.getItem(StoreageKeys.UserName);
|
|
|
|
|
let oldPhone = localStorage.getItem(StoreageKeys.UserPhone);
|
|
|
|
|
if (oldName !== userName && oldPhone !== userName)
|
|
|
|
|
{
|
|
|
|
|
// 切换账号
|
|
|
|
|
if (!app.Saved)
|
|
|
|
|
{
|
|
|
|
|
let status = await AppConfirm.show({
|
|
|
|
|
message: "图纸还未保存,切换账号将清空图纸,确定切换?"
|
|
|
|
|
});
|
|
|
|
|
if (status)
|
|
|
|
|
{
|
|
|
|
|
app.Saved = true;
|
|
|
|
|
let server = FileServer.GetInstance() as FileServer;
|
|
|
|
|
await server.AddNewFile();
|
|
|
|
|
}
|
|
|
|
|
else return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.isLoginIng = true;
|
|
|
|
|
let data = await PostJson(SignUrl.login, this.state);
|
|
|
|
|
if (data.err_code === RequestStatus.Ok)
|
|
|
|
|