推送消息
This commit is contained in:
parent
426a065197
commit
58ee0eb3e3
15
src/App.vue
15
src/App.vue
@ -27,29 +27,23 @@
|
||||
:y-offset="60"
|
||||
:rotate="-15"
|
||||
/>
|
||||
<global-websocket :uri="'/api/websocket/' + userInfo.id" @rollback="rollback" />
|
||||
</NConfigProvider>
|
||||
</template>
|
||||
|
||||
<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 { LockScreen } from '@/components/Lockscreen';
|
||||
import { AppProvider } from '@/components/Application';
|
||||
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||
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';
|
||||
|
||||
const route = useRoute();
|
||||
const useLockscreen = useLockscreenStore();
|
||||
const designStore = useDesignSettingStore();
|
||||
const userStore = useUserStore();
|
||||
const userInfo: object = userStore.getUserInfo || {};
|
||||
const isLock = computed(() => useLockscreen.isLock);
|
||||
const lockTime = computed(() => useLockscreen.lockTime);
|
||||
|
||||
@ -100,13 +94,6 @@
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
const rollback = (msg) => {
|
||||
$notification.info({
|
||||
title: '通知',
|
||||
content: () => h('div', msg),
|
||||
duration: 5000,
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// document.addEventListener('mousedown', timekeeping);
|
||||
|
@ -71,26 +71,32 @@
|
||||
</n-icon>
|
||||
</div>
|
||||
</template>
|
||||
<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, defineAsyncComponent, h } from 'vue';
|
||||
import { Logo } from './components/Logo';
|
||||
import { TabsView } from './components/TagsView';
|
||||
import { MainView } from './components/Main';
|
||||
import { AsideMenu } from './components/Menu';
|
||||
import { PageHeader } from './components/Header';
|
||||
import { PageFooter } from './components/Footer';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||
import { useDesignSetting } from '@/hooks/setting/useDesignSetting';
|
||||
import { useNotification } from 'naive-ui';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useProjectSettingStore } from '@/store/modules/projectSetting';
|
||||
import ProjectSetting from './components/Header/ProjectSetting.vue';
|
||||
import { MaybeElement, useFullscreen } from '@vueuse/core';
|
||||
import { SettingOutlined } from '@vicons/antd';
|
||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||
import { initWebSocket } from '@/components/Websocket/index';
|
||||
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
||||
|
||||
const { getDarkTheme } = useDesignSetting();
|
||||
const notification = useNotification();
|
||||
const {
|
||||
getNavMode,
|
||||
getNavTheme,
|
||||
@ -102,6 +108,8 @@
|
||||
|
||||
const settingStore = useProjectSettingStore();
|
||||
const designStore = useDesignSettingStore();
|
||||
const userStore = useUserStore();
|
||||
const userInfo: object = userStore.getUserInfo || {};
|
||||
|
||||
const navMode = getNavMode;
|
||||
|
||||
@ -206,6 +214,13 @@
|
||||
collapsed.value = true;
|
||||
}
|
||||
};
|
||||
const rollback = (msg) => {
|
||||
notification.info({
|
||||
title: '通知',
|
||||
content: () => h('div', msg),
|
||||
duration: 5000,
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', watchWidth);
|
||||
|
Loading…
Reference in New Issue
Block a user