diff --git a/electron-builder-test.yml b/electron-builder-test.yml index 86eda95..61fba8f 100644 --- a/electron-builder-test.yml +++ b/electron-builder-test.yml @@ -12,6 +12,7 @@ asarUnpack: - resources/** win: executableName: AIx + icon: resources/logo.ico nsis: oneClick: false allowToChangeInstallationDirectory: true diff --git a/electron-builder.yml b/electron-builder.yml index 2834cf9..cb2cf97 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -12,6 +12,7 @@ asarUnpack: - resources/** win: executableName: AIx + icon: resources/logo.ico nsis: oneClick: false allowToChangeInstallationDirectory: true diff --git a/resources/logo.ico b/resources/logo.ico new file mode 100644 index 0000000..4c33239 Binary files /dev/null and b/resources/logo.ico differ diff --git a/src/renderer/src/components/upload-dialog/index.vue b/src/renderer/src/components/upload-dialog/index.vue index 9d73b35..4615780 100644 --- a/src/renderer/src/components/upload-dialog/index.vue +++ b/src/renderer/src/components/upload-dialog/index.vue @@ -4,11 +4,12 @@
- 选择文件 - 说明:一次最多上传5个文件,单个文件大小不能大于100M + 说明:一次最多上传{{ limit }}个文件,单个文件大小不能大于100M + 仅支持图片、音频、视频、word、ppt、pdf、txt、zip文件
@@ -16,14 +17,15 @@
标题: - - + + .{{ getFileSuffix(item.name) }}
类别: - +
@@ -58,6 +60,7 @@ const props = defineProps({ }, }) const dialogValue = ref(false) +const limit = ref(5) // 定义要发送的emit事件 const emit = defineEmits(['update:modelValue', 'submitFile']) // 文件列表 @@ -68,7 +71,7 @@ watch(() => props.modelValue, (newVal) => { }) const hanleFileChange = (file) => { - console.log(file) + console.log(file) //音频 类型 const audioTypes = ['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/aac'] @@ -81,9 +84,9 @@ const hanleFileChange = (file) => { // pdf 类型 const pdfTypes = ['application/pdf'] // zip 类型 - const zipTypes = ['application/x-zip-compressed','application/x-compressed'] + const zipTypes = ['application/x-zip-compressed', 'application/x-compressed'] // 图片 类型 - const imgTypes = ['image/jpeg','image/gif', 'image/png'] + const imgTypes = ['image/jpeg', 'image/gif', 'image/png'] // text 类型 const textTypes = ['text/plain'] @@ -93,22 +96,39 @@ const hanleFileChange = (file) => { return false } // 验证文件大小 + // B < KB < MB < GB + // file.raw.size 单位是B const fileSize = file.raw.size / 1024 / 1024 > 100 if (fileSize) { ElMessage.error('文件大小错误! 请上传小于100M的文件!') return false } if (file.status === 'ready') { - + // 给一个默认的fileData file.fileData = { - fileFlag: '课件', + fileFlag: '素材', name: getFileName(file.name), } fileList.value.push(file) + console.log(fileList.value) } } +// 检查文件类型 +const checkFile = (item, file) => { + const type = file.raw.type + const pptTypes = ['application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'] + let isPpt = pptTypes.includes(type) + if(!isPpt && item.value == '教案'){ + return true + } + else{ + return false + } + +} + // 删除 const delFile = (index) => { fileList.value.splice(index, 1) @@ -133,7 +153,7 @@ const submitFile = () => { item.fileData.fileShowName = item.fileData.name + '.' + suffix delete item.fileData.name }) - emit('submitFile',fileList.value) + emit('submitFile', fileList.value) closeDialog() } @@ -203,24 +223,28 @@ const submitFile = () => { } } } + .file-input { border-bottom: solid #dfdfdf 1px; + &:hover { border-color: #409EFF; } - &:focus{ + + &:focus { border-color: #409EFF; } } -:deep(.el-input__wrapper){ - box-shadow: none -} -:deep(.el-input__wrapper.is-focus){ - box-shadow: none -} -:deep(.el-input__wrapper:hover){ +:deep(.el-input__wrapper) { box-shadow: none } +:deep(.el-input__wrapper.is-focus) { + box-shadow: none +} + +:deep(.el-input__wrapper:hover) { + box-shadow: none +} diff --git a/src/renderer/src/views/resource/index.vue b/src/renderer/src/views/resource/index.vue index 8550e42..6720e26 100644 --- a/src/renderer/src/views/resource/index.vue +++ b/src/renderer/src/views/resource/index.vue @@ -71,7 +71,6 @@ const submitFile = (data) => { item.fileData = fileData item.callback = fileCallBack }) - // console.log(fileList) uploaderState().pushFile(fileList) }