From 4be821137d7eb6af4ffeef400d413e638d8052ac Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Mon, 25 Nov 2024 20:02:50 +0800 Subject: [PATCH] feat: eslint --- napcat.webui/src/App.vue | 37 +- napcat.webui/src/backend/shell.ts | 2 +- napcat.webui/src/components/Dashboard.vue | 7 +- napcat.webui/src/components/QQLogin.vue | 10 +- napcat.webui/src/components/WebUiLogin.vue | 4 +- napcat.webui/src/components/webui/Nav.vue | 26 +- napcat.webui/src/pages/NetWork.vue | 335 ++++++++++-------- napcat.webui/src/pages/OtherConfig.vue | 12 +- .../src/pages/network/HttpClientComponent.vue | 19 +- .../src/pages/network/HttpServerComponent.vue | 19 +- .../network/WebsocketClientComponent.vue | 17 +- .../network/WebsocketServerComponent.vue | 16 +- napcat.webui/src/ts/event-bus.ts | 2 +- 13 files changed, 273 insertions(+), 233 deletions(-) diff --git a/napcat.webui/src/App.vue b/napcat.webui/src/App.vue index 0d46f1f7..b9fb5e52 100644 --- a/napcat.webui/src/App.vue +++ b/napcat.webui/src/App.vue @@ -3,20 +3,15 @@
- - - + + + - - + + - - + +
@@ -40,11 +35,11 @@ enum ThemeMode { Auto = 'auto', } const themeLabelMap: Record = { - '浅色': ThemeMode.Light, - '深色': ThemeMode.Dark, - '自动': ThemeMode.Auto, + 浅色: ThemeMode.Light, + 深色: ThemeMode.Dark, + 自动: ThemeMode.Auto, }; -const show = ref(true) +const show = ref(true); const createSetThemeAttributeFunction = () => { let mediaQueryForAutoTheme: MediaQueryList | null = null; return (mode: ThemeMode | null) => { @@ -64,9 +59,9 @@ const createSetThemeAttributeFunction = () => { }; mediaQueryForAutoTheme.addEventListener('change', handleMediaChange); const event = new Event('change'); - Object.defineProperty(event,'matches', { + Object.defineProperty(event, 'matches', { value: mediaQueryForAutoTheme.matches, - writable: false + writable: false, }); mediaQueryForAutoTheme.dispatchEvent(event); onBeforeUnmount(() => { @@ -107,13 +102,11 @@ const haddingFbars = () => { }; onMounted(() => { initTheme(); - haddingFbars() + haddingFbars(); window.addEventListener('resize', haddingFbars); }); onUnmounted(() => { window.removeEventListener('resize', haddingFbars); }); - + diff --git a/napcat.webui/src/backend/shell.ts b/napcat.webui/src/backend/shell.ts index 0819e0b8..16c69eb1 100644 --- a/napcat.webui/src/backend/shell.ts +++ b/napcat.webui/src/backend/shell.ts @@ -74,7 +74,7 @@ export class QQLoginManager { } return false; } - public async checkQQLoginStatusWithQrcode(): Promise<{ qrcodeurl: string, isLogin: string } | undefined> { + public async checkQQLoginStatusWithQrcode(): Promise<{ qrcodeurl: string; isLogin: string } | undefined> { try { const QQLoginResponse = await fetch(`${this.apiPrefix}/QQLogin/CheckLoginStatus`, { method: 'POST', diff --git a/napcat.webui/src/components/Dashboard.vue b/napcat.webui/src/components/Dashboard.vue index 3f36a20d..f8870cdd 100644 --- a/napcat.webui/src/components/Dashboard.vue +++ b/napcat.webui/src/components/Dashboard.vue @@ -20,7 +20,6 @@ interface MenuItem { route: string; } - const menuItems = ref([ { value: 'item1', icon: 'dashboard', label: '基础信息', route: '/dashboard/basic-info' }, { value: 'item3', icon: 'wifi-1', label: '网络配置', route: '/dashboard/network-config' }, @@ -28,9 +27,9 @@ const menuItems = ref([ { value: 'item5', icon: 'system-log', label: '日志查看', route: '/dashboard/log-view' }, { value: 'item6', icon: 'info-circle', label: '关于我们', route: '/dashboard/about-us' }, ]); -const menuRef=ref(null) +const menuRef = ref(null); emitter.on('sendMenu', (event) => { - emitter.emit('sendWidth',menuRef.value.offsetWidth); + emitter.emit('sendWidth', menuRef.value.offsetWidth); localStorage.setItem('menuWidth', menuRef.value.offsetWidth); }); onMounted(() => { @@ -39,7 +38,6 @@ onMounted(() => { diff --git a/napcat.webui/src/pages/network/HttpClientComponent.vue b/napcat.webui/src/pages/network/HttpClientComponent.vue index 7d275b90..901baa44 100644 --- a/napcat.webui/src/pages/network/HttpClientComponent.vue +++ b/napcat.webui/src/pages/network/HttpClientComponent.vue @@ -4,7 +4,7 @@ - + @@ -33,16 +33,17 @@ const props = defineProps<{ const messageFormatOptions = ref([ { label: 'Array', value: 'array' }, - { label: 'String', value: 'string' } + { label: 'String', value: 'string' }, ]); -watch(() => props.config.messagePostFormat, (newValue) => { - if (newValue !== 'array' && newValue !== 'string') { - props.config.messagePostFormat = 'array'; +watch( + () => props.config.messagePostFormat, + (newValue) => { + if (newValue !== 'array' && newValue !== 'string') { + props.config.messagePostFormat = 'array'; + } } -}); +); - + diff --git a/napcat.webui/src/pages/network/HttpServerComponent.vue b/napcat.webui/src/pages/network/HttpServerComponent.vue index 607e528d..9988bcc0 100644 --- a/napcat.webui/src/pages/network/HttpServerComponent.vue +++ b/napcat.webui/src/pages/network/HttpServerComponent.vue @@ -1,7 +1,7 @@