diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue index 8a67a50..9774791 100644 --- a/src/views/system/oss/index.vue +++ b/src/views/system/oss/index.vue @@ -214,11 +214,10 @@ const getList = async () => { showTable.value = true; }; -function checkFileSuffix(fileSuffix: string[]) { - let arr = ['png', 'jpg', 'jpeg']; - return arr.some((type) => { - return fileSuffix.indexOf(type) > -1; - }); +function checkFileSuffix(fileSuffix: string | string[]) { + const arr = [".png", ".jpg", ".jpeg"]; + const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix]; + return suffixArray.some(suffix => arr.includes(suffix.toLowerCase())); } /** 取消按钮 */ @@ -333,7 +332,7 @@ const handlePreviewListResource = async (preview: boolean) => { let text = preview ? '启用' : '停用'; try { await proxy?.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?'); - const res = await proxy?.getConfigKey('sys.oss.previewListResource'); + const res = await proxy?.getConfigKey('sys.oss.previewListResource'); await proxy?.updateConfigByKey('sys.oss.previewListResource', preview, res.data.version); await getList(); proxy?.$modal.msgSuccess(text + '成功');