diff --git a/.env.development b/.env.development index 53ae057..ad47825 100644 --- a/.env.development +++ b/.env.development @@ -18,6 +18,8 @@ VITE_APP_POWERJOB_ADMIN = 'http://localhost:7700/' VITE_APP_PORT = 80 +# 接口加密功能开关(如需关闭 后端也必须对应关闭) +VITE_APP_ENCRYPT = true # 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换 VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==' # 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换 diff --git a/.env.production b/.env.production index 0e3b9fc..c15308f 100644 --- a/.env.production +++ b/.env.production @@ -21,6 +21,8 @@ VITE_BUILD_COMPRESS = gzip VITE_APP_PORT = 80 +# 接口加密功能开关(如需关闭 后端也必须对应关闭) +VITE_APP_ENCRYPT = true # 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换 VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==' # 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换 diff --git a/package.json b/package.json index 23a9cce..751bd6f 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "file-saver": "2.0.5", "fuse.js": "7.0.0", "highlight.js": "11.9.0", + "image-conversion": "^2.1.1", "js-cookie": "3.0.5", "jsencrypt": "3.3.2", "moddle": "6.2.3", @@ -76,10 +77,10 @@ "eslint": "8.56.0", "eslint-config-prettier": "9.1.0", "eslint-define-config": "2.1.0", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-node": "11.1.0", "eslint-plugin-prettier": "5.1.3", "eslint-plugin-promise": "6.1.1", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-import": "2.29.1", "eslint-plugin-vue": "9.20.1", "fast-glob": "3.3.2", "husky": "8.0.3", diff --git a/src/components/DictTag/index.vue b/src/components/DictTag/index.vue index b355a42..7442546 100644 --- a/src/components/DictTag/index.vue +++ b/src/components/DictTag/index.vue @@ -50,12 +50,13 @@ const values = computed(() => { const unmatch = computed(() => { if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false; // 传入值为非数组 + let unmatch = false; // 添加一个标志来判断是否有未匹配项 values.value.forEach((item) => { if (!props.options.some((v) => v.value === item)) { - return true; // 如果有未匹配项,将标志设置为true + unmatch = true; // 如果有未匹配项,将标志设置为true } }); - return false; // 返回标志的值 + return unmatch; // 返回标志的值 }); const unmatchArray = computed(() => { diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index ae5cd45..1c6dcd1 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -44,6 +44,7 @@ import { listByIds, delOss } from '@/api/system/oss'; import { OssVO } from '@/api/system/oss/types'; import { propTypes } from '@/utils/propTypes'; import { globalHeaders } from '@/utils/request'; +import { compressAccurately } from 'image-conversion'; const props = defineProps({ modelValue: { @@ -60,7 +61,14 @@ const props = defineProps({ isShowTip: { type: Boolean, default: true - } + }, + // 是否支持压缩,默认否 + compressSupport: { + type: Boolean, + default: false + }, + // 压缩目标大小,单位KB。默认300KB以上文件才压缩,并压缩至300KB以内 + compressTargetSize: propTypes.number.def(300) }); const { proxy } = getCurrentInstance() as ComponentInternalInstance; @@ -138,8 +146,16 @@ const handleBeforeUpload = (file: any) => { return false; } } - proxy?.$modal.loading('正在上传图片,请稍候...'); - number.value++; + + //压缩图片,开启压缩并且大于指定的压缩大小时才压缩 + if (props.compressSupport && file.size / 1024 > props.compressTargetSize) { + proxy?.$modal.loading('正在上传图片,请稍候...'); + number.value++; + return compressAccurately(file, props.compressTargetSize); + } else { + proxy?.$modal.loading('正在上传图片,请稍候...'); + number.value++; + } }; // 文件个数超出 diff --git a/src/components/RoleSelect/index.vue b/src/components/RoleSelect/index.vue index e190b20..ec5bcc7 100644 --- a/src/components/RoleSelect/index.vue +++ b/src/components/RoleSelect/index.vue @@ -36,7 +36,7 @@ :data="roleList" :loading="loading" :row-config="{ keyField: 'roleId' }" - :checkbox-config="{ reserve: true, checkRowKeys: defaultSelectRoleIds }" + :checkbox-config="{ reserve: true, checkRowKeys: roleIds }" highlight-current-row @checkbox-all="handleCheckboxAll" @checkbox-change="handleCheckboxChange" @@ -63,41 +63,42 @@ v-model:total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" - @pagination="pageList" + @pagination="getList" /> - + +onMounted(() => { + getList(); +}); + \ No newline at end of file diff --git a/src/components/UserSelect/index.vue b/src/components/UserSelect/index.vue index d544330..f2ef014 100644 --- a/src/components/UserSelect/index.vue +++ b/src/components/UserSelect/index.vue @@ -47,7 +47,7 @@ -