!6 修复前端控制台 eslint 告警

Merge pull request !6 from Yoofff/dev
This commit is contained in:
Charles7c 2023-11-14 14:04:30 +00:00 committed by Gitee
commit abd4fb5368
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 38 additions and 32 deletions

View File

@ -13,7 +13,7 @@ import dayjs from 'dayjs';
export default function download( export default function download(
url: string, url: string,
params: any, params: any,
fileName: string | undefined fileName: string | undefined,
) { ) {
return axios return axios
.get(url, { .get(url, {

View File

@ -36,8 +36,8 @@
const dictItem = computed(() => const dictItem = computed(() =>
props.dict.find( props.dict.find(
(d) => d.value === String(props.value) || d.value === Number(props.value) (d) => d.value === String(props.value) || d.value === Number(props.value),
) ),
); );
</script> </script>

View File

@ -3,12 +3,12 @@
v-if="type === 'number'" v-if="type === 'number'"
:style="{ width: '80px' }" :style="{ width: '80px' }"
size="small" size="small"
:default-value="(defaultValue as number)" :default-value="defaultValue as number"
@change="handleChange" @change="handleChange"
/> />
<a-switch <a-switch
v-else v-else
:default-checked="(defaultValue as boolean)" :default-checked="defaultValue as boolean"
size="small" size="small"
@change="handleChange" @change="handleChange"
/> />

View File

@ -37,7 +37,7 @@
iconList.value = icons; iconList.value = icons;
if (iconName.value) { if (iconName.value) {
iconList.value = icons.filter( iconList.value = icons.filter(
(icon) => icon.indexOf(iconName.value) !== -1 (icon) => icon.indexOf(iconName.value) !== -1,
); );
} }
}; };

View File

@ -26,7 +26,7 @@ function checkPermission(el: HTMLElement, binding: DirectiveBinding) {
} }
} else { } else {
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

@ -38,7 +38,7 @@ export default function setupPermissionGuard(router: Router) {
if (element?.children) { if (element?.children) {
serverMenuConfig.push( serverMenuConfig.push(
...(element.children as unknown as RouteRecordNormalized[]) ...(element.children as unknown as RouteRecordNormalized[]),
); );
} }
} }
@ -52,7 +52,7 @@ export default function setupPermissionGuard(router: Router) {
const destination = const destination =
Permission.findFirstPermissionRoute( Permission.findFirstPermissionRoute(
[...fixedRoutes, ...demoRoutes], [...fixedRoutes, ...demoRoutes],
userStore.roles[0] userStore.roles[0],
) || NOT_FOUND; ) || NOT_FOUND;
next(destination); next(destination);
} }

View File

@ -71,7 +71,7 @@ router.afterEach((to) => {
if (item.path === to.path) { if (item.path === to.path) {
copyRecentlyVisitedList.splice(index, 1); copyRecentlyVisitedList.splice(index, 1);
} }
} },
); );
// 最多存储 3 个 // 最多存储 3 个
@ -89,7 +89,7 @@ router.afterEach((to) => {
} }
window.localStorage.setItem( window.localStorage.setItem(
'recently-visited', 'recently-visited',
JSON.stringify(copyRecentlyVisitedList) JSON.stringify(copyRecentlyVisitedList),
); );
}); });

View File

@ -19,9 +19,9 @@ function formatModules(_modules: any, result: RouteRecordNormalized[]) {
export const appRoutes: RouteRecordNormalized[] = formatModules(appModules, []); export const appRoutes: RouteRecordNormalized[] = formatModules(appModules, []);
export const fixedRoutes: RouteRecordNormalized[] = formatModules( export const fixedRoutes: RouteRecordNormalized[] = formatModules(
fixedModules, fixedModules,
[] [],
); );
export const demoRoutes: RouteRecordNormalized[] = formatModules( export const demoRoutes: RouteRecordNormalized[] = formatModules(
demoModules, demoModules,
[] [],
); );

View File

@ -15,7 +15,7 @@ import { AppState, Config } from './types';
const recursionMenu = ( const recursionMenu = (
appMenu: RouteRecordNormalized[], appMenu: RouteRecordNormalized[],
list: Array<RouteRecordNormalized> list: Array<RouteRecordNormalized>,
) => { ) => {
appMenu.forEach((item) => { appMenu.forEach((item) => {
const childrenAppMenu = item.children as RouteRecordNormalized[]; const childrenAppMenu = item.children as RouteRecordNormalized[];
@ -43,7 +43,7 @@ const useAppStore = defineStore('app', {
const menuList: RouteRecordNormalized[] = []; const menuList: RouteRecordNormalized[] = [];
recursionMenu( recursionMenu(
state.serverMenu as unknown as RouteRecordNormalized[], state.serverMenu as unknown as RouteRecordNormalized[],
menuList menuList,
); );
return menuList; return menuList;
}, },
@ -135,7 +135,7 @@ const useAppStore = defineStore('app', {
?.setAttribute( ?.setAttribute(
'href', 'href',
getFile(resMap.get('site_favicon')) || getFile(resMap.get('site_favicon')) ||
'https://cnadmin.charles7c.top/favicon.ico' 'https://cnadmin.charles7c.top/favicon.ico',
); );
}); });
}, },
@ -153,7 +153,7 @@ const useAppStore = defineStore('app', {
?.setAttribute( ?.setAttribute(
'href', 'href',
getFile(config.site_favicon) || getFile(config.site_favicon) ||
'https://cnadmin.charles7c.top/favicon.ico' 'https://cnadmin.charles7c.top/favicon.ico',
); );
}, },
}, },

View File

@ -2,7 +2,7 @@ export function addEventListen(
target: Window | HTMLElement, target: Window | HTMLElement,
event: string, event: string,
handler: EventListenerOrEventListenerObject, handler: EventListenerOrEventListenerObject,
capture = false capture = false,
) { ) {
if ( if (
target.addEventListener && target.addEventListener &&
@ -16,7 +16,7 @@ export function removeEventListen(
target: Window | HTMLElement, target: Window | HTMLElement,
event: string, event: string,
handler: EventListenerOrEventListenerObject, handler: EventListenerOrEventListenerObject,
capture = false capture = false,
) { ) {
if ( if (
target.removeEventListener && target.removeEventListener &&

View File

@ -18,7 +18,7 @@ export function setRouteEmitter(to: RouteLocationNormalized) {
export function listenerRouteChange( export function listenerRouteChange(
handler: (route: RouteLocationNormalized) => void, handler: (route: RouteLocationNormalized) => void,
immediate = true immediate = true,
) { ) {
emitter.on(key, handler as Handler); emitter.on(key, handler as Handler);
if (immediate && latestRoute) { if (immediate && latestRoute) {

View File

@ -3,9 +3,8 @@
export default ({ mock, setup }: { mock?: boolean; setup: () => void }) => { export default ({ mock, setup }: { mock?: boolean; setup: () => void }) => {
// 仅在开发环境启用 mock // 仅在开发环境启用 mock
// if (mock !== false && debug) setup(); // if (mock !== false && debug) setup();
// 在生产环境也启用 mock // 在生产环境也启用 mock
if (mock !== false) setup(); if (mock) setup();
}; };
export const successResponseWrap = (data: unknown) => { export const successResponseWrap = (data: unknown) => {

View File

@ -159,7 +159,7 @@ setupMock({
qualityInspectionList.map((_, index) => ({ qualityInspectionList.map((_, index) => ({
...qualityInspectionList[index % qualityInspectionList.length], ...qualityInspectionList[index % qualityInspectionList.length],
id: Mock.Random.guid(), id: Mock.Random.guid(),
})) })),
); );
}); });
@ -169,7 +169,7 @@ setupMock({
theServiceList.map((_, index) => ({ theServiceList.map((_, index) => ({
...theServiceList[index % theServiceList.length], ...theServiceList[index % theServiceList.length],
id: Mock.Random.guid(), id: Mock.Random.guid(),
})) })),
); );
}); });
@ -179,7 +179,7 @@ setupMock({
rulesPresetList.map((_, index) => ({ rulesPresetList.map((_, index) => ({
...rulesPresetList[index % rulesPresetList.length], ...rulesPresetList[index % rulesPresetList.length],
id: Mock.Random.guid(), id: Mock.Random.guid(),
})) })),
); );
}); });
}, },

View File

@ -48,7 +48,7 @@ setupMock({
{ name: '视频类', value: 40, itemStyle: { color: '#00B2FF' } }, { name: '视频类', value: 40, itemStyle: { color: '#00B2FF' } },
], ],
}); });
} },
); );
Mock.mock(new RegExp('/api/content-period-analysis'), () => { Mock.mock(new RegExp('/api/content-period-analysis'), () => {

View File

@ -198,7 +198,9 @@
.btn { .btn {
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 0 1px #05f, 0 2px 1px rgba(0, 0, 0, 0.15); box-shadow:
0 0 0 1px #05f,
0 2px 1px rgba(0, 0, 0, 0.15);
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
height: 40px; height: 40px;

View File

@ -98,7 +98,7 @@
captchaLoading.value = false; captchaLoading.value = false;
captchaDisable.value = true; captchaDisable.value = true;
captchaBtnNameKey.value = `${t( captchaBtnNameKey.value = `${t(
'login.captcha.get' 'login.captcha.get',
)}(${(captchaTime.value -= 1)}s)`; )}(${(captchaTime.value -= 1)}s)`;
captchaTimer.value = window.setInterval(() => { captchaTimer.value = window.setInterval(() => {
captchaTime.value -= 1; captchaTime.value -= 1;
@ -197,7 +197,9 @@
.btn { .btn {
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 0 1px #05f, 0 2px 1px rgba(0, 0, 0, 0.15); box-shadow:
0 0 0 1px #05f,
0 2px 1px rgba(0, 0, 0, 0.15);
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
height: 40px; height: 40px;

View File

@ -109,7 +109,7 @@
captchaLoading.value = false; captchaLoading.value = false;
captchaDisable.value = true; captchaDisable.value = true;
captchaBtnNameKey.value = `${t( captchaBtnNameKey.value = `${t(
'login.captcha.get' 'login.captcha.get',
)}(${(captchaTime.value -= 1)}s)`; )}(${(captchaTime.value -= 1)}s)`;
captchaTimer.value = window.setInterval(() => { captchaTimer.value = window.setInterval(() => {
captchaTime.value -= 1; captchaTime.value -= 1;
@ -208,7 +208,9 @@
.btn { .btn {
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 0 1px #05f, 0 2px 1px rgba(0, 0, 0, 0.15); box-shadow:
0 0 0 1px #05f,
0 2px 1px rgba(0, 0, 0, 0.15);
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
height: 40px; height: 40px;
@ -220,7 +222,8 @@
.arco-btn-primary.arco-btn-disabled, .arco-btn-primary.arco-btn-disabled,
.arco-btn-primary[type='submit'].arco-btn-disabled { .arco-btn-primary[type='submit'].arco-btn-disabled {
background-color: var(--color-neutral-4); background-color: var(--color-neutral-4);
box-shadow: 0 0 0 1px var(--color-neutral-4), box-shadow:
0 0 0 1px var(--color-neutral-4),
0 2px 1px rgba(0, 0, 0, 0.15); 0 2px 1px rgba(0, 0, 0, 0.15);
} }
} }