推送消息
This commit is contained in:
parent
426a065197
commit
58ee0eb3e3
15
src/App.vue
15
src/App.vue
@ -27,29 +27,23 @@
|
|||||||
: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);
|
||||||
|
|
||||||
@ -100,13 +94,6 @@
|
|||||||
}
|
}
|
||||||
}, 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,26 +71,32 @@
|
|||||||
</n-icon>
|
</n-icon>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<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';
|
||||||
import { MaybeElement, useFullscreen } from '@vueuse/core';
|
import { MaybeElement, useFullscreen } from '@vueuse/core';
|
||||||
import { SettingOutlined } from '@vicons/antd';
|
import { SettingOutlined } from '@vicons/antd';
|
||||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||||
|
import { initWebSocket } from '@/components/Websocket/index';
|
||||||
|
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
|
||||||
|
|
||||||
const { getDarkTheme } = useDesignSetting();
|
const { getDarkTheme } = useDesignSetting();
|
||||||
|
const notification = useNotification();
|
||||||
const {
|
const {
|
||||||
getNavMode,
|
getNavMode,
|
||||||
getNavTheme,
|
getNavTheme,
|
||||||
@ -102,6 +108,8 @@
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -206,6 +214,13 @@
|
|||||||
collapsed.value = true;
|
collapsed.value = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
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