mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 02:46:45 +08:00
提交
This commit is contained in:
77
src/App.vue
77
src/App.vue
@@ -1,30 +1,32 @@
|
||||
<template>
|
||||
<div id="container" v-if="!isLogin">
|
||||
<nav-top/>
|
||||
<div style="display: flex">
|
||||
<nav-left/>
|
||||
<div style="flex: 1; display: flex; flex-direction: column; width: 0">
|
||||
<open-pages/>
|
||||
<bread-crumb/>
|
||||
<main>
|
||||
<a-config-provider :locale="zhCN">
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive :include="isInclude">
|
||||
<component :is="Component"/>
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</a-config-provider>
|
||||
</main>
|
||||
<a-config-provider :locale="locale">
|
||||
<div id="container" v-if="!isLogin">
|
||||
<nav-top />
|
||||
<div style="display: flex">
|
||||
<nav-left />
|
||||
<div style="flex: 1; display: flex; flex-direction: column; width: 0">
|
||||
<open-pages />
|
||||
<bread-crumb />
|
||||
<main>
|
||||
<a-config-provider :locale="zhCN">
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive :include="isInclude">
|
||||
<component :is="Component" />
|
||||
</keep-alive>
|
||||
</router-view>
|
||||
</a-config-provider>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="container" v-if="isLogin">
|
||||
<router-view/>
|
||||
</div>
|
||||
<div id="container" v-if="isLogin">
|
||||
<router-view />
|
||||
</div>
|
||||
</a-config-provider>
|
||||
</template>
|
||||
<script setup>
|
||||
import {ref, onMounted,computed} from "vue";
|
||||
import {useStore, createStore} from "vuex";
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { useStore, createStore } from "vuex";
|
||||
import NavLeft from "@/components/NavLeft";
|
||||
import NavTop from "@/components/NavTop";
|
||||
import OpenPages from "@/components/OpenPages";
|
||||
@@ -32,44 +34,45 @@ import BreadCrumb from "@/components/BreadCrumb";
|
||||
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
||||
import * as api1 from "@/api/index1";
|
||||
import * as api2 from "@/api/index";
|
||||
import {request} from "@/api/request";
|
||||
import {USER_PERMISSION, VALIDATE_TOKEN} from "@/api/apis";
|
||||
import { request } from "@/api/request";
|
||||
import { USER_PERMISSION, VALIDATE_TOKEN } from "@/api/apis";
|
||||
import dayjs from "dayjs";
|
||||
import "dayjs/locale/zh-cn";
|
||||
import locale from "ant-design-vue/es/date-picker/locale/zh_CN";
|
||||
|
||||
dayjs.locale("zh-cn");
|
||||
|
||||
const store = useStore();
|
||||
const isLogin = ref(false);
|
||||
const isInclude = computed(()=>store.state.isInclude)
|
||||
const isInclude = computed(() => store.state.isInclude);
|
||||
console.log("版本3.3.2------------");
|
||||
|
||||
|
||||
// 监听关闭浏览器
|
||||
let time1 = ref(0);
|
||||
let time2 = ref(0);
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('beforeunload', e => beforeunloadHandler(e));
|
||||
window.addEventListener('unload', e => unloadHandler(e));
|
||||
})
|
||||
window.addEventListener("beforeunload", (e) => beforeunloadHandler(e));
|
||||
window.addEventListener("unload", (e) => unloadHandler(e));
|
||||
});
|
||||
|
||||
//添加监听事件
|
||||
function beforeunloadHandler() {
|
||||
time1.value = new Date().getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function unloadHandler() {
|
||||
time2.value = new Date().getTime() - time1.value;
|
||||
if (time2.value <= 5) {
|
||||
store.replaceState(createStore({state: {openpages: null}}).state);
|
||||
store.replaceState(createStore({ state: { openpages: null } }).state);
|
||||
localStorage.removeItem("openpages");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="scss">
|
||||
#app {
|
||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
||||
Microsoft YaHei, Arial, sans-serif;
|
||||
Microsoft YaHei, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: #2c3e50;
|
||||
@@ -84,7 +87,9 @@ function unloadHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) > td {
|
||||
.ant-table-tbody
|
||||
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
||||
> td {
|
||||
background: #f6f9fd;
|
||||
}
|
||||
}
|
||||
@@ -168,4 +173,4 @@ function unloadHandler() {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user