diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100755 index 274d2d8ba..000000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# shellcheck source=./_/husky.sh -. "$(dirname "$0")/_/husky.sh" - -PATH="/usr/local/bin:$PATH" - -npx --no-install commitlint --edit "$1" diff --git a/.husky/common.sh b/.husky/common.sh deleted file mode 100644 index 9d5129bd7..000000000 --- a/.husky/common.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -command_exists () { - command -v "$1" >/dev/null 2>&1 -} - -# Workaround for Windows 10, Git Bash and Yarn -if command_exists winpty && test -t 1; then - exec < /dev/tty -fi diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 53685f445..000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" -. "$(dirname "$0")/common.sh" - -[ -n "$CI" ] && exit 0 - -PATH="/usr/local/bin:$PATH" - -# Format and submit code according to lintstagedrc.js configuration -pnpm exec lint-staged diff --git a/src/api/common/Captcha.ts b/src/api/common/Captcha.ts index 4e13ca0ae..c7abead62 100644 --- a/src/api/common/Captcha.ts +++ b/src/api/common/Captcha.ts @@ -2,7 +2,7 @@ import { defHttp } from '@/utils/http/axios' import { Result } from '#/axios' /** - * 获取文件预览地址 + * 获取验证码 */ export const imgCaptcha = () => { return defHttp.post>({ diff --git a/src/api/demo/account.ts b/src/api/demo/account.ts deleted file mode 100644 index 35d5c1fc9..000000000 --- a/src/api/demo/account.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defHttp } from '@/utils/http/axios' -import { GetAccountInfoModel } from './model/accountModel' - -enum Api { - ACCOUNT_INFO = '/account/getAccountInfo', - SESSION_TIMEOUT = '/user/sessionTimeout', - TOKEN_EXPIRED = '/user/tokenExpired', -} - -// Get personal center-basic settings - -export const accountInfoApi = () => defHttp.get({ url: Api.ACCOUNT_INFO }) - -export const sessionTimeoutApi = () => defHttp.post({ url: Api.SESSION_TIMEOUT }) - -export const tokenExpiredApi = () => defHttp.post({ url: Api.TOKEN_EXPIRED }) diff --git a/src/api/demo/cascader.ts b/src/api/demo/cascader.ts deleted file mode 100644 index 2960d77d2..000000000 --- a/src/api/demo/cascader.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defHttp } from '@/utils/http/axios' -import { AreaModel, AreaParams } from '@/api/demo/model/areaModel' - -enum Api { - AREA_RECORD = '/cascader/getAreaRecord', -} - -export const areaRecord = (data: AreaParams) => defHttp.post({ url: Api.AREA_RECORD, data }) diff --git a/src/api/demo/error.ts b/src/api/demo/error.ts deleted file mode 100644 index c88ceb69d..000000000 --- a/src/api/demo/error.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { defHttp } from '@/utils/http/axios' - -enum Api { - // The address does not exist - Error = '/error', -} - -/** - * @description: Trigger ajax error - */ - -export const fireErrorApi = () => defHttp.get({ url: Api.Error }) diff --git a/src/api/demo/model/accountModel.ts b/src/api/demo/model/accountModel.ts deleted file mode 100644 index 06c48888d..000000000 --- a/src/api/demo/model/accountModel.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface GetAccountInfoModel { - email: string - name: string - introduction: string - phone: string - address: string -} diff --git a/src/api/demo/model/areaModel.ts b/src/api/demo/model/areaModel.ts deleted file mode 100644 index ac40079b6..000000000 --- a/src/api/demo/model/areaModel.ts +++ /dev/null @@ -1,12 +0,0 @@ -export interface AreaModel { - id: string - code: string - parentCode: string - name: string - levelType: number - [key: string]: string | number -} - -export interface AreaParams { - parentCode: string -} diff --git a/src/api/demo/model/optionsModel.ts b/src/api/demo/model/optionsModel.ts deleted file mode 100644 index 463fa0bea..000000000 --- a/src/api/demo/model/optionsModel.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { BasicFetchResult } from '@/api/model/baseModel' - -export interface DemoOptionsItem { - name: string - id: string -} - -export interface selectParams { - id: number | string -} - -/** - * @description: Request list return value - */ -export type DemoOptionsGetResultModel = BasicFetchResult diff --git a/src/api/demo/model/systemModel.ts b/src/api/demo/model/systemModel.ts deleted file mode 100644 index e543ffe0a..000000000 --- a/src/api/demo/model/systemModel.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { BasicPageParams, BasicFetchResult } from '@/api/model/baseModel' - -export type AccountParams = BasicPageParams & { - account?: string - nickname?: string - [key: string]: any -} - -export type RoleParams = { - roleName?: string - status?: string -} - -export type RolePageParams = BasicPageParams & RoleParams - -export type DeptParams = { - deptName?: string - status?: string -} - -export type MenuParams = { - menuName?: string - status?: string -} - -export interface AccountListItem { - id: string - account: string - email: string - nickname: string - role: number - createTime: string - remark: string - status: number -} - -export interface DeptListItem { - id: string - orderNo: string - createTime: string - remark: string - status: number -} - -export interface MenuListItem { - id: string - orderNo: string - createTime: string - status: number - icon: string - component: string - permission: string -} - -export interface RoleListItem { - id: string - roleName: string - roleValue: string - status: number - orderNo: string - createTime: string -} - -/** - * @description: Request list return value - */ -export type AccountListGetResultModel = BasicFetchResult - -export type DeptListGetResultModel = BasicFetchResult - -export type MenuListGetResultModel = BasicFetchResult - -export type RolePageListGetResultModel = BasicFetchResult - -export type RoleListGetResultModel = RoleListItem[] diff --git a/src/api/demo/model/tableModel.ts b/src/api/demo/model/tableModel.ts deleted file mode 100644 index 8d8ea37fd..000000000 --- a/src/api/demo/model/tableModel.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { BasicPageParams, BasicFetchResult } from '@/api/model/baseModel' -/** - * @description: Request list interface parameters - */ -export type DemoParams = Partial - -export interface DemoListItem { - id: string - beginTime: string - endTime: string - address: string - name: string - no: number - status: number -} - -/** - * @description: Request list return value - */ -export type DemoListGetResultModel = BasicFetchResult diff --git a/src/api/demo/select.ts b/src/api/demo/select.ts deleted file mode 100644 index a0075fe32..000000000 --- a/src/api/demo/select.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defHttp } from '@/utils/http/axios' -import { DemoOptionsItem, selectParams } from './model/optionsModel' - -enum Api { - OPTIONS_LIST = '/select/getDemoOptions', -} - -/** - * @description: Get sample options value - */ -export const optionsListApi = (params?: selectParams) => defHttp.get({ url: Api.OPTIONS_LIST, params }) diff --git a/src/api/demo/system.ts b/src/api/demo/system.ts deleted file mode 100644 index fa0e966b3..000000000 --- a/src/api/demo/system.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { - AccountParams, - DeptListItem, - MenuParams, - RoleParams, - RolePageParams, - MenuListGetResultModel, - DeptListGetResultModel, - AccountListGetResultModel, - RolePageListGetResultModel, - RoleListGetResultModel, -} from './model/systemModel' -import { defHttp } from '@/utils/http/axios' - -enum Api { - AccountList = '/system/getAccountList', - IsAccountExist = '/system/accountExist', - DeptList = '/system/getDeptList', - setRoleStatus = '/system/setRoleStatus', - MenuList = '/system/getMenuList', - RolePageList = '/system/getRoleListByPage', - GetAllRoleList = '/system/getAllRoleList', -} - -export const getAccountList = (params: AccountParams) => defHttp.get({ url: Api.AccountList, params }) - -export const getDeptList = (params?: DeptListItem) => defHttp.get({ url: Api.DeptList, params }) - -export const getMenuList = (params?: MenuParams) => defHttp.get({ url: Api.MenuList, params }) - -export const getRoleListByPage = (params?: RolePageParams) => defHttp.get({ url: Api.RolePageList, params }) - -export const getAllRoleList = (params?: RoleParams) => defHttp.get({ url: Api.GetAllRoleList, params }) - -export const setRoleStatus = (id: number, status: string) => defHttp.post({ url: Api.setRoleStatus, params: { id, status } }) - -export const isAccountExist = (account: string) => - defHttp.post({ url: Api.IsAccountExist, params: { account } }, { errorMessageMode: 'none' }) diff --git a/src/api/demo/table.ts b/src/api/demo/table.ts deleted file mode 100644 index 840b660d0..000000000 --- a/src/api/demo/table.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { defHttp } from '@/utils/http/axios' -import { DemoParams, DemoListGetResultModel } from './model/tableModel' - -enum Api { - DEMO_LIST = '/table/getDemoList', -} - -/** - * @description: Get sample list value - */ - -export const demoListApi = (params: DemoParams) => - defHttp.get({ - url: Api.DEMO_LIST, - params, - headers: { - // @ts-ignore - ignoreCancelToken: true, - }, - }) diff --git a/src/api/demo/tree.ts b/src/api/demo/tree.ts deleted file mode 100644 index 6b6624a08..000000000 --- a/src/api/demo/tree.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { defHttp } from '@/utils/http/axios' - -enum Api { - TREE_OPTIONS_LIST = '/tree/getDemoOptions', -} - -/** - * @description: Get sample options value - */ -export const treeOptionsListApi = (params?: Recordable) => defHttp.get({ url: Api.TREE_OPTIONS_LIST, params }) diff --git a/src/api/model/baseModel.ts b/src/api/model/baseModel.ts deleted file mode 100644 index 076b9868c..000000000 --- a/src/api/model/baseModel.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface BasicPageParams { - page: number - pageSize: number -} - -export interface BasicFetchResult { - items: T[] - total: number -} diff --git a/src/assets/icons/download-count.svg b/src/assets/icons/download-count.svg deleted file mode 100644 index 1c951958a..000000000 --- a/src/assets/icons/download-count.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 91 \ No newline at end of file diff --git a/src/assets/icons/dynamic-avatar-1.svg b/src/assets/icons/dynamic-avatar-1.svg deleted file mode 100644 index e1553e50e..000000000 --- a/src/assets/icons/dynamic-avatar-1.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 15 \ No newline at end of file diff --git a/src/assets/icons/dynamic-avatar-2.svg b/src/assets/icons/dynamic-avatar-2.svg deleted file mode 100644 index c4c172233..000000000 --- a/src/assets/icons/dynamic-avatar-2.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 16 \ No newline at end of file diff --git a/src/assets/icons/dynamic-avatar-3.svg b/src/assets/icons/dynamic-avatar-3.svg deleted file mode 100644 index 81145f9b4..000000000 --- a/src/assets/icons/dynamic-avatar-3.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 17 \ No newline at end of file diff --git a/src/assets/icons/dynamic-avatar-4.svg b/src/assets/icons/dynamic-avatar-4.svg deleted file mode 100644 index e586ed4e6..000000000 --- a/src/assets/icons/dynamic-avatar-4.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 120 \ No newline at end of file diff --git a/src/assets/icons/dynamic-avatar-5.svg b/src/assets/icons/dynamic-avatar-5.svg deleted file mode 100644 index 746e4b888..000000000 --- a/src/assets/icons/dynamic-avatar-5.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 110 \ No newline at end of file diff --git a/src/assets/icons/dynamic-avatar-6.svg b/src/assets/icons/dynamic-avatar-6.svg deleted file mode 100644 index b2432f225..000000000 --- a/src/assets/icons/dynamic-avatar-6.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 100 \ No newline at end of file diff --git a/src/assets/icons/moon.svg b/src/assets/icons/moon.svg deleted file mode 100644 index e6667f0d4..000000000 --- a/src/assets/icons/moon.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/src/assets/icons/sun.svg b/src/assets/icons/sun.svg deleted file mode 100644 index a3997cbf7..000000000 --- a/src/assets/icons/sun.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/assets/icons/test.svg b/src/assets/icons/test.svg deleted file mode 100644 index 244252dde..000000000 --- a/src/assets/icons/test.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - Icon1@3x - Created with Sketch. - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/assets/icons/total-sales.svg b/src/assets/icons/total-sales.svg deleted file mode 100644 index eff79640a..000000000 --- a/src/assets/icons/total-sales.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 500 \ No newline at end of file diff --git a/src/assets/icons/transaction.svg b/src/assets/icons/transaction.svg deleted file mode 100644 index 7ba9e2f0e..000000000 --- a/src/assets/icons/transaction.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 480% \ No newline at end of file diff --git a/src/assets/icons/visit-count.svg b/src/assets/icons/visit-count.svg deleted file mode 100644 index ba2a30614..000000000 --- a/src/assets/icons/visit-count.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 510 \ No newline at end of file diff --git a/src/assets/images/demo.png b/src/assets/images/demo.png deleted file mode 100644 index 1a45c9835..000000000 Binary files a/src/assets/images/demo.png and /dev/null differ diff --git a/src/assets/svg/illustration.svg b/src/assets/svg/illustration.svg deleted file mode 100644 index b45215b03..000000000 --- a/src/assets/svg/illustration.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 336 \ No newline at end of file diff --git a/src/assets/svg/preview/p-rotate.svg b/src/assets/svg/preview/p-rotate.svg deleted file mode 100644 index 5153a8169..000000000 --- a/src/assets/svg/preview/p-rotate.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/assets/svg/preview/resume.svg b/src/assets/svg/preview/resume.svg deleted file mode 100644 index 0e86c5f6f..000000000 --- a/src/assets/svg/preview/resume.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/assets/svg/preview/scale.svg b/src/assets/svg/preview/scale.svg deleted file mode 100644 index 1f7adaee9..000000000 --- a/src/assets/svg/preview/scale.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/assets/svg/preview/unrotate.svg b/src/assets/svg/preview/unrotate.svg deleted file mode 100644 index e4708be13..000000000 --- a/src/assets/svg/preview/unrotate.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/assets/svg/preview/unscale.svg b/src/assets/svg/preview/unscale.svg deleted file mode 100644 index 1359b34cd..000000000 --- a/src/assets/svg/preview/unscale.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/hooks/setting/useRootSetting.ts b/src/hooks/setting/useRootSetting.ts index 8ff37abbc..c92e08b32 100644 --- a/src/hooks/setting/useRootSetting.ts +++ b/src/hooks/setting/useRootSetting.ts @@ -28,8 +28,6 @@ export function useRootSetting() { const getShowSettingButton = computed(() => appStore.getProjectConfig.showSettingButton) - const getUseErrorHandle = computed(() => appStore.getProjectConfig.useErrorHandle) - const getShowFooter = computed(() => appStore.getProjectConfig.showFooter) const getShowBreadCrumb = computed(() => appStore.getProjectConfig.showBreadCrumb) @@ -74,7 +72,6 @@ export function useRootSetting() { getCanEmbedIFramePage, getPermissionMode, getShowLogo, - getUseErrorHandle, getShowBreadCrumb, getShowBreadCrumbIcon, getUseOpenBackTop, diff --git a/src/layouts/default/header/components/ErrorAction.vue b/src/layouts/default/header/components/ErrorAction.vue deleted file mode 100644 index 556fc0de9..000000000 --- a/src/layouts/default/header/components/ErrorAction.vue +++ /dev/null @@ -1,31 +0,0 @@ - - diff --git a/src/layouts/default/header/components/index.ts b/src/layouts/default/header/components/index.ts index dac055faf..d399446d6 100644 --- a/src/layouts/default/header/components/index.ts +++ b/src/layouts/default/header/components/index.ts @@ -9,6 +9,4 @@ export const LayoutBreadcrumb = createAsyncComponent(() => import('./Breadcrumb. export const Notify = createAsyncComponent(() => import('./notify/index.vue')) -export const ErrorAction = createAsyncComponent(() => import('./ErrorAction.vue')) - export { FullScreen } diff --git a/src/layouts/default/header/index.vue b/src/layouts/default/header/index.vue index c2fe4ddc1..a97621ac8 100644 --- a/src/layouts/default/header/index.vue +++ b/src/layouts/default/header/index.vue @@ -3,9 +3,16 @@
- + @@ -15,7 +22,12 @@
- +
@@ -23,13 +35,16 @@
- - - + @@ -55,7 +70,7 @@ import LayoutMenu from '../menu/index.vue' import LayoutTrigger from '../trigger/index.vue' - import { ErrorAction, FullScreen, LayoutBreadcrumb, Notify, UserDropDown } from './components' + import { FullScreen, LayoutBreadcrumb, Notify, UserDropDown } from './components' const SettingDrawer = createAsyncComponent(() => import('@/layouts/default/setting/index.vue'), { loading: true, @@ -66,8 +81,15 @@ fixed: propTypes.bool, }) const { prefixCls } = useDesign('layout-header') - const { getShowTopMenu, getShowHeaderTrigger, getSplit, getIsMixMode, getMenuWidth, getIsMixSidebar } = useMenuSetting() - const { getUseErrorHandle, getShowSettingButton, getSettingButtonPosition } = useRootSetting() + const { + getShowTopMenu, + getShowHeaderTrigger, + getSplit, + getIsMixMode, + getMenuWidth, + getIsMixSidebar, + } = useMenuSetting() + const { getShowSettingButton, getSettingButtonPosition } = useRootSetting() const { getHeaderTheme, diff --git a/src/logics/error-handle/index.ts b/src/logics/error-handle/index.ts deleted file mode 100644 index aebfc56dd..000000000 --- a/src/logics/error-handle/index.ts +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Used to configure the global error handling function, which can monitor vue errors, script errors, static resource errors and Promise errors - */ - -import type { ErrorLogInfo } from '#/store' - -import { useErrorLogStoreWithOut } from '@/store/modules/errorLog' - -import { ErrorTypeEnum } from '@/enums/exceptionEnum' -import { App } from 'vue' -import projectSetting from '@/settings/projectSetting' - -/** - * Handling error stack information - * @param error - */ -function processStackMsg(error: Error) { - if (!error.stack) { - return '' - } - let stack = error.stack - .replace(/\n/gi, '') // Remove line breaks to save the size of the transmitted content - .replace(/\bat\b/gi, '@') // At in chrome, @ in ff - .split('@') // Split information with @ - .slice(0, 9) // The maximum stack length (Error.stackTraceLimit = 10), so only take the first 10 - .map((v) => v.replace(/^\s*|\s*$/g, '')) // Remove extra spaces - .join('~') // Manually add separators for later display - .replace(/\?[^:]+/gi, '') // Remove redundant parameters of js file links (?x=1 and the like) - const msg = error.toString() - if (stack.indexOf(msg) < 0) { - stack = msg + '@' + stack - } - return stack -} - -/** - * get comp name - * @param vm - */ -function formatComponentName(vm: any) { - if (vm.$root === vm) { - return { - name: 'root', - path: 'root', - } - } - - const options = vm.$options as any - if (!options) { - return { - name: 'anonymous', - path: 'anonymous', - } - } - const name = options.name || options._componentTag - return { - name: name, - path: options.__file, - } -} - -/** - * Configure Vue error handling function - */ -function vueErrorHandler(err: unknown, vm: any, info: string) { - const errorLogStore = useErrorLogStoreWithOut() - const { name, path } = formatComponentName(vm) - errorLogStore.addErrorLogInfo({ - type: ErrorTypeEnum.VUE, - name, - file: path, - message: (err as Error).message, - stack: processStackMsg(err as Error), - detail: info, - url: window.location.href, - }) -} - -/** - * Configure script error handling function - */ -export function scriptErrorHandler(event: Event | string, source?: string, lineno?: number, colno?: number, error?: Error) { - if (event === 'Script error.' && !source) { - return false - } - const errorInfo: Partial = {} - colno = colno || (window.event && (window.event as any).errorCharacter) || 0 - errorInfo.message = event as string - if (error?.stack) { - errorInfo.stack = error.stack - } else { - errorInfo.stack = '' - } - const name = source ? source.substr(source.lastIndexOf('/') + 1) : 'script' - const errorLogStore = useErrorLogStoreWithOut() - errorLogStore.addErrorLogInfo({ - type: ErrorTypeEnum.SCRIPT, - name: name, - file: source as string, - detail: 'lineno' + lineno, - url: window.location.href, - ...(errorInfo as Pick), - }) - return true -} - -/** - * Configure Promise error handling function - */ -function registerPromiseErrorHandler() { - window.addEventListener( - 'unhandledrejection', - function (event) { - const errorLogStore = useErrorLogStoreWithOut() - errorLogStore.addErrorLogInfo({ - type: ErrorTypeEnum.PROMISE, - name: 'Promise Error!', - file: 'none', - detail: 'promise error!', - url: window.location.href, - stack: 'promise error!', - message: event.reason, - }) - }, - true, - ) -} - -/** - * Configure monitoring resource loading error handling function - */ -function registerResourceErrorHandler() { - // Monitoring resource loading error(img,script,css,and jsonp) - window.addEventListener( - 'error', - function (e: Event) { - const target = e.target ? e.target : (e.srcElement as any) - const errorLogStore = useErrorLogStoreWithOut() - errorLogStore.addErrorLogInfo({ - type: ErrorTypeEnum.RESOURCE, - name: 'Resource Error!', - file: (e.target || ({} as any)).currentSrc, - detail: JSON.stringify({ - tagName: target.localName, - html: target.outerHTML, - type: e.type, - }), - url: window.location.href, - stack: 'resource is not found', - message: (e.target || ({} as any)).localName + ' is load error', - }) - }, - true, - ) -} - -/** - * Configure global error handling - * @param app - */ -export function setupErrorHandle(app: App) { - const { useErrorHandle } = projectSetting - if (!useErrorHandle) { - return - } - // Vue exception monitoring; - app.config.errorHandler = vueErrorHandler - - // script error - window.onerror = scriptErrorHandler - - // promise exception - registerPromiseErrorHandler() - - // Static resource exception - registerResourceErrorHandler() -} diff --git a/src/main.ts b/src/main.ts index 4f67fc38b..8c9de8199 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,7 +10,6 @@ import { createApp } from 'vue' import { registerGlobComp } from '@/components/registerGlobComp' import { setupGlobDirectives } from '@/directives' import { setupI18n } from '@/locales/setupI18n' -import { setupErrorHandle } from '@/logics/error-handle' import { initAppConfigStore } from '@/logics/initAppConfig' import { router, setupRouter } from '@/router' import { setupRouterGuard } from '@/router/guard' @@ -51,10 +50,6 @@ async function bootstrap() { // 注册全局指令 setupGlobDirectives(app) - // Configure global error handling - // 配置全局错误处理 - setupErrorHandle(app) - // https://next.router.vuejs.org/api/#isready // await router.isReady(); diff --git a/src/router/routes/basic.ts b/src/router/routes/basic.ts index 18723ba8d..9309b08a5 100644 --- a/src/router/routes/basic.ts +++ b/src/router/routes/basic.ts @@ -47,27 +47,3 @@ export const REDIRECT_ROUTE: AppRouteRecordRaw = { }, ], } - -export const ERROR_LOG_ROUTE: AppRouteRecordRaw = { - path: '/error-log', - name: 'ErrorLog', - component: LAYOUT, - redirect: '/error-log/list', - meta: { - title: 'ErrorLog', - hideBreadcrumb: true, - hideChildrenInMenu: true, - }, - children: [ - { - path: 'list', - name: 'ErrorLogList', - component: () => import('@/views/sys/error-log/index.vue'), - meta: { - title: t('routes.basic.errorLogList'), - hideBreadcrumb: true, - currentActiveMenu: '/error-log', - }, - }, - ], -} diff --git a/src/router/routes/modules/dashboard.ts b/src/router/routes/modules/dashboard.ts index 909c420c7..431a5da29 100644 --- a/src/router/routes/modules/dashboard.ts +++ b/src/router/routes/modules/dashboard.ts @@ -23,14 +23,6 @@ const Dashboard: AppRouteModule = { title: t('routes.dashboard.analysis'), }, }, - { - path: 'workbench', - name: 'Workbench', - component: () => import('@/views/dashboard/workbench/index.vue'), - meta: { - title: t('routes.dashboard.workbench'), - }, - }, ], } diff --git a/src/settings/projectSetting.ts b/src/settings/projectSetting.ts index 013e3b155..c1905fc96 100644 --- a/src/settings/projectSetting.ts +++ b/src/settings/projectSetting.ts @@ -165,9 +165,6 @@ const setting: ProjectConfig = { // Whether to show the breadcrumb icon showBreadCrumbIcon: false, - // Use error-handler-plugin - useErrorHandle: false, - // 是否打开返回顶部 useOpenBackTop: true, diff --git a/src/store/modules/errorLog.ts b/src/store/modules/errorLog.ts deleted file mode 100644 index 7bf68ec59..000000000 --- a/src/store/modules/errorLog.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { ErrorLogInfo } from '#/store' - -import { defineStore } from 'pinia' -import { store } from '@/store' - -import { formatToDateTime } from '@/utils/dateUtil' -import projectSetting from '@/settings/projectSetting' - -import { ErrorTypeEnum } from '@/enums/exceptionEnum' - -export interface ErrorLogState { - errorLogInfoList: Nullable - errorLogListCount: number -} - -export const useErrorLogStore = defineStore({ - id: 'app-error-log', - state: (): ErrorLogState => ({ - errorLogInfoList: null, - errorLogListCount: 0, - }), - getters: { - getErrorLogInfoList(state): ErrorLogInfo[] { - return state.errorLogInfoList || [] - }, - getErrorLogListCount(state): number { - return state.errorLogListCount - }, - }, - actions: { - addErrorLogInfo(info: ErrorLogInfo) { - const item = { - ...info, - time: formatToDateTime(new Date()), - } - this.errorLogInfoList = [item, ...(this.errorLogInfoList || [])] - this.errorLogListCount += 1 - }, - - setErrorLogListCount(count: number): void { - this.errorLogListCount = count - }, - - /** - * Triggered after ajax request error - * @param error - * @returns - */ - addAjaxErrorInfo(error) { - const { useErrorHandle } = projectSetting - if (!useErrorHandle) { - return - } - const errInfo: Partial = { - message: error.message, - type: ErrorTypeEnum.AJAX, - } - if (error.response) { - const { config: { url = '', data: params = '', method = 'get', headers = {} } = {}, data = {} } = error.response - errInfo.url = url - errInfo.name = 'Ajax Error!' - errInfo.file = '-' - errInfo.stack = JSON.stringify(data) - errInfo.detail = JSON.stringify({ params, method, headers }) - } - this.addErrorLogInfo(errInfo as ErrorLogInfo) - }, - }, -}) - -// Need to be used outside the setup -export function useErrorLogStoreWithOut() { - return useErrorLogStore(store) -} diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 901a8d282..f6e10a83e 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -5,7 +5,7 @@ import { store } from '@/store' import { transformObjToRoute, flatMultiLevelRoutes } from '@/router/helper/routeHelper' import { transformRouteToMenu } from '@/router/helper/menuHelper' -import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '@/router/routes/basic' +import { PAGE_NOT_FOUND_ROUTE } from '@/router/routes/basic' import { filter } from '@/utils/helper/treeHelper' @@ -216,7 +216,6 @@ export const usePermissionStore = defineStore({ routes = [PAGE_NOT_FOUND_ROUTE, ...routeList] // 添加更多配置的路由菜单 - routes.push(ERROR_LOG_ROUTE) routes.push(Dashboard) routes.push(...PROJECT_BASE) patchHomeAffix(routes) diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index e9e29af6b..f45e17b75 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -12,7 +12,6 @@ import { useMessage } from '@/hooks/web/useMessage' import { RequestEnum, ResultEnum, ContentTypeEnum } from '@/enums/httpEnum' import { isString } from '@/utils/is' import { setObjToUrlParams, deepMerge } from '@/utils' -import { useErrorLogStoreWithOut } from '@/store/modules/errorLog' import { joinTimestamp, formatRequestDate } from './helper' import { useUserStoreWithOut } from '@/store/modules/user' import { AxiosRetry } from '@/utils/http/axios/axiosRetry' @@ -156,8 +155,6 @@ const transform: AxiosTransform = { * 响应错误处理 */ responseInterceptorsCatch: (axiosInstance: AxiosInstance, error: any) => { - const errorLogStore = useErrorLogStoreWithOut() - errorLogStore.addAjaxErrorInfo(error) const { response, code, message, config } = error || {} const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none' const msg: string = response?.data?.error?.message ?? '' diff --git a/src/views/dashboard/workbench/components/DynamicInfo.vue b/src/views/dashboard/workbench/components/DynamicInfo.vue deleted file mode 100644 index b05beda88..000000000 --- a/src/views/dashboard/workbench/components/DynamicInfo.vue +++ /dev/null @@ -1,31 +0,0 @@ - - diff --git a/src/views/dashboard/workbench/components/ProjectCard.vue b/src/views/dashboard/workbench/components/ProjectCard.vue deleted file mode 100644 index 7a626d54f..000000000 --- a/src/views/dashboard/workbench/components/ProjectCard.vue +++ /dev/null @@ -1,24 +0,0 @@ - - diff --git a/src/views/dashboard/workbench/components/QuickNav.vue b/src/views/dashboard/workbench/components/QuickNav.vue deleted file mode 100644 index af561797f..000000000 --- a/src/views/dashboard/workbench/components/QuickNav.vue +++ /dev/null @@ -1,15 +0,0 @@ - - diff --git a/src/views/dashboard/workbench/components/SaleRadar.vue b/src/views/dashboard/workbench/components/SaleRadar.vue deleted file mode 100644 index d4f73b72b..000000000 --- a/src/views/dashboard/workbench/components/SaleRadar.vue +++ /dev/null @@ -1,94 +0,0 @@ - - diff --git a/src/views/dashboard/workbench/components/WorkbenchHeader.vue b/src/views/dashboard/workbench/components/WorkbenchHeader.vue deleted file mode 100644 index 830a1219b..000000000 --- a/src/views/dashboard/workbench/components/WorkbenchHeader.vue +++ /dev/null @@ -1,33 +0,0 @@ - - diff --git a/src/views/dashboard/workbench/components/data.ts b/src/views/dashboard/workbench/components/data.ts deleted file mode 100644 index 432c37f20..000000000 --- a/src/views/dashboard/workbench/components/data.ts +++ /dev/null @@ -1,156 +0,0 @@ -interface GroupItem { - title: string - icon: string - color: string - desc: string - date: string - group: string -} - -interface NavItem { - title: string - icon: string - color: string -} - -interface DynamicInfoItem { - avatar: string - name: string - date: string - desc: string -} - -export const navItems: NavItem[] = [ - { - title: '首页', - icon: 'ion:home-outline', - color: '#1fdaca', - }, - { - title: '仪表盘', - icon: 'ion:grid-outline', - color: '#bf0c2c', - }, - { - title: '组件', - icon: 'ion:layers-outline', - color: '#e18525', - }, - { - title: '系统管理', - icon: 'ion:settings-outline', - color: '#3fb27f', - }, - { - title: '权限管理', - icon: 'ion:key-outline', - color: '#4daf1bc9', - }, - { - title: '图表', - icon: 'ion:bar-chart-outline', - color: '#00d8ff', - }, -] - -export const dynamicInfoItems: DynamicInfoItem[] = [ - { - avatar: 'dynamic-avatar-1|svg', - name: '威廉', - date: '刚刚', - desc: `在 开源组 创建了项目 Vue`, - }, - { - avatar: 'dynamic-avatar-2|svg', - name: '艾文', - date: '1个小时前', - desc: `关注了 威廉 `, - }, - { - avatar: 'dynamic-avatar-3|svg', - name: '克里斯', - date: '1天前', - desc: `发布了 个人动态 `, - }, - { - avatar: 'dynamic-avatar-4|svg', - name: 'Vben', - date: '2天前', - desc: `发表文章 如何编写一个Vite插件 `, - }, - { - avatar: 'dynamic-avatar-5|svg', - name: '皮特', - date: '3天前', - desc: `回复了 杰克 的问题 如何进行项目优化?`, - }, - { - avatar: 'dynamic-avatar-6|svg', - name: '杰克', - date: '1周前', - desc: `关闭了问题 如何运行项目 `, - }, - { - avatar: 'dynamic-avatar-1|svg', - name: '威廉', - date: '1周前', - desc: `发布了 个人动态 `, - }, - { - avatar: 'dynamic-avatar-1|svg', - name: '威廉', - date: '2021-04-01 20:00', - desc: `推送了代码到 Github`, - }, -] - -export const groupItems: GroupItem[] = [ - { - title: 'Github', - icon: 'carbon:logo-github', - color: '', - desc: '不要等待机会,而要创造机会。', - group: '开源组', - date: '2021-04-01', - }, - { - title: 'Vue', - icon: 'ion:logo-vue', - color: '#3fb27f', - desc: '现在的你决定将来的你。', - group: '算法组', - date: '2021-04-01', - }, - { - title: 'Html5', - icon: 'ion:logo-html5', - color: '#e18525', - desc: '没有什么才能比努力更重要。', - group: '上班摸鱼', - date: '2021-04-01', - }, - { - title: 'Angular', - icon: 'ion:logo-angular', - color: '#bf0c2c', - desc: '热情和欲望可以突破一切难关。', - group: 'UI', - date: '2021-04-01', - }, - { - title: 'React', - icon: 'bx:bxl-react', - color: '#00d8ff', - desc: '健康的身体是实现目标的基石。', - group: '技术牛', - date: '2021-04-01', - }, - { - title: 'Js', - icon: 'ion:logo-javascript', - color: '#EBD94E', - desc: '路是走出来的,而不是空想出来的。', - group: '架构组', - date: '2021-04-01', - }, -] diff --git a/src/views/dashboard/workbench/index.vue b/src/views/dashboard/workbench/index.vue deleted file mode 100644 index 3b8894d7d..000000000 --- a/src/views/dashboard/workbench/index.vue +++ /dev/null @@ -1,36 +0,0 @@ - - diff --git a/src/views/sys/error-log/DetailModal.vue b/src/views/sys/error-log/DetailModal.vue deleted file mode 100644 index 4b14de5df..000000000 --- a/src/views/sys/error-log/DetailModal.vue +++ /dev/null @@ -1,27 +0,0 @@ - - diff --git a/src/views/sys/error-log/data.tsx b/src/views/sys/error-log/data.tsx deleted file mode 100644 index 57a1a1214..000000000 --- a/src/views/sys/error-log/data.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Tag } from 'ant-design-vue' -import { BasicColumn } from '@/components/Table' -import { ErrorTypeEnum } from '@/enums/exceptionEnum' -import { useI18n } from '@/hooks/web/useI18n' - -const { t } = useI18n() - -export function getColumns(): BasicColumn[] { - return [ - { - dataIndex: 'type', - title: t('sys.errorLog.tableColumnType'), - width: 80, - customRender: ({ text }) => { - const color = - text === ErrorTypeEnum.VUE - ? 'green' - : text === ErrorTypeEnum.RESOURCE - ? 'cyan' - : text === ErrorTypeEnum.PROMISE - ? 'blue' - : ErrorTypeEnum.AJAX - ? 'red' - : 'purple' - return {() => text} - }, - }, - { - dataIndex: 'url', - title: 'URL', - width: 200, - }, - { - dataIndex: 'time', - title: t('sys.errorLog.tableColumnDate'), - width: 160, - }, - { - dataIndex: 'file', - title: t('sys.errorLog.tableColumnFile'), - width: 200, - }, - { - dataIndex: 'name', - title: 'Name', - width: 200, - }, - { - dataIndex: 'message', - title: t('sys.errorLog.tableColumnMsg'), - width: 300, - }, - { - dataIndex: 'stack', - title: t('sys.errorLog.tableColumnStackMsg'), - }, - ] -} - -export function getDescSchema(): any { - return getColumns().map((column) => { - return { - field: column.dataIndex!, - label: column.title, - } - }) -} diff --git a/src/views/sys/error-log/index.vue b/src/views/sys/error-log/index.vue deleted file mode 100644 index 2ca9ea9ce..000000000 --- a/src/views/sys/error-log/index.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - diff --git a/types/config.d.ts b/types/config.d.ts index f413f2280..916db4548 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -126,8 +126,6 @@ export interface ProjectConfig { showBreadCrumb: boolean // Show breadcrumb icon showBreadCrumbIcon: boolean - // Use error-handler-plugin - useErrorHandle: boolean // Whether to open back to top useOpenBackTop: boolean // Is it possible to embed iframe pages