修复点击登录按钮后不会立即进入loading模式的BUG

PAD隐藏
This commit is contained in:
fangxiang 2022-07-22 14:50:12 +08:00
parent da9f6928b8
commit f9316f01e7
3 changed files with 134 additions and 122 deletions

View File

@ -318,4 +318,6 @@ export default {
http: "Http",
control: "Control",
"restart now": "Restart Now",
_SOFT_PAD_LOGIN_TITLE_: "LEDPLAYER",
welcome: "Welcome",
};

View File

@ -11,7 +11,7 @@
class="full-height text-h4 text-white text-center text-weight-bold"
style="position: fixed; writing-mode: vertical-lr; left: 56.5%"
>
<span> {{ $t("welcome") }}{{ $t("login") }} </span>
<span> {{ $t("welcome") }}{{ $t(" ") }}{{ $t("login") }} </span>
</div>
<div
v-if="landspace"
@ -46,7 +46,7 @@
<q-card-section class="fit">
<q-form ref="login_form" @submit="onSubmit" @reset="onReset">
<q-list class="fit text-h6">
<q-item>
<q-item v-if="$store.state.advanced_debug">
<q-item-section>
<q-input
:autofocus="!data.ip_address"
@ -256,6 +256,7 @@ import EventBus, { EventNamesDefine } from "src/common/EventBus";
import { useStore } from "src/store";
import { Md5 } from "ts-md5/dist/md5";
import Initializer from "src/common/Initializer";
import { api } from "src/boot/axios";
class _Data {
user_name: string | null = null;
@ -349,7 +350,6 @@ export default defineComponent({
}
if (remember_password.value) {
data.ip_address = Cookies.get("name") ?? data.ip_address;
data.user_name = Cookies.get("user_name") ?? data.user_name;
cache_password = Cookies.get("password");
if (
@ -383,15 +383,28 @@ export default defineComponent({
show_show_password,
full_screen,
async onSubmit() {
return new Promise((resolve) => {
data.loading = true;
return new Promise((resolve) => {
try {
let global_data = GlobalData.getInstance();
api
.get("/get_websocket_port")
.then((response) => {
let final_ws_port = GlobalData.kDefaultWebsocektPort;
if (response && typeof response.data != "undefined") {
if (typeof response.data != "number") {
const temp_port = parseInt(response.data);
if (!isNaN(temp_port) && temp_port != Infinity) {
final_ws_port = temp_port;
}
} else {
final_ws_port = response.data;
}
const url =
"ws://" +
data.ip_address +
":" +
GlobalData.kDefaultWebsocektPort.toString() +
final_ws_port.toString() +
GlobalData.kWebsocketResource;
web_socket = new ClientConnection(
url,
@ -439,7 +452,6 @@ export default defineComponent({
// TODO add self to setConnects
if (remember_password.value) {
{
Cookies.set("remember_password", JSON.stringify(true), {
expires: 15,
});
@ -450,9 +462,6 @@ export default defineComponent({
expires: 15,
}
);
Cookies.set("name", data.ip_address, {
expires: 15,
});
Cookies.set("user_name", data.user_name ?? "admin", {
expires: 15,
});
@ -465,7 +474,6 @@ export default defineComponent({
expires: 15,
}
);
}
} else {
Cookies.remove("remember_password");
Cookies.remove("auto_login");
@ -503,6 +511,12 @@ export default defineComponent({
resolve(true);
data.loading = false;
};
}
})
.catch(() => {
resolve(true);
data.loading = false;
});
} catch {
resolve(true);
data.loading = false;

View File

@ -314,8 +314,8 @@ export default defineComponent({
landspace,
is_pwa,
async onSubmit() {
return new Promise((resolve) => {
data.loading = true;
return new Promise((resolve) => {
try {
let global_data = GlobalData.getInstance();
api
@ -447,10 +447,6 @@ export default defineComponent({
.catch(() => {
resolve(true);
data.loading = false;
})
.finally(() => {
resolve(true);
data.loading = false;
});
} catch {
resolve(true);