Skip to content

Commit

Permalink
fix: 修复前端控制台 eslint 告警
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoofff committed Nov 14, 2023
1 parent 5f4f0f1 commit 2304f28
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion continew-admin-ui/src/components/crud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import dayjs from 'dayjs';
export default function download(
url: string,
params: any,
fileName: string | undefined
fileName: string | undefined,
) {
return axios
.get(url, {
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/components/dict-tag/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
const dictItem = computed(() =>
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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
v-if="type === 'number'"
:style="{ width: '80px' }"
size="small"
:default-value="(defaultValue as number)"
:default-value="defaultValue as number"
@change="handleChange"
/>
<a-switch
v-else
:default-checked="(defaultValue as boolean)"
:default-checked="defaultValue as boolean"
size="small"
@change="handleChange"
/>
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/components/icon-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
iconList.value = icons;
if (iconName.value) {
iconList.value = icons.filter(
(icon) => icon.indexOf(iconName.value) !== -1
(icon) => icon.indexOf(iconName.value) !== -1,
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/directive/permission/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function checkPermission(el: HTMLElement, binding: DirectiveBinding) {
}
} else {
throw new Error(
`need roles! Like v-permission="['admin','system:user:add']"`
`need roles! Like v-permission="['admin','system:user:add']"`,
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/router/guard/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function setupPermissionGuard(router: Router) {

if (element?.children) {
serverMenuConfig.push(
...(element.children as unknown as RouteRecordNormalized[])
...(element.children as unknown as RouteRecordNormalized[]),
);
}
}
Expand All @@ -52,7 +52,7 @@ export default function setupPermissionGuard(router: Router) {
const destination =
Permission.findFirstPermissionRoute(
[...fixedRoutes, ...demoRoutes],
userStore.roles[0]
userStore.roles[0],
) || NOT_FOUND;
next(destination);
}
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ router.afterEach((to) => {
if (item.path === to.path) {
copyRecentlyVisitedList.splice(index, 1);
}
}
},
);

// 最多存储 3 个
Expand All @@ -89,7 +89,7 @@ router.afterEach((to) => {
}
window.localStorage.setItem(
'recently-visited',
JSON.stringify(copyRecentlyVisitedList)
JSON.stringify(copyRecentlyVisitedList),
);
});

Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/router/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ function formatModules(_modules: any, result: RouteRecordNormalized[]) {
export const appRoutes: RouteRecordNormalized[] = formatModules(appModules, []);
export const fixedRoutes: RouteRecordNormalized[] = formatModules(
fixedModules,
[]
[],
);
export const demoRoutes: RouteRecordNormalized[] = formatModules(
demoModules,
[]
[],
);
8 changes: 4 additions & 4 deletions continew-admin-ui/src/store/modules/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AppState, Config } from './types';

const recursionMenu = (
appMenu: RouteRecordNormalized[],
list: Array<RouteRecordNormalized>
list: Array<RouteRecordNormalized>,
) => {
appMenu.forEach((item) => {
const childrenAppMenu = item.children as RouteRecordNormalized[];
Expand Down Expand Up @@ -43,7 +43,7 @@ const useAppStore = defineStore('app', {
const menuList: RouteRecordNormalized[] = [];
recursionMenu(
state.serverMenu as unknown as RouteRecordNormalized[],
menuList
menuList,
);
return menuList;
},
Expand Down Expand Up @@ -135,7 +135,7 @@ const useAppStore = defineStore('app', {
?.setAttribute(
'href',
getFile(resMap.get('site_favicon')) ||
'https://cnadmin.charles7c.top/favicon.ico'
'https://cnadmin.charles7c.top/favicon.ico',
);
});
},
Expand All @@ -153,7 +153,7 @@ const useAppStore = defineStore('app', {
?.setAttribute(
'href',
getFile(config.site_favicon) ||
'https://cnadmin.charles7c.top/favicon.ico'
'https://cnadmin.charles7c.top/favicon.ico',
);
},
},
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/utils/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function addEventListen(
target: Window | HTMLElement,
event: string,
handler: EventListenerOrEventListenerObject,
capture = false
capture = false,
) {
if (
target.addEventListener &&
Expand All @@ -16,7 +16,7 @@ export function removeEventListen(
target: Window | HTMLElement,
event: string,
handler: EventListenerOrEventListenerObject,
capture = false
capture = false,
) {
if (
target.removeEventListener &&
Expand Down
2 changes: 1 addition & 1 deletion continew-admin-ui/src/utils/route-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function setRouteEmitter(to: RouteLocationNormalized) {

export function listenerRouteChange(
handler: (route: RouteLocationNormalized) => void,
immediate = true
immediate = true,
) {
emitter.on(key, handler as Handler);
if (immediate && latestRoute) {
Expand Down
3 changes: 1 addition & 2 deletions continew-admin-ui/src/utils/setup-mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
export default ({ mock, setup }: { mock?: boolean; setup: () => void }) => {
// 仅在开发环境启用 mock
// if (mock !== false && debug) setup();

// 在生产环境也启用 mock
if (mock !== false) setup();
if (mock) setup();
};

export const successResponseWrap = (data: unknown) => {
Expand Down
6 changes: 3 additions & 3 deletions continew-admin-ui/src/views/demo/list/card/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ setupMock({
qualityInspectionList.map((_, index) => ({
...qualityInspectionList[index % qualityInspectionList.length],
id: Mock.Random.guid(),
}))
})),
);
});

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

Expand All @@ -179,7 +179,7 @@ setupMock({
rulesPresetList.map((_, index) => ({
...rulesPresetList[index % rulesPresetList.length],
id: Mock.Random.guid(),
}))
})),
);
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ setupMock({
{ name: '视频类', value: 40, itemStyle: { color: '#00B2FF' } },
],
});
}
},
);

Mock.mock(new RegExp('/api/content-period-analysis'), () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@
.btn {
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-weight: 500;
height: 40px;
Expand Down
6 changes: 4 additions & 2 deletions continew-admin-ui/src/views/login/components/email-login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
captchaLoading.value = false;
captchaDisable.value = true;
captchaBtnNameKey.value = `${t(
'login.captcha.get'
'login.captcha.get',
)}(${(captchaTime.value -= 1)}s)`;
captchaTimer.value = window.setInterval(() => {
captchaTime.value -= 1;
Expand Down Expand Up @@ -197,7 +197,9 @@
.btn {
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-weight: 500;
height: 40px;
Expand Down
9 changes: 6 additions & 3 deletions continew-admin-ui/src/views/login/components/phone-login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
captchaLoading.value = false;
captchaDisable.value = true;
captchaBtnNameKey.value = `${t(
'login.captcha.get'
'login.captcha.get',
)}(${(captchaTime.value -= 1)}s)`;
captchaTimer.value = window.setInterval(() => {
captchaTime.value -= 1;
Expand Down Expand Up @@ -208,7 +208,9 @@
.btn {
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-weight: 500;
height: 40px;
Expand All @@ -220,7 +222,8 @@
.arco-btn-primary.arco-btn-disabled,
.arco-btn-primary[type='submit'].arco-btn-disabled {
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);
}
}
Expand Down

0 comments on commit 2304f28

Please sign in to comment.