Compare commits
2 Commits
426a065197
...
ceab393f37
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ceab393f37 | ||
58ee0eb3e3 |
23
src/App.vue
23
src/App.vue
@ -27,34 +27,29 @@
|
|||||||
:y-offset="60"
|
:y-offset="60"
|
||||||
:rotate="-15"
|
:rotate="-15"
|
||||||
/>
|
/>
|
||||||
<global-websocket :uri="'/api/websocket/' + userInfo.id" @rollback="rollback" />
|
|
||||||
</NConfigProvider>
|
</NConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, onUnmounted, defineAsyncComponent, h } from 'vue';
|
import { computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { darkTheme, dateZhCN, zhCN } from 'naive-ui';
|
import { darkTheme, dateZhCN, zhCN } from 'naive-ui';
|
||||||
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 { useUserStore } from '@/store/modules/user';
|
|
||||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||||
import { initWebSocket, sendWebSocket } from '@/components/Websocket/index';
|
|
||||||
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
|
||||||
import { lighten } from '@/utils';
|
import { lighten } from '@/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义参数
|
||||||
|
*/
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const useLockscreen = useLockscreenStore();
|
const useLockscreen = useLockscreenStore();
|
||||||
const designStore = useDesignSettingStore();
|
const designStore = useDesignSettingStore();
|
||||||
const userStore = useUserStore();
|
|
||||||
const userInfo: object = userStore.getUserInfo || {};
|
|
||||||
const isLock = computed(() => useLockscreen.isLock);
|
const isLock = computed(() => useLockscreen.isLock);
|
||||||
const lockTime = computed(() => useLockscreen.lockTime);
|
const lockTime = computed(() => useLockscreen.lockTime);
|
||||||
|
|
||||||
const proName = import.meta.env.VITE_GLOB_APP_TITLE;
|
const proName = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||||
|
|
||||||
const { getIsWaterMark } = useProjectSetting();
|
const { getIsWaterMark } = useProjectSetting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,14 +95,10 @@
|
|||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
const rollback = (msg) => {
|
|
||||||
$notification.info({
|
|
||||||
title: '通知',
|
|
||||||
content: () => h('div', msg),
|
|
||||||
duration: 5000,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钩子函数
|
||||||
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// document.addEventListener('mousedown', timekeeping);
|
// document.addEventListener('mousedown', timekeeping);
|
||||||
});
|
});
|
||||||
|
@ -71,18 +71,22 @@
|
|||||||
</n-icon>
|
</n-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, defineAsyncComponent, h } from 'vue';
|
||||||
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';
|
||||||
import { AsideMenu } from './components/Menu';
|
import { AsideMenu } from './components/Menu';
|
||||||
import { PageHeader } from './components/Header';
|
import { PageHeader } from './components/Header';
|
||||||
import { PageFooter } from './components/Footer';
|
import { PageFooter } from './components/Footer';
|
||||||
|
import { useUserStore } from '@/store/modules/user';
|
||||||
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 { useNotification } from 'naive-ui';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
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';
|
||||||
@ -90,7 +94,12 @@
|
|||||||
import { SettingOutlined } from '@vicons/antd';
|
import { SettingOutlined } from '@vicons/antd';
|
||||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义参数
|
||||||
|
*/
|
||||||
|
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
||||||
const { getDarkTheme } = useDesignSetting();
|
const { getDarkTheme } = useDesignSetting();
|
||||||
|
const notification = useNotification();
|
||||||
const {
|
const {
|
||||||
getNavMode,
|
getNavMode,
|
||||||
getNavTheme,
|
getNavTheme,
|
||||||
@ -99,22 +108,23 @@
|
|||||||
getMultiTabsSetting,
|
getMultiTabsSetting,
|
||||||
getIsProjectSetting,
|
getIsProjectSetting,
|
||||||
} = useProjectSetting();
|
} = useProjectSetting();
|
||||||
|
|
||||||
const settingStore = useProjectSettingStore();
|
const settingStore = useProjectSettingStore();
|
||||||
const designStore = useDesignSettingStore();
|
const designStore = useDesignSettingStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userInfo: object = userStore.getUserInfo || {};
|
||||||
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<MaybeElement>();
|
const adminBodyRef = ref<MaybeElement>();
|
||||||
|
|
||||||
const { isFullscreen, toggle } = useFullscreen(adminBodyRef);
|
const { isFullscreen, toggle } = useFullscreen(adminBodyRef);
|
||||||
|
|
||||||
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) => {
|
||||||
@ -207,6 +217,21 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息通知回调
|
||||||
|
* @param msg 消息
|
||||||
|
*/
|
||||||
|
const rollback = (msg) => {
|
||||||
|
notification.info({
|
||||||
|
title: '通知',
|
||||||
|
content: () => h('div', msg),
|
||||||
|
duration: 5000,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钩子函数
|
||||||
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('resize', watchWidth);
|
window.addEventListener('resize', watchWidth);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user