diff --git a/.umirc.ts b/.umirc.ts index c5003c7..16c950f 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -1,55 +1,29 @@ -import { defineConfig } from 'umi'; +import { defineConfig } from "umi"; +import { join } from "path"; +import { readdirSync } from "fs"; + +const getIcons = () => { + const iconDir = join(__dirname, "src/icons"); + return readdirSync(iconDir) + .filter(file => file.endsWith(".svg")) + .map(file => `local:${file.replace(/\.svg$/, "")}`); +}; export default defineConfig({ routes: [ - { path: '/', redirect: '/login' }, - { path: '/login', component: '@/routes/login/login' }, + { path: "/", redirect: "/login" }, + { path: "/login", component: "@/routes/login/login" }, { - path: '/indexPage', - component: '@/routes/indexPage', - routes: [ - { path: '/indexPage/CommonList' }, - { path: '/indexPage/CommonListA' }, - { path: '/indexPage/CommonNewBill' }, - { path: '/indexPage/CommonBill' }, - { path: '/indexPage/CommonListEdit' }, - { path: '/indexPage/CommonClassify' }, - { path: '/indexPage/eleknifemould'}, - { path: '/indexPage/elecustomer'}, - { path: '/indexPage/CommonListTab'}, - { path: '/indexPage/commonColumnList'}, - { path: '/indexPage/commonListTree'}, - { path: '/indexPage/commonListLeft'}, - { path: '/indexPage/commonGatte'}, - { path: '/indexPage/materialRequirementsPlanning'}, - { path: '/indexPage/eleteststand'}, - { path: '/indexPage/eleemployee'}, - { path: '/indexPage/elematerials'}, - { path: '/indexPage/eleproduct'}, - { path: '/indexPage/syssystemsettings'}, - { path: '/indexPage/elesupply'}, - { path: '/indexPage/eleprocess'}, - { path: '/indexPage/elecheckmodel'}, - { path: '/indexPage/sischeckphase'}, - { path: '/indexPage/sftlogininfo'}, - { path: '/indexPage/siscommonstyle'}, - { path: '/indexPage/sisproductclassify'}, - { path: '/indexPage/commonCheckBill'}, - { path: '/indexPage/workOrderNew'}, - { path: '/indexPage/workOrderPack'}, - { path: '/indexPage/workOrderPackTableTree'}, - { path: '/indexPage/workOrderResearchTableTree'}, - { path: '/indexPage/processCard'}, - { path: '/indexPage/processCardPack'}, - { path: '/indexPage/processCardPackTableTree'}, - { path: '/indexPage/processCardPackTableTreeNew'}, - { path: '/indexPage/workOrderPackTableTreeNew'}, - { path: '/indexPage/productionPlan'}, - ], + path: "/indexPage", + component: "@/routes/indexPage", + routes: [{ path: "*" }], }, ], - npmClient: 'pnpm', + npmClient: "pnpm", dva: {}, - plugins: ['@umijs/plugins/dist/dva'], + icons: { + include: getIcons(), + }, + plugins: ["@umijs/plugins/dist/dva"], }); diff --git a/src/components/SvgIcon/index.js b/src/components/SvgIcon/index.js index b69eaef..400b957 100644 --- a/src/components/SvgIcon/index.js +++ b/src/components/SvgIcon/index.js @@ -1,22 +1,20 @@ -import React from 'react'; - -const SvgIcon = (props) => { - const { - iconClass, className, size, offsetX, fill, offsetY, - } = props; - +import { Icon } from "umi"; +const SvgIcon = props => { + const { iconClass = "add", className, size, offsetX, fill, offsetY } = props; return ( - - - + icon={`local:${iconClass}`} + /> ); }; diff --git a/src/icons/account.svg b/src/icons/account.svg new file mode 100644 index 0000000..54b547c --- /dev/null +++ b/src/icons/account.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/add.svg b/src/icons/add.svg new file mode 100644 index 0000000..c229691 --- /dev/null +++ b/src/icons/add.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/batchSubmit.svg b/src/icons/batchSubmit.svg new file mode 100644 index 0000000..a28c473 --- /dev/null +++ b/src/icons/batchSubmit.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/icons/batchSubmitCancel.svg b/src/icons/batchSubmitCancel.svg new file mode 100644 index 0000000..175d62e --- /dev/null +++ b/src/icons/batchSubmitCancel.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/icons/bottom.svg b/src/icons/bottom.svg new file mode 100644 index 0000000..2b4e9b4 --- /dev/null +++ b/src/icons/bottom.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/calculator.svg b/src/icons/calculator.svg new file mode 100644 index 0000000..4a1b94b --- /dev/null +++ b/src/icons/calculator.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/card.svg b/src/icons/card.svg new file mode 100644 index 0000000..1982d6f --- /dev/null +++ b/src/icons/card.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/check.svg b/src/icons/check.svg new file mode 100644 index 0000000..a9093ed --- /dev/null +++ b/src/icons/check.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/close.svg b/src/icons/close.svg new file mode 100644 index 0000000..7d40e2d --- /dev/null +++ b/src/icons/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/copy.svg b/src/icons/copy.svg new file mode 100644 index 0000000..011ccdb --- /dev/null +++ b/src/icons/copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/copyall.svg b/src/icons/copyall.svg new file mode 100644 index 0000000..4dbc2f4 --- /dev/null +++ b/src/icons/copyall.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/icons/custom.svg b/src/icons/custom.svg new file mode 100644 index 0000000..fb2373e --- /dev/null +++ b/src/icons/custom.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/icons/delete.svg b/src/icons/delete.svg new file mode 100644 index 0000000..7b6463f --- /dev/null +++ b/src/icons/delete.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/edit.svg b/src/icons/edit.svg new file mode 100644 index 0000000..1d3295f --- /dev/null +++ b/src/icons/edit.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/export.svg b/src/icons/export.svg new file mode 100644 index 0000000..d0a88e6 --- /dev/null +++ b/src/icons/export.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/function.svg b/src/icons/function.svg new file mode 100644 index 0000000..5e4b5da --- /dev/null +++ b/src/icons/function.svg @@ -0,0 +1 @@ + diff --git a/src/icons/function2.svg b/src/icons/function2.svg new file mode 100644 index 0000000..837a15c --- /dev/null +++ b/src/icons/function2.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/gen.svg b/src/icons/gen.svg new file mode 100644 index 0000000..a1e44db --- /dev/null +++ b/src/icons/gen.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/material.svg b/src/icons/material.svg new file mode 100644 index 0000000..0b1be88 --- /dev/null +++ b/src/icons/material.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/next.svg b/src/icons/next.svg new file mode 100644 index 0000000..efda033 --- /dev/null +++ b/src/icons/next.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/icons/nextpage.svg b/src/icons/nextpage.svg new file mode 100644 index 0000000..b2abde4 --- /dev/null +++ b/src/icons/nextpage.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/password.svg b/src/icons/password.svg new file mode 100644 index 0000000..38d79e0 --- /dev/null +++ b/src/icons/password.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/plus.svg b/src/icons/plus.svg new file mode 100644 index 0000000..4558a95 --- /dev/null +++ b/src/icons/plus.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/prevpage.svg b/src/icons/prevpage.svg new file mode 100644 index 0000000..7599f14 --- /dev/null +++ b/src/icons/prevpage.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/printer.svg b/src/icons/printer.svg new file mode 100644 index 0000000..040a7e8 --- /dev/null +++ b/src/icons/printer.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/icons/process.svg b/src/icons/process.svg new file mode 100644 index 0000000..6f728fa --- /dev/null +++ b/src/icons/process.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/reload.svg b/src/icons/reload.svg new file mode 100644 index 0000000..0dbe79f --- /dev/null +++ b/src/icons/reload.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/rollback.svg b/src/icons/rollback.svg new file mode 100644 index 0000000..7953996 --- /dev/null +++ b/src/icons/rollback.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/save.svg b/src/icons/save.svg new file mode 100644 index 0000000..cab7281 --- /dev/null +++ b/src/icons/save.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/search.svg b/src/icons/search.svg new file mode 100644 index 0000000..c532731 --- /dev/null +++ b/src/icons/search.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/setting.svg b/src/icons/setting.svg new file mode 100644 index 0000000..9d6907e --- /dev/null +++ b/src/icons/setting.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/icons/submit.svg b/src/icons/submit.svg new file mode 100644 index 0000000..9e4a479 --- /dev/null +++ b/src/icons/submit.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/icons/submitCancel.svg b/src/icons/submitCancel.svg new file mode 100644 index 0000000..d245939 --- /dev/null +++ b/src/icons/submitCancel.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/icons/top.svg b/src/icons/top.svg new file mode 100644 index 0000000..24f4500 --- /dev/null +++ b/src/icons/top.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/tree.svg b/src/icons/tree.svg new file mode 100644 index 0000000..3687307 --- /dev/null +++ b/src/icons/tree.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/icons/upload.svg b/src/icons/upload.svg new file mode 100644 index 0000000..5966528 --- /dev/null +++ b/src/icons/upload.svg @@ -0,0 +1,3 @@ + + +