diff --git a/src/views/system/storage/StorageAddModal.vue b/src/views/system/storage/StorageAddModal.vue
index 97170d3f..7fbfa4c6 100644
--- a/src/views/system/storage/StorageAddModal.vue
+++ b/src/views/system/storage/StorageAddModal.vue
@@ -16,13 +16,18 @@
-
+
-
+
-
+
@@ -89,11 +94,13 @@ import { Message, type FormInstance } from '@arco-design/web-vue'
import { useForm } from '@/hooks'
import { useDict } from '@/hooks/app'
import { useWindowSize } from '@vueuse/core'
+import { encryptByRsa } from '@/utils/encrypt'
const { width } = useWindowSize()
const { storage_type_enum } = useDict('storage_type_enum')
const dataId = ref('')
+const updatedSecretKey = ref(false)
const isUpdate = computed(() => !!dataId.value)
const title = computed(() => (isUpdate.value ? '修改存储' : '新增存储'))
const formRef = ref()
@@ -113,6 +120,7 @@ const { form, resetForm } = useForm({
code: '',
type: 2,
accessKey: undefined,
+ secretKeyEncrypted: undefined,
secretKey: undefined,
endpoint: undefined,
bucketName: undefined,
@@ -146,16 +154,24 @@ const onUpdate = async (id: string) => {
visible.value = true
}
+const updateSecretKey = () => {
+ updatedSecretKey.value = true
+}
+
// 保存
const save = async () => {
try {
const isInvalid = await formRef.value?.validate()
if (isInvalid) return false
+ const data = Object.assign({}, form)
+ if (data.type === 1) {
+ data.secretKey = updatedSecretKey.value ? encryptByRsa(form.secretKey) : form.secretKeyEncrypted
+ }
if (isUpdate.value) {
- await updateStorage(form, dataId.value)
+ await updateStorage(data, dataId.value)
Message.success('修改成功')
} else {
- await addStorage(form)
+ await addStorage(data)
Message.success('新增成功')
}
emit('save-success')
diff --git a/src/views/system/storage/type.ts b/src/views/system/storage/type.ts
index d329730a..b3157985 100644
--- a/src/views/system/storage/type.ts
+++ b/src/views/system/storage/type.ts
@@ -4,6 +4,7 @@ export interface StorageReq {
type: number
accessKey: string
secretKey: string
+ secretKeyEncrypted: string
endpoint: string
bucketName: string
domain: string