Compare commits
2 Commits
e44bf151dd
...
03856c123a
Author | SHA1 | Date | |
---|---|---|---|
![]() |
03856c123a | ||
2f4dcd0a09 |
31
src/App.vue
31
src/App.vue
@ -5,40 +5,36 @@
|
||||
<transition v-if="isLock && $route.name !== LoginName" name="slide-up">
|
||||
<LockScreen />
|
||||
</transition>
|
||||
<global-websocket :uri="'/api/websocket/'+userInfo.id" @rollback="rollback" />
|
||||
</AppProvider>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, onMounted, onUnmounted, ref,defineAsyncComponent,h } from 'vue';
|
||||
import { ElConfigProvider,ElNotification } from 'element-plus';
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { ElConfigProvider, ElNotification } from 'element-plus';
|
||||
import { LockScreen } from '@/components/Lockscreen';
|
||||
import { AppProvider } from '@/components/Application';
|
||||
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { PageEnum } from '@/enums/pageEnum';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||
import Watermark from '@/utils/wartermark';
|
||||
import { initWebSocket,sendWebSocket } from '@/components/Websocket/index';
|
||||
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
||||
|
||||
/**
|
||||
* 定义参数
|
||||
*/
|
||||
const route = useRoute();
|
||||
const useLockscreen = useLockscreenStore();
|
||||
|
||||
const isLock = computed(() => useLockscreen.isLock);
|
||||
const lockTime = computed(() => useLockscreen.lockTime);
|
||||
|
||||
const zIndex = ref(3000);
|
||||
const { getIsWaterMark } = useProjectSetting();
|
||||
const LoginName = PageEnum.BASE_LOGIN_NAME;
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userInfo: object = userStore.getUserInfo || {};
|
||||
|
||||
let timer;
|
||||
|
||||
/**
|
||||
* 定义锁屏
|
||||
*/
|
||||
const timekeeping = () => {
|
||||
clearInterval(timer);
|
||||
if (route.name === LoginName || isLock.value) return;
|
||||
@ -57,14 +53,9 @@
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const rollback = (msg)=>{
|
||||
ElNotification({
|
||||
type: 'info',
|
||||
title: '通知',
|
||||
message: h('div', msg),
|
||||
duration: 5000,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
if (getIsWaterMark.value) {
|
||||
const waterText = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||
|
@ -55,7 +55,7 @@
|
||||
<div class="admin-layout-content-main">
|
||||
<div class="main-view" ref="adminBodyRef">
|
||||
<MainView />
|
||||
<PageFooter/>
|
||||
<PageFooter />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <el-back-top :right="100" /> -->
|
||||
@ -74,10 +74,13 @@
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 全局WebSocket通讯组件 -->
|
||||
<global-websocket :uri="'/api/websocket/' + userInfo.id" @rollback="rollback" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, unref, computed, onMounted, watch, provide } from 'vue';
|
||||
import { ref, unref, computed, onMounted, watch, provide, h, defineAsyncComponent } from 'vue';
|
||||
import { ElNotification } from 'element-plus';
|
||||
import { Logo } from './components/Logo';
|
||||
import { TabsView } from './components/TagsView';
|
||||
import { MainView } from './components/Main';
|
||||
@ -86,6 +89,7 @@
|
||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||
import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { useProjectSettingStore } from '@/store/modules/projectSetting';
|
||||
import ProjectSetting from './components/Header/ProjectSetting.vue';
|
||||
import { useFullscreen } from '@vueuse/core';
|
||||
@ -93,6 +97,10 @@
|
||||
import { SettingOutlined } from '@vicons/antd';
|
||||
import Sider from './components/Sider/Sider.vue';
|
||||
|
||||
/**
|
||||
* 定义参数
|
||||
*/
|
||||
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
||||
const { getDarkTheme } = useDesignSetting();
|
||||
const {
|
||||
getNavMode,
|
||||
@ -104,22 +112,23 @@
|
||||
getMultiTabsSetting,
|
||||
getIsProjectSetting,
|
||||
} = useProjectSetting();
|
||||
|
||||
const settingStore = useProjectSettingStore();
|
||||
const designStore = useDesignSettingStore();
|
||||
|
||||
const navMode = getNavMode;
|
||||
|
||||
const drawerSetting = ref();
|
||||
const collapsed = ref<boolean>(false);
|
||||
const adminBodyRef = ref<HTMLElement | null>(null);
|
||||
|
||||
const { isFullscreen, toggle } = useFullscreen(adminBodyRef);
|
||||
const userStore = useUserStore();
|
||||
const userInfo: object = userStore.getUserInfo || {};
|
||||
|
||||
provide('isPageFullScreen', isFullscreen);
|
||||
provide('collapsed', collapsed);
|
||||
provide('openSetting', openSetting);
|
||||
|
||||
/**
|
||||
* 侦听器
|
||||
*/
|
||||
watch(
|
||||
() => collapsed.value,
|
||||
(to) => {
|
||||
@ -224,6 +233,22 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 消息通知回调
|
||||
* @param msg 消息
|
||||
*/
|
||||
const rollback = (msg) => {
|
||||
ElNotification({
|
||||
type: 'info',
|
||||
title: '通知',
|
||||
message: h('div', msg),
|
||||
duration: 5000,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(() => {
|
||||
const { themeColorChange } = drawerSetting.value;
|
||||
themeColorChange('#165DFF');
|
||||
@ -422,7 +447,7 @@
|
||||
.el-menu {
|
||||
--el-menu-bg-color: #fff;
|
||||
--el-menu-text-color: rgb(51, 54, 57);
|
||||
--el-menu-hover-bg-color: #165DFF;
|
||||
--el-menu-hover-bg-color: #165dff;
|
||||
--el-menu-hover-text-color: #fff;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user