Skip to content

Commit

Permalink
fix: 修复前端控制台 eslint 告警
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Nov 14, 2023
1 parent abd4fb5 commit f4523d2
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 43 deletions.
6 changes: 3 additions & 3 deletions continew-admin-ui/src/api/common/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
);
}

Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/api/tool/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
);
}

Expand Down
6 changes: 4 additions & 2 deletions continew-admin-ui/src/components/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/components/menu/use-menu-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions continew-admin-ui/src/components/message-box/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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})` : '';
};
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/components/tab-bar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
() => appStore.navbar,
() => {
affixRef.value.updatePosition();
}
},
);
listenerRouteChange((route: RouteLocationNormalized) => {
if (
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/layout/default-layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
(roleValue) => {
if (roleValue && !permission.accessRouter(route))
router.push({ name: 'notFound' });
}
},
);
const drawerVisible = ref(false);
const drawerCancel = () => {
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/utils/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions continew-admin-ui/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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):https://)(?:\\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;
2 changes: 1 addition & 1 deletion continew-admin-ui/src/utils/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']"`,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<span class="tooltip-value">
${el.value}
</span>
</div>`
</div>`,
)
.join('');
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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ǐ) 交流 (mō yú)</div>
<div style="margin-bottom: 5px; text-align: center"
>相互 (huá shuǐ) 交流 (mō yú)</div
>
<img :src="src" style="width: 100%" alt="QrCode" />
<div style="text-align: center">扫码加VX,备注 cnadmin 进群</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/views/monitor/log/login/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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[]>([]);
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/views/monitor/log/system/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<template #cell="{ record }">
<span :title="decodeURIComponent(record.requestUrl)">{{
record.requestUrl.match(
/(\w+):\/\/([^/:]+)(:\d*)?([^#|\?|\n]*)(\?.*)?/
/(\w+):\/\/([^/:]+)(:\d*)?([^#|\?|\n]*)(\?.*)?/,
)[4]
}}</span>
</template>
Expand Down
7 changes: 1 addition & 6 deletions continew-admin-ui/src/views/monitor/online/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/views/system/announcement/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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[]>([]);
Expand Down Expand Up @@ -552,7 +552,7 @@
.download(
'/system/announcement/export',
{ ...queryParams.value },
'公告数据'
'公告数据',
)
.finally(() => {
exportLoading.value = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand All @@ -262,7 +262,7 @@
code: item[0],
value: item[1],
};
}
},
);
save(optionList).then((res) => {
appStore.save(form.value);
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/views/system/dept/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/views/system/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/views/system/message/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions continew-admin-ui/src/views/system/role/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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[]>([]);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/views/system/user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@
handleCancel();
getList();
proxy.$message.success(res.msg);
}
},
);
}
});
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/views/tool/generator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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[]>([]);
Expand Down Expand Up @@ -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}配置`;
Expand Down

0 comments on commit f4523d2

Please sign in to comment.