diff --git a/modules/web/.prettierignore b/modules/web/.prettierignore new file mode 100644 index 000000000000..31bac1812cd3 --- /dev/null +++ b/modules/web/.prettierignore @@ -0,0 +1,3 @@ +# d.ts files Generated by unplugin-auto unplugin-vue-components +auto-imports.d.ts +components.d.ts \ No newline at end of file diff --git a/modules/web/src/api/index.ts b/modules/web/src/api/index.ts index 1e474cf5ae02..9c50ba55625f 100644 --- a/modules/web/src/api/index.ts +++ b/modules/web/src/api/index.ts @@ -1,16 +1,12 @@ import type { AxiosResponse } from 'axios' import type { LeagdoApiResponse } from './api' -import API, { - setWebsocketOnError, - legado_http_entry_point, - legado_webSocket_entry_point, - setApiEntryPoint, -} from './api' +import API, { setWebsocketOnError, setApiEntryPoint } from './api' import ajax from './axios' import { validatorHttpUrl } from '@/utils/utils' const LeagdoApiResponseKeys: string[] = Array.of('isSuccess', 'errorMsg') +const notification = ElMessage /** Axios.Interceptor: check if resp is LeagaoLeagdoApiResponse*/ const responseCheckInterceptor = (resp: AxiosResponse) => { let isLeagdoApiResponse = true @@ -26,21 +22,23 @@ const responseCheckInterceptor = (resp: AxiosResponse) => { if ((data as LeagdoApiResponse).isSuccess === true) { if (!('data' in data)) { isLeagdoApiResponse = false - LeagdoApiResponseKeys.length = 0 } } } catch { isLeagdoApiResponse = false } if (isLeagdoApiResponse === false) { - ElNotification.warning('后端返回内容格式错误') + notification.warning({ message: '后端返回内容格式错误', grouping: true }) throw new Error() } return resp } const axiosErrorInterceptor = (err: unknown) => { - ElNotification.error('后端连接失败,请检查阅读WEB服务或者设置其它可用链接') + notification.error({ + message: '后端连接失败,请检查阅读WEB服务或者设置其它可用链接', + grouping: true, + }) throw err } // http全局 @@ -80,8 +78,8 @@ export const parseLeagdoHttpUrlWithDefault = ( console.info('legado_api_config:') console.table({ - 'http API入口': legado_http_entry_point, - 'webSocket API入口': legado_webSocket_entry_point, + 'http API入口': http_entry_point, + 'webSocket API入口': webSocket_entry_point, }) return [http_entry_point, webSocket_entry_point] } diff --git a/modules/web/src/auto-imports.d.ts b/modules/web/src/auto-imports.d.ts index 5fcc08f04396..f258fcdc42fc 100644 --- a/modules/web/src/auto-imports.d.ts +++ b/modules/web/src/auto-imports.d.ts @@ -9,7 +9,6 @@ declare global { const EffectScope: typeof import('vue')['EffectScope'] const ElMessage: typeof import('element-plus/es')['ElMessage'] const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] - const ElNotification: typeof import('element-plus/es')['ElNotification'] const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] const computed: typeof import('vue')['computed'] const createApp: typeof import('vue')['createApp'] diff --git a/modules/web/src/components/BookItems.vue b/modules/web/src/components/BookItems.vue index bdc1d148ad40..546d736ab613 100644 --- a/modules/web/src/components/BookItems.vue +++ b/modules/web/src/components/BookItems.vue @@ -76,7 +76,7 @@ const subJustify = computed(() => ) -