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