优化Socket消息

This commit is contained in:
zjl 2024-12-19 09:33:30 +08:00
parent de591ede38
commit b61840fa9f
3 changed files with 34 additions and 27 deletions

View File

@ -19,11 +19,12 @@
import dayjs from 'dayjs';
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'));
import 'dayjs/locale/zh-cn';
dayjs.locale('zh-cn');
/**
* 定义参数
*/
const route = useRoute();
const locale = zhCN;
const useLockscreen = useLockscreenStore();
@ -32,8 +33,12 @@
const isLock = computed(() => useLockscreen.isLock);
const lockTime = computed(() => useLockscreen.lockTime);
const { getIsWaterMark } = useProjectSetting();
const GlobalWebsocket = defineAsyncComponent(() => import('@/components/Websocket/index.vue'));
let timer;
/**
* 定义锁屏
*/
const timekeeping = () => {
clearInterval(timer);
if (route.name == 'login' || isLock.value) return;
@ -51,19 +56,26 @@
}
}, 1000);
};
/**
* 通知回调
*/
const rollback = (msg) => {
notification.info({
message: '通知',
description: () =>
h('div', msg),
description: () => h('div', msg),
});
}
};
/**
* 钩子函数
*/
onMounted(() => {
if (getIsWaterMark.value) {
const waterText = import.meta.env.VITE_GLOB_APP_TITLE;
Watermark.set(waterText)
Watermark.set(waterText);
} else {
Watermark.del()
Watermark.del();
}
// document.addEventListener('mousedown', timekeeping);
});

View File

@ -139,7 +139,7 @@
DownloadOutlined,
UploadOutlined,
PrinterOutlined,
CommentOutlined
CommentOutlined,
} from '@ant-design/icons-vue';
import { useForm } from '@/components/Form/index';
import {

View File

@ -1,10 +1,5 @@
<template>
<a-modal
v-model:visible="props.visible"
title="发送消息"
width="800px"
@cancel="dialogClose"
>
<a-modal v-model:visible="props.visible" title="发送消息" width="800px" @cancel="dialogClose">
<a-form :model="formData" :label-col="{ style: { width: '10-0px' } }" ref="formRef">
<a-form-item
label="消息内容"