chore: eslint

This commit is contained in:
pk5ls20 2024-11-17 03:35:20 +08:00
parent 3c10b82bab
commit cc73104d62
No known key found for this signature in database
GPG Key ID: 6370ED7A169F493A
10 changed files with 215 additions and 191 deletions

View File

@ -4,7 +4,7 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"webui:lint": "eslint . --fix", "webui:lint": "eslint --fix src/**/*.{js,ts,vue}",
"webui:dev": "vite", "webui:dev": "vite",
"webui:build": "vue-tsc -b && vite build", "webui:build": "vue-tsc -b && vite build",
"webui:preview": "vite preview" "webui:preview": "vite preview"

View File

@ -23,9 +23,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts"></script>
</script>
<style scoped> <style scoped>
.about-us { .about-us {

View File

@ -1,7 +1,14 @@
<template> <template>
<t-space class="full-space"> <t-space class="full-space">
<template v-if="clientPanelData.length > 0"> <template v-if="clientPanelData.length > 0">
<t-tabs v-model="activeTab" :addable="true" theme="card" @add="showAddTabDialog" @remove="removeTab" class="full-tabs"> <t-tabs
v-model="activeTab"
:addable="true"
theme="card"
@add="showAddTabDialog"
@remove="removeTab"
class="full-tabs"
>
<t-tab-panel <t-tab-panel
v-for="(config, idx) in clientPanelData" v-for="(config, idx) in clientPanelData"
:key="idx" :key="idx"
@ -12,7 +19,7 @@
> >
<component :is="resolveDynamicComponent(getComponent(config.key))" :config="config.data" /> <component :is="resolveDynamicComponent(getComponent(config.key))" :config="config.data" />
<div class="button-container"> <div class="button-container">
<t-button @click="saveConfig" style="width: 100px; height: 40px;">保存</t-button> <t-button @click="saveConfig" style="width: 100px; height: 40px">保存</t-button>
</div> </div>
</t-tab-panel> </t-tab-panel>
</t-tabs> </t-tabs>
@ -176,9 +183,9 @@
userConfig.network = config; userConfig.network = config;
const success = await setOB11Config(userConfig); const success = await setOB11Config(userConfig);
if (success) { if (success) {
MessagePlugin.success('配置保存成功'); await MessagePlugin.success('配置保存成功');
} else { } else {
MessagePlugin.error('配置保存失败'); await MessagePlugin.error('配置保存失败');
} }
}; };
@ -189,8 +196,8 @@
const addTab = async () => { const addTab = async () => {
const { name, type } = newTab.value; const { name, type } = newTab.value;
if (clientPanelData.some(panel => panel.name === name)) { if (clientPanelData.some((panel) => panel.name === name)) {
MessagePlugin.error('选项卡名称已存在'); await MessagePlugin.error('选项卡名称已存在');
return; return;
} }
const defaultConfig = structuredClone(defaultConfigs[type]); const defaultConfig = structuredClone(defaultConfigs[type]);
@ -199,7 +206,7 @@
isDialogVisible.value = false; isDialogVisible.value = false;
await nextTick(); await nextTick();
activeTab.value = clientPanelData.length - 1; activeTab.value = clientPanelData.length - 1;
MessagePlugin.success('选项卡添加成功'); await MessagePlugin.success('选项卡添加成功');
}; };
const removeTab = async (payload: { value: string; index: number; e: PointerEvent }) => { const removeTab = async (payload: { value: string; index: number; e: PointerEvent }) => {

View File

@ -36,14 +36,17 @@ const props = defineProps<{
const messageFormatOptions = ref([ const messageFormatOptions = ref([
{ label: 'Array', value: 'array' }, { label: 'Array', value: 'array' },
{ label: 'String', value: 'string' } { label: 'String', value: 'string' },
]); ]);
watch(() => props.config.messagePostFormat, (newValue) => { watch(
() => props.config.messagePostFormat,
(newValue) => {
if (newValue !== 'array' && newValue !== 'string') { if (newValue !== 'array' && newValue !== 'string') {
props.config.messagePostFormat = 'array'; props.config.messagePostFormat = 'array';
} }
}); }
);
</script> </script>
<style scoped> <style scoped>

View File

@ -42,14 +42,17 @@ const props = defineProps<{
const messageFormatOptions = ref([ const messageFormatOptions = ref([
{ label: 'Array', value: 'array' }, { label: 'Array', value: 'array' },
{ label: 'String', value: 'string' } { label: 'String', value: 'string' },
]); ]);
watch(() => props.config.messagePostFormat, (newValue) => { watch(
() => props.config.messagePostFormat,
(newValue) => {
if (newValue !== 'array' && newValue !== 'string') { if (newValue !== 'array' && newValue !== 'string') {
props.config.messagePostFormat = 'array'; props.config.messagePostFormat = 'array';
} }
}); }
);
</script> </script>
<style scoped> <style scoped>

View File

@ -39,14 +39,17 @@ const props = defineProps<{
const messageFormatOptions = ref([ const messageFormatOptions = ref([
{ label: 'Array', value: 'array' }, { label: 'Array', value: 'array' },
{ label: 'String', value: 'string' } { label: 'String', value: 'string' },
]); ]);
watch(() => props.config.messagePostFormat, (newValue) => { watch(
() => props.config.messagePostFormat,
(newValue) => {
if (newValue !== 'array' && newValue !== 'string') { if (newValue !== 'array' && newValue !== 'string') {
props.config.messagePostFormat = 'array'; props.config.messagePostFormat = 'array';
} }
}); }
);
</script> </script>
<style scoped> <style scoped>

View File

@ -45,14 +45,17 @@ const props = defineProps<{
const messageFormatOptions = ref([ const messageFormatOptions = ref([
{ label: 'Array', value: 'array' }, { label: 'Array', value: 'array' },
{ label: 'String', value: 'string' } { label: 'String', value: 'string' },
]); ]);
watch(() => props.config.messagePostFormat, (newValue) => { watch(
() => props.config.messagePostFormat,
(newValue) => {
if (newValue !== 'array' && newValue !== 'string') { if (newValue !== 'array' && newValue !== 'string') {
props.config.messagePostFormat = 'array'; props.config.messagePostFormat = 'array';
} }
}); }
);
</script> </script>
<style scoped> <style scoped>

View File

@ -1,6 +1,13 @@
<template> <template>
<t-space class="full-space"> <t-space class="full-space">
<t-tabs v-model="activeTab" :addable="true" theme="card" @add="showAddTabDialog" @remove="removeTab" class="full-tabs"> <t-tabs
v-model="activeTab"
:addable="true"
theme="card"
@add="showAddTabDialog"
@remove="removeTab"
class="full-tabs"
>
<t-tab-panel <t-tab-panel
v-for="(config, idx) in clientPanelData" v-for="(config, idx) in clientPanelData"
:key="idx" :key="idx"
@ -11,7 +18,7 @@
> >
<component :is="resolveDynamicComponent(getComponent(config.key))" :config="config.data" /> <component :is="resolveDynamicComponent(getComponent(config.key))" :config="config.data" />
<div class="button-container"> <div class="button-container">
<t-button @click="saveConfig" style="width: 100px; height: 40px;">保存</t-button> <t-button @click="saveConfig" style="width: 100px; height: 40px">保存</t-button>
</div> </div>
</t-tab-panel> </t-tab-panel>
</t-tabs> </t-tabs>
@ -183,7 +190,7 @@ const showAddTabDialog = () => {
const addTab = async () => { const addTab = async () => {
const { name, type } = newTab.value; const { name, type } = newTab.value;
if (clientPanelData.some(panel => panel.name === name)) { if (clientPanelData.some((panel) => panel.name === name)) {
MessagePlugin.error('选项卡名称已存在'); MessagePlugin.error('选项卡名称已存在');
return; return;
} }