feat: 根据eslint 对项目进行规范化处理

This commit is contained in:
piexlMax(奇淼
2024-11-09 10:17:57 +08:00
parent fae6f413a5
commit 87a4ce17e1
26 changed files with 51 additions and 117 deletions
-1
View File
@@ -209,7 +209,6 @@ const downloadFile = (row) => {
if (row.url.indexOf('http://') > -1 || row.url.indexOf('https://') > -1) {
downloadImage(row.url, row.name)
} else {
debugger
downloadImage(path.value + '/' + row.url, row.name)
}
}
+1 -1
View File
@@ -303,7 +303,7 @@ const onSubmit = async() => {
router.push({ name: 'Login' })
}
loading.close()
} catch (err) {
} catch (_) {
loading.close()
}
}
+3 -3
View File
@@ -21,13 +21,13 @@
<script setup>
import AsideComponent from "@/view/layout/aside/asideComponent/index.vue";
import { ref, provide, watchEffect, computed } from "vue";
import { ref, provide, watchEffect } from "vue";
import { useRoute, useRouter } from "vue-router";
import { useRouterStore } from "@/pinia/modules/router";
import { useAppStore } from "@/pinia";
import { storeToRefs } from "pinia";
const appStore = useAppStore();
const { device, config } = storeToRefs(appStore);
const { device } = storeToRefs(appStore);
defineOptions({
name: "GvaAside",
@@ -51,7 +51,7 @@ watchEffect(() => {
provide("isCollapse", isCollapse);
const selectMenuItem = (index, _, ele, aaa) => {
const selectMenuItem = (index) => {
const query = {};
const params = {};
routerStore.routeMap[index]?.parameters &&
+1 -1
View File
@@ -78,7 +78,7 @@ watchEffect(() => {
provide("isCollapse", isCollapse);
const selectMenuItem = (index, _, ele, aaa) => {
const selectMenuItem = (index) => {
const query = {};
const params = {};
routerStore.routeMap[index]?.parameters &&
+1 -1
View File
@@ -249,7 +249,7 @@ watch(() => contextMenuVisible.value, () => {
}
})
watch(() => route, (to, now) => {
watch(() => route, (to) => {
if (to.name === 'Login' || to.name === 'Reload') {
return
}
+1 -2
View File
@@ -818,7 +818,6 @@ const enterDialog = async() => {
}
break
default:
// eslint-disable-next-line no-lone-blocks
{
ElMessage({
type: 'error',
@@ -873,7 +872,7 @@ const apiCompletion = async () =>{
}
}
})
} catch (e) {
} catch (_) {
ElMessage({
type: 'error',
message: 'AI自动填充失败,请重新生成'
@@ -31,7 +31,7 @@
:filter-node-method="filterNode"
@check="nodeChange"
>
<template #default="{ node, data }">
<template #default="{ _, data }">
<div class="flex items-center justify-between w-full pr-1">
<span>{{ data.description }} </span>
<el-tooltip
@@ -101,7 +101,7 @@ const initCascader = (value) => {
}
// 编辑的时候,根据路径判断是选择框还是输入框
if (pathInfo[`/src/${value}` || pathInfo[value]]) {
if (pathInfo[`/src/${value}`]) {
activeComponent.value = value.split('/').filter(Boolean);
tempPath.value = ''
pathIsSelect.value = true
@@ -291,7 +291,7 @@ const deleteSysOperationRecordFunc = async(row) => {
const fmtBody = (value) => {
try {
return JSON.parse(value)
} catch (err) {
} catch (_) {
return value
}
}
+1 -1
View File
@@ -155,7 +155,7 @@ import {
} from '@/api/sysParams'
// 全量引入格式化工具 请按需保留
import { getDictFunc, formatDate, formatBoolean, filterDict ,filterDataSource, returnArrImg, onDownloadFile } from '@/utils/format'
import { formatDate } from '@/utils/format'
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, reactive } from 'vue'
+22 -69
View File
@@ -15,38 +15,23 @@
<div>
<el-row :gutter="10">
<el-col :span="12">os:</el-col>
<el-col
:span="12"
v-text="state.os.goos"
/>
<el-col :span="12">{{ state.os.goos }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">cpu nums:</el-col>
<el-col
:span="12"
v-text="state.os.numCpu"
/>
<el-col :span="12">{{ state.os.numCpu }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">compiler:</el-col>
<el-col
:span="12"
v-text="state.os.compiler"
/>
<el-col :span="12">{{ state.os.compiler }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">go version:</el-col>
<el-col
:span="12"
v-text="state.os.goVersion"
/>
<el-col :span="12">{{ state.os.goVersion }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">goroutine nums:</el-col>
<el-col
:span="12"
v-text="state.os.numGoroutine"
/>
<el-col :span="12">{{ state.os.numGoroutine }}</el-col>
</el-row>
</div>
</el-card>
@@ -68,41 +53,25 @@
style="margin-bottom: 2rem"
>
<el-col :span="12">
<el-row :gutter="10">
<el-col :span="12">MountPoint</el-col>
<el-col
:span="12"
v-text="item.mountPoint"
/>
<el-col :span="12">{{ item.mountPoint }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">total (MB)</el-col>
<el-col
:span="12"
v-text="item.totalMb"
/>
<el-col :span="12">{{ item.totalMb }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">used (MB)</el-col>
<el-col
:span="12"
v-text="item.usedMb"
/>
<el-col :span="12">{{ item.usedMb }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">total (GB)</el-col>
<el-col
:span="12"
v-text="item.totalGb"
/>
<el-col :span="12">{{ item.totalGb }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">used (GB)</el-col>
<el-col
:span="12"
v-text="item.usedGb"
/>
<el-col :span="12">{{ item.usedGb }}</el-col>
</el-row>
</el-col>
<el-col :span="12">
@@ -133,10 +102,7 @@
<div>
<el-row :gutter="10">
<el-col :span="12">physical number of cores:</el-col>
<el-col
:span="12"
v-text="state.cpu.cores"
/>
<el-col :span="12">{{ state.cpu.cores }}</el-col>
</el-row>
<el-row
v-for="(item, index) in state.cpu.cpus"
@@ -144,13 +110,13 @@
:gutter="10"
>
<el-col :span="12">core {{ index }}:</el-col>
<el-col
:span="12"
><el-progress
type="line"
:percentage="+item.toFixed(0)"
:color="colors"
/></el-col>
<el-col :span="12">
<el-progress
type="line"
:percentage="+item.toFixed(0)"
:color="colors"
/>
</el-col>
</el-row>
</div>
</el-card>
@@ -168,31 +134,19 @@
<el-col :span="12">
<el-row :gutter="10">
<el-col :span="12">total (MB)</el-col>
<el-col
:span="12"
v-text="state.ram.totalMb"
/>
<el-col :span="12">{{ state.ram.totalMb }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">used (MB)</el-col>
<el-col
:span="12"
v-text="state.ram.usedMb"
/>
<el-col :span="12">{{ state.ram.usedMb }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">total (GB)</el-col>
<el-col
:span="12"
v-text="state.ram.totalMb / 1024"
/>
<el-col :span="12">{{ state.ram.totalMb / 1024 }}</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">used (GB)</el-col>
<el-col
:span="12"
v-text="(state.ram.usedMb / 1024).toFixed(2)"
/>
<el-col :span="12">{{ (state.ram.usedMb / 1024).toFixed(2) }}</el-col>
</el-row>
</el-col>
<el-col :span="12">
@@ -209,7 +163,6 @@
</el-row>
</div>
</template>
<script setup>
import { getSystemState } from '@/api/system'
import { onUnmounted, ref } from 'vue'
@@ -72,7 +72,7 @@ onMounted(() => {
const marked = new Marked(
markedHighlight({
langPrefix: 'hljs language-',
highlight(code, lang, info) {
highlight(code, lang) {
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
if (lang === 'vue') {
return hljs.highlight(code, { language: 'html' }).value;
+1 -1
View File
@@ -1484,7 +1484,7 @@ const importJson = (file) =>{
try {
form.value = JSON.parse(e.target.result)
ElMessage.success('JSON 文件导入成功')
} catch (error) {
} catch (_) {
ElMessage.error('无效的 JSON 文件')
}
}
@@ -245,7 +245,6 @@ import { ElMessage, ElMessageBox } from "element-plus";
import { ref } from "vue";
import { formatDate } from "@/utils/format";
import { toUpperCase } from "@/utils/stringFun"
import {useAppStore} from "@/pinia";
import { VAceEditor } from "vue3-ace-editor"
import 'ace-builds/src-noconflict/mode-javascript';
@@ -253,8 +252,6 @@ import 'ace-builds/src-noconflict/mode-golang';
import 'ace-builds/src-noconflict/theme-github_dark';
const appStore = useAppStore()
defineOptions({
name: "AutoCodeAdmin",
});
@@ -515,7 +512,7 @@ const aiAddFunc = async () =>{
const routerArr = aiData.router.split("/")
autoFunc.value.router = routerArr[routerArr.length - 1]
autoFunc.value.funcDesc = autoFunc.value.prompt
} catch (e) {
} catch (_) {
ElMessage.error("小淼忙碌,请重新调用")
}
}
@@ -535,7 +532,7 @@ const autoComplete = async () =>{
autoFunc.value.funcName = aiData.funcName
autoFunc.value.router = aiData.router
autoFunc.value.prompt = autoFunc.value.funcDesc
} catch (e) {
} catch (_) {
ElMessage.error("小淼开小差了,请重新调用")
}
}
@@ -928,7 +928,6 @@ const openDialog = () => {
const closeDialog = () => {
codeVisible.value = false
dialogFormVisible.value = false
activeRow.value = {}
formData.value = {
name: '',
tableName: '',
@@ -945,7 +944,7 @@ const enterDialog = async() => {
// 判断 formData.templateInfo 是否为标准json格式 如果不是标准json 则辅助调整
try {
JSON.parse(formData.value.templateInfo)
} catch (error) {
} catch (_) {
ElMessage({
type: 'error',
message: '模板信息格式不正确,请检查'
+1 -3
View File
@@ -220,8 +220,7 @@
<el-form-item label="是否开启zap日志">
<el-switch v-model="config.mongo['is-zap']"/>
</el-form-item>
<template v-for="(item,k) in config.mongo.hosts">
<el-form-item :label="`节点 ${k+1}`">
<el-form-item v-for="(item,k) in config.mongo.hosts" :key="k" :label="`节点 ${k+1}`">
<div v-for="(_,k2) in item" :key="k2">
<el-form-item :key="k+k2" :label="k2" label-width="60">
<el-input v-model.trim="item[k2]" :placeholder="k2 === 'host' ? '请输入地址' : '请输入端口'"/>
@@ -231,7 +230,6 @@
<el-button type="danger" size="small" plain :icon="Minus" @click="removeNode(k)" class="ml-3"/>
</el-form-item>
</el-form-item>
</template>
<el-form-item>
<el-button type="primary" size="small" plain :icon="Plus" @click="addNode"/>
</el-form-item>