diff --git a/.env.develop b/.env.develop index d417d769..c8349cd4 100644 --- a/.env.develop +++ b/.env.develop @@ -1 +1,2 @@ +ENV=develop VITE_APP_BASE_API=/api \ No newline at end of file diff --git a/.env.production b/.env.production index d417d769..990e0635 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ +ENV=production VITE_APP_BASE_API=/api \ No newline at end of file diff --git a/plugin/optimize.ts b/plugin/optimize.ts new file mode 100644 index 00000000..75e6721b --- /dev/null +++ b/plugin/optimize.ts @@ -0,0 +1,49 @@ +import fs from 'fs' +import path from 'path' + +const rootPath = path.resolve(__dirname, '../') + +function optimizeAntdComponents(moduleName: string): string[] { + const moduleESPath = `${moduleName}/es` + const nodeModulePath = `./node_modules/${moduleESPath}` + const includes: string[] = [moduleESPath] + + const folders = fs.readdirSync( + path.resolve(rootPath, nodeModulePath) + ) + + folders.map(name => { + const folderName = path.resolve( + rootPath, + nodeModulePath, + name + ) + let stat = fs.lstatSync(folderName) + if (stat.isDirectory()) { + let styleFolder = path.resolve(folderName, 'style') + if (fs.existsSync((styleFolder))) { + let _stat = fs.lstatSync(styleFolder) + if (_stat.isDirectory()) { + includes.push(`${moduleESPath}/${name}/style`) + } + } + } + }) + + return includes +} + +export function optimizeDeps() { + return { + name: "optimizeDeps", + configResolved: async (config) => { + const components = [ + ...optimizeAntdComponents('ant-design-vue'), + ...optimizeAntdComponents('jetlinks-ui-components') + ] + let concat = config.optimizeDeps.include.concat(components) + config.optimizeDeps.include = Array.from(new Set(concat)) + console.log(config.optimizeDeps.include) + } + } +} \ No newline at end of file diff --git a/src/components/BadgeStatus/color.ts b/src/components/BadgeStatus/color.ts new file mode 100644 index 00000000..6d9f18d3 --- /dev/null +++ b/src/components/BadgeStatus/color.ts @@ -0,0 +1,17 @@ + +const color = { + 'processing': '64, 169, 255', + 'error': '247, 79, 70', + 'success': '74, 234, 220', + 'warning': '250, 178, 71', + 'default': '63, 73, 96' +} +export const getHexColor = (code: string, pe: number = 0.3) => { + const _color = color[code] || color.default + if (code === 'default') { + pe = 0.1 + } + return `rgba(${_color}, ${pe})` +} + +export default color \ No newline at end of file diff --git a/src/components/BadgeStatus/index.vue b/src/components/BadgeStatus/index.vue index 403cbbe6..d1a9528c 100644 --- a/src/components/BadgeStatus/index.vue +++ b/src/components/BadgeStatus/index.vue @@ -1,12 +1,13 @@ diff --git a/src/components/CardBox/index.vue b/src/components/CardBox/index.vue index eb6087c0..6174471a 100644 --- a/src/components/CardBox/index.vue +++ b/src/components/CardBox/index.vue @@ -29,7 +29,9 @@
-