This commit is contained in:
孟帅
2023-02-23 17:53:04 +08:00
parent 7cf1b8ce8e
commit 61d0988d2c
402 changed files with 18340 additions and 35547 deletions

17
web/src/utils/icons.ts Normal file
View File

@@ -0,0 +1,17 @@
import { Component } from 'vue';
import { renderIcon } from '@/utils/index';
import * as antdIcons from '@vicons/antd';
// import * as x5Icons from '@vicons/ionicons5';
export const Icons = {};
for (const element of Object.keys(antdIcons)) {
Icons[element] = renderIcon(antdIcons[element]);
}
// for (const element of Object.keys(x5Icons)) {
// constantRouterIcon[element] = renderIcon(x5Icons[element]);
// }
export function getIconComponent(name: string): Component {
return Icons[name];
}

View File

@@ -15,8 +15,8 @@ export const renderTooltip = (trigger, content) => {
/**
* render 图标
* */
export function renderIcon(icon) {
return () => h(NIcon, null, { default: () => h(icon) });
export function renderIcon(icon, props = null) {
return () => h(NIcon, props, { default: () => h(icon) });
}
/**

View File

@@ -138,3 +138,7 @@ export function isNullOrUnDef(val: unknown): val is null | undefined {
export function isLetterBegin(str) {
return /^[A-z]/.test(str);
}
export function isUrl(url: string): boolean {
return /(^http|https:\/\/)/g.test(url);
}

View File

@@ -2,7 +2,6 @@ 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;
@@ -103,7 +102,7 @@ export default (onMessage: Function) => {
if (useUserStore.token === '') {
throw new Error('用户未登录,稍后重试...');
}
socket = new WebSocket(useUserStore.config.wsAddr + '?authorization=' + useUserStore.token);
socket = new WebSocket(useUserStore.config?.wsAddr + '?authorization=' + useUserStore.token);
init();
} catch (e) {
console.log('createSocket err:' + e);