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) { export function listAccessTrend(days: number) {
return axios.get<DashboardAccessTrendRecord[]>( return axios.get<DashboardAccessTrendRecord[]>(
`${BASE_URL}/access/trend/${days}` `${BASE_URL}/access/trend/${days}`,
); );
} }
export function listPopularModule() { export function listPopularModule() {
return axios.get<DashboardPopularModuleRecord[]>( return axios.get<DashboardPopularModuleRecord[]>(
`${BASE_URL}/popular/module` `${BASE_URL}/popular/module`,
); );
} }
export function getGeoDistribution() { export function getGeoDistribution() {
return axios.get<DashboardGeoDistributionRecord>( 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) { export function listFieldConfig(tableName: string, requireSync: boolean) {
return axios.get<FieldConfigRecord[]>( 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; const { requiresAuth, activeMenu, hideInMenu } = newRoute.meta;
if (requiresAuth && (!hideInMenu || activeMenu)) { if (requiresAuth && (!hideInMenu || activeMenu)) {
const menuOpenKeys = findMenuOpenKeys( const menuOpenKeys = findMenuOpenKeys(
(activeMenu || newRoute.name) as string (activeMenu || newRoute.name) as string,
); );
const keySet = new Set([...menuOpenKeys, ...openKeys.value]); const keySet = new Set([...menuOpenKeys, ...openKeys.value]);
@ -97,7 +97,9 @@
const icon = element?.meta?.icon const icon = element?.meta?.icon
? () => ? () =>
h( h(
compile(`<svg-icon icon-class="${element?.meta?.icon}"/>`) compile(
`<svg-icon icon-class="${element?.meta?.icon}"/>`,
),
) )
: null; : null;
const node = const node =

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ type TargetContext = '_self' | '_parent' | '_blank' | '_top';
export const openWindow = ( export const openWindow = (
url: string, url: string,
opts?: { target?: TargetContext; [key: string]: any } opts?: { target?: TargetContext; [key: string]: any },
) => { ) => {
const { target = '_blank', ...others } = opts || {}; const { target = '_blank', ...others } = opts || {};
window.open( window.open(
@ -13,13 +13,13 @@ export const openWindow = (
const [key, value] = curValue; const [key, value] = curValue;
return [...preValue, `${key}=${value}`]; return [...preValue, `${key}=${value}`];
}, []) }, [])
.join(',') .join(','),
); );
}; };
export const regexUrl = new RegExp( 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]*)?$', '^(?!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; export default null;

View File

@ -27,6 +27,6 @@ export default function checkPermission(value: Array<string>) {
return hasPermission || hasRole; return hasPermission || hasRole;
} }
throw new Error( 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"> <span class="tooltip-value">
${el.value} ${el.value}
</span> </span>
</div>` </div>`,
) )
.join(''); .join('');
}; };

View File

@ -7,7 +7,9 @@
> >
<a-carousel-item v-for="(src, idx) in imageSrc" :key="idx"> <a-carousel-item v-for="(src, idx) in imageSrc" :key="idx">
<div style="padding: 10px 30px 15px"> <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" /> <img :src="src" style="width: 100%" alt="QrCode" />
<div style="text-align: center">扫码加VX备注 cnadmin 进群</div> <div style="text-align: center">扫码加VX备注 cnadmin 进群</div>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -378,7 +378,7 @@
*/ */
const handleSelectionChange = (rowKeys: Array<any>) => { const handleSelectionChange = (rowKeys: Array<any>) => {
const unReadMessageList = dataList.value.filter( 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; readMultiple.value = !unReadMessageList.length;
ids.value = rowKeys; ids.value = rowKeys;

View File

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

View File

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

View File

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