loading页面添加返回按钮

This commit is contained in:
fangxiang 2022-03-17 19:14:51 +08:00
parent 82e3d1db1a
commit 1c76f64e93
5 changed files with 49 additions and 6 deletions

View File

@ -5,6 +5,7 @@
</div>
</template>
<script lang="ts">
import { SessionStorage, Cookies } from "quasar";
import { defineComponent } from "vue";
import { useI18n } from "vue-i18n";
import EventBus, { EventNamesDefine } from "src/common/EventBus";
@ -41,6 +42,12 @@ export default defineComponent({
document.body.classList.add("overflow-hidden");
(window as any).controlLogout = () => {
Cookies.remove("auto_login");
SessionStorage.clear();
window.location.reload();
};
return {};
},
});

View File

@ -419,4 +419,5 @@ export default {
"open file": "打开文件",
"remember password": "记住密码",
"auto login": "自动登录",
"back to login page": "返回登录页面",
};

View File

@ -88,6 +88,13 @@
<div class="text-h5">loading...</div>
</q-item-section>
</q-item>
<q-item v-show="show_back">
<q-item-section>
<a href="javascript:void(0);" OnClick="window.controlLogout()">
{{ $t("back to login page") }}
</a>
</q-item-section>
</q-item>
</q-list>
</q-page>
</q-page-container>
@ -147,6 +154,8 @@ export default defineComponent({
let show_right_tool_bar = ref(true);
let mouse_page_right_flag = ref(false);
const show_back = ref(true);
EventBus.getInstance().on(EventNamesDefine.WindowResize, () => {
const new_landspace = window.innerHeight < window.innerWidth;
if (landspace != new_landspace) {
@ -154,8 +163,17 @@ export default defineComponent({
}
});
EventBus.getInstance().on(EventNamesDefine.CurrentConnectDisconnect, () => {
show_back.value = false;
});
EventBus.getInstance().on(EventNamesDefine.CurrentConnectConnected, () => {
show_back.value = true;
});
return {
landspace,
show_back,
show_left_tool_bar,
show_right_tool_bar,
mouse_page_left_flag,

View File

@ -40,8 +40,15 @@ export default defineComponent({
EventBus.getInstance().on(EventNamesDefine.CurrentConnectDisconnect, () => {
$q.loading.show({
html: true,
message:
$t.t("network disconnect!") + $t.t("wait reconnection") + "...",
$t.t("network disconnect!") +
$t.t("wait reconnection") +
"..." +
"<br />" +
"<a href='javascript:void(0);' OnClick='window.controlLogout()'>" +
$t.t("back to login page") +
"</a>",
});
});

View File

@ -298,7 +298,6 @@
<script lang="ts">
import { defineComponent, ref, Ref, computed } from "vue";
import { Cookies } from "quasar";
import { useStore } from "src/store";
import GridSettingDialog from "src/components/GridSettingDialog.vue";
@ -317,7 +316,13 @@ import { Protocol } from "src/entities/WSProtocol";
import GlobalData from "src/common/GlobalData";
import { api } from "boot/axios";
import { HttpProtocol } from "src/entities/HttpProtocol";
import { SessionStorage, openURL, useQuasar, date as $date } from "quasar";
import {
SessionStorage,
Cookies,
openURL,
useQuasar,
date as $date,
} from "quasar";
import { useI18n } from "vue-i18n";
export default defineComponent({
@ -516,9 +521,14 @@ export default defineComponent({
window.location.reload();
},
logout() {
const w = window as any;
if (w.controlLogout && typeof w.controlLogout == "function") {
w.controlLogout();
} else {
Cookies.remove("auto_login");
SessionStorage.clear();
window.location.reload();
}
},
async showDeviceInfo() {
try {