fix: 修复前端控制台 eslint 告警

This commit is contained in:
Charles7c 2023-11-14 22:03:04 +08:00
parent abd4fb5368
commit f4523d2481
23 changed files with 41 additions and 43 deletions

View File

@ -44,19 +44,19 @@ export function getTotal() {
export function listAccessTrend(days: number) {
return axios.get<DashboardAccessTrendRecord[]>(
`${BASE_URL}/access/trend/${days}`
`${BASE_URL}/access/trend/${days}`,
);
}
export function listPopularModule() {
return axios.get<DashboardPopularModuleRecord[]>(
`${BASE_URL}/popular/module`
`${BASE_URL}/popular/module`,
);
}
export function getGeoDistribution() {
return axios.get<DashboardGeoDistributionRecord>(
`${BASE_URL}/geo/distribution`
`${BASE_URL}/geo/distribution`,
);
}

View File

@ -48,7 +48,7 @@ export interface FieldConfigRecord {
export function listFieldConfig(tableName: string, requireSync: boolean) {
return axios.get<FieldConfigRecord[]>(
`${BASE_URL}/field/${tableName}?requireSync=${requireSync}`
`${BASE_URL}/field/${tableName}?requireSync=${requireSync}`,
);
}

View File

@ -73,7 +73,7 @@
const { requiresAuth, activeMenu, hideInMenu } = newRoute.meta;
if (requiresAuth && (!hideInMenu || activeMenu)) {
const menuOpenKeys = findMenuOpenKeys(
(activeMenu || newRoute.name) as string
(activeMenu || newRoute.name) as string,
);
const keySet = new Set([...menuOpenKeys, ...openKeys.value]);
@ -97,7 +97,9 @@
const icon = element?.meta?.icon
? () =>
h(
compile(`<svg-icon icon-class="${element?.meta?.icon}"/>`)
compile(
`<svg-icon icon-class="${element?.meta?.icon}"/>`,
),
)
: null;
const node =

View File

@ -36,7 +36,7 @@ export default function useMenuTree() {
// route filter hideInMenu true
element.children = element.children.filter(
(x) => x.meta?.hideInMenu !== true
(x) => x.meta?.hideInMenu !== true,
);
// Associated child node

View File

@ -87,9 +87,8 @@
* @param type 消息类型
*/
const formatUnreadCount = (type: number) => {
const count = unreadCount.value?.details.find(
(item) => item.type === type
)?.count;
const count = unreadCount.value?.details.find((item) => item.type === type)
?.count;
return count && count !== 0 ? `(${count})` : '';
};

View File

@ -43,7 +43,7 @@
() => appStore.navbar,
() => {
affixRef.value.updatePosition();
}
},
);
listenerRouteChange((route: RouteLocationNormalized) => {
if (

View File

@ -92,7 +92,7 @@
(roleValue) => {
if (roleValue && !permission.accessRouter(route))
router.push({ name: 'notFound' });
}
},
);
const drawerVisible = ref(false);
const drawerCancel = () => {

View File

@ -4,7 +4,7 @@ import Female from '../assets/images/avatar/female.png';
export default function getAvatar(
avatar: string | undefined,
gender: number | undefined
gender: number | undefined,
) {
if (avatar) {
const baseUrl = import.meta.env.VITE_API_BASE_URL;

View File

@ -2,7 +2,7 @@ type TargetContext = '_self' | '_parent' | '_blank' | '_top';
export const openWindow = (
url: string,
opts?: { target?: TargetContext; [key: string]: any }
opts?: { target?: TargetContext; [key: string]: any },
) => {
const { target = '_blank', ...others } = opts || {};
window.open(
@ -13,13 +13,13 @@ export const openWindow = (
const [key, value] = curValue;
return [...preValue, `${key}=${value}`];
}, [])
.join(',')
.join(','),
);
};
export const regexUrl = new RegExp(
'^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
'i'
'i',
);
export default null;

View File

@ -27,6 +27,6 @@ export default function checkPermission(value: Array<string>) {
return hasPermission || hasRole;
}
throw new Error(
`need roles! Like v-permission="['admin','system:user:add']"`
`need roles! Like v-permission="['admin','system:user:add']"`,
);
}

View File

@ -48,7 +48,7 @@
<span class="tooltip-value">
${el.value}
</span>
</div>`
</div>`,
)
.join('');
};

View File

@ -7,7 +7,9 @@
>
<a-carousel-item v-for="(src, idx) in imageSrc" :key="idx">
<div style="padding: 10px 30px 15px">
<div style="margin-bottom: 5px; text-align: center">相互 (huá shuǐ) 交流 ( )</div>
<div style="margin-bottom: 5px; text-align: center"
>相互 (huá shuǐ) 交流 ( )</div
>
<img :src="src" style="width: 100%" alt="QrCode" />
<div style="text-align: center">扫码加VX备注 cnadmin 进群</div>
</div>

View File

@ -92,7 +92,7 @@
const { proxy } = getCurrentInstance() as any;
const { success_failure_status_enum } = proxy.useDict(
'success_failure_status_enum'
'success_failure_status_enum',
);
const loginLogList = ref<LoginLogRecord[]>([]);

View File

@ -69,7 +69,7 @@
<template #cell="{ record }">
<span :title="decodeURIComponent(record.requestUrl)">{{
record.requestUrl.match(
/(\w+):\/\/([^/:]+)(:\d*)?([^#|\?|\n]*)(\?.*)?/
/(\w+):\/\/([^/:]+)(:\d*)?([^#|\?|\n]*)(\?.*)?/,
)[4]
}}</span>
</template>

View File

@ -100,12 +100,7 @@
<script lang="ts" setup>
import { getCurrentInstance, ref, toRefs, reactive } from 'vue';
import {
DataRecord,
ListParam,
list,
kickout,
} from '@/api/monitor/online';
import { DataRecord, ListParam, list, kickout } from '@/api/monitor/online';
import { getToken } from '@/utils/auth';
import checkPermission from '@/utils/permission';

View File

@ -355,7 +355,7 @@
const { proxy } = getCurrentInstance() as any;
const { announcement_type, announcement_status_enum } = proxy.useDict(
'announcement_type',
'announcement_status_enum'
'announcement_status_enum',
);
const dataList = ref<DataRecord[]>([]);
@ -552,7 +552,7 @@
.download(
'/system/announcement/export',
{ ...queryParams.value },
'公告数据'
'公告数据',
)
.finally(() => {
exportLoading.value = false;

View File

@ -228,16 +228,16 @@
const res = await list(params);
dataList.value = res.data;
siteTitle.value = dataList.value.find(
(option) => option.code === 'site_title'
(option) => option.code === 'site_title',
);
siteCopyright.value = dataList.value.find(
(option) => option.code === 'site_copyright'
(option) => option.code === 'site_copyright',
);
siteLogo.value = dataList.value.find(
(option) => option.code === 'site_logo'
(option) => option.code === 'site_logo',
);
siteFavicon.value = dataList.value.find(
(option) => option.code === 'site_favicon'
(option) => option.code === 'site_favicon',
);
reset();
};
@ -262,7 +262,7 @@
code: item[0],
value: item[1],
};
}
},
);
save(optionList).then((res) => {
appStore.save(form.value);

View File

@ -524,7 +524,7 @@
record.children.forEach((r) => {
rowKeys.splice(
rowKeys.findIndex((key: number | undefined) => key === r.id),
1
1,
);
proxy.$refs.tableRef.select(r.id, false);
if (r.children) {

View File

@ -539,7 +539,7 @@
record.children.forEach((r) => {
rowKeys.splice(
rowKeys.findIndex((key: number | undefined) => key === r.id),
1
1,
);
proxy.$refs.tableRef.select(r.id, false);
if (r.children) {

View File

@ -378,7 +378,7 @@
*/
const handleSelectionChange = (rowKeys: Array<any>) => {
const unReadMessageList = dataList.value.filter(
(item) => rowKeys.indexOf(item.id) !== -1 && !item.isRead
(item) => rowKeys.indexOf(item.id) !== -1 && !item.isRead,
);
readMultiple.value = !unReadMessageList.length;
ids.value = rowKeys;

View File

@ -439,7 +439,7 @@
const { proxy } = getCurrentInstance() as any;
const { data_scope_enum, dis_enable_status_enum } = proxy.useDict(
'data_scope_enum',
'dis_enable_status_enum'
'dis_enable_status_enum',
);
const dataList = ref<DataRecord[]>([]);
@ -616,7 +616,7 @@
//
const halfCheckedNodes = proxy.$refs.menuRef.getHalfCheckedNodes();
const halfCheckedKeys = halfCheckedNodes.map(
(item: TreeNodeData) => item.key
(item: TreeNodeData) => item.key,
);
// eslint-disable-next-line prefer-spread
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
@ -637,7 +637,7 @@
//
const halfCheckedNodes = proxy.$refs.deptRef.getHalfCheckedNodes();
const halfCheckedKeys = halfCheckedNodes.map(
(item: TreeNodeData) => item.key
(item: TreeNodeData) => item.key,
);
// eslint-disable-next-line prefer-spread
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);

View File

@ -734,7 +734,7 @@
handleCancel();
getList();
proxy.$message.success(res.msg);
}
},
);
}
});

View File

@ -279,7 +279,7 @@
const { proxy } = getCurrentInstance() as any;
const { form_type_enum, query_type_Enum } = proxy.useDict(
'form_type_enum',
'query_type_Enum'
'query_type_Enum',
);
const tableList = ref<TableRecord[]>([]);
@ -337,7 +337,7 @@
*/
const toConfig = (tableName: string) => {
let tableComment = tableList.value.filter(
(t) => t.tableName === tableName
(t) => t.tableName === tableName,
)[0].comment;
tableComment = tableComment ? `${tableComment}` : ' ';
title.value = `${tableName}${tableComment}配置`;