From ce9ce6ff4ae398a8e2ea75c9667f45698996a3e5 Mon Sep 17 00:00:00 2001
From: xieyonghong <18010623010@163.com>
Date: Tue, 14 Mar 2023 15:37:37 +0800
Subject: [PATCH] =?UTF-8?q?update:=20=E4=BF=AE=E6=94=B9Upload=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E5=90=8D;=E4=BC=98=E5=8C=96CardBox=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.develop | 1 +
.env.production | 1 +
plugin/optimize.ts | 49 +++++++++++++++++++
src/components/BadgeStatus/color.ts | 17 +++++++
src/components/BadgeStatus/index.vue | 17 ++++++-
src/components/CardBox/index.vue | 9 ++--
src/components/{JUpload => Upload}/index.vue | 2 +-
src/components/ValueItem/index.vue | 5 +-
src/components/index.ts | 2 +-
src/main.ts | 3 --
.../Save/components/DropdownButton/util.ts | 2 +-
.../Save/components/ParamsDropdown/index.vue | 2 +-
src/vite-env.d.ts | 1 +
vite.config.ts | 7 ++-
14 files changed, 103 insertions(+), 15 deletions(-)
create mode 100644 plugin/optimize.ts
create mode 100644 src/components/BadgeStatus/color.ts
rename src/components/{JUpload => Upload}/index.vue (99%)
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 @@