版本预发布

This commit is contained in:
孟帅
2023-02-08 20:29:34 +08:00
parent f11c7c5bf2
commit 2068d05c93
269 changed files with 16122 additions and 12075 deletions

View File

@@ -1,5 +1,7 @@
import { Ref, UnwrapRef } from '@vue/reactivity';
import onerrorImg from '@/assets/images/onerror.png';
import { NTag, SelectRenderTag } from 'naive-ui';
import { h } from 'vue';
export interface Option {
label: string;
@@ -42,9 +44,9 @@ export function getOptionTag(options: Option[], value) {
}
// 自适应模板宽度
export function adaModalWidth(dialogWidth: Ref<UnwrapRef<string>>) {
export function adaModalWidth(dialogWidth: Ref<UnwrapRef<string>>, def = 840) {
const val = document.body.clientWidth;
const def = 840; // 默认宽度
if (val <= def) {
dialogWidth.value = '100%';
} else {
@@ -58,3 +60,27 @@ export function errorImg(e: any): void {
e.target.src = onerrorImg;
e.target.onerror = null;
}
export const renderTag: SelectRenderTag = ({ option }) => {
return h(
NTag,
{
type: option.listClass as 'success' | 'warning' | 'error' | 'info' | 'primary' | 'default',
},
{ default: () => option.label }
);
};
export function timeFix() {
const time = new Date();
const hour = time.getHours();
return hour < 9
? '早上好'
: hour <= 11
? '上午好'
: hour <= 13
? '中午好'
: hour < 20
? '下午好'
: '晚上好';
}

View File

@@ -2,6 +2,8 @@ import { SocketEnum } from '@/enums/socketEnum';
import { notificationStoreWidthOut } from '@/store/modules/notification';
import { useUserStoreWidthOut } from '@/store/modules/user';
import { TABS_ROUTES } from '@/store/mutation-types';
import { MessageRow } from '@/enums/systemMessageEnum';
import { isJsonString } from '@/utils/is';
let socket: WebSocket;
let isActive: boolean;
@@ -133,6 +135,11 @@ export default (onMessage: Function) => {
// console.log('WebSocket:收到一条消息', event.data);
let isHeart = false;
if (!isJsonString(event.data)) {
console.log('socket message incorrect format:' + JSON.stringify(event));
return;
}
const message = JSON.parse(event.data);
if (message.event === 'ping') {
isHeart = true;
@@ -150,7 +157,7 @@ export default (onMessage: Function) => {
// 通知
if (message.event === 'notice') {
notificationStore.addMessages(event.data);
notificationStore.triggerNewMessages(message.data);
return;
}