资源-上传修改

This commit is contained in:
lyc 2024-07-26 09:43:59 +08:00
parent e221bedb81
commit 5fea7e094d
5 changed files with 45 additions and 20 deletions

View File

@ -12,6 +12,7 @@ asarUnpack:
- resources/**
win:
executableName: AIx
icon: resources/logo.ico
nsis:
oneClick: false
allowToChangeInstallationDirectory: true

View File

@ -12,6 +12,7 @@ asarUnpack:
- resources/**
win:
executableName: AIx
icon: resources/logo.ico
nsis:
oneClick: false
allowToChangeInstallationDirectory: true

BIN
resources/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

View File

@ -4,11 +4,12 @@
<el-form>
<el-form-item label="文件">
<div class="create-item file-item flex">
<el-upload :file-list="fileList" :show-file-list="false" :auto-upload="false" multiple
<el-upload :file-list="fileList" :limit="limit" :show-file-list="false" :auto-upload="false" multiple
:on-change="hanleFileChange">
<el-button slot="trigger">选择文件</el-button>
</el-upload>
<span class="upload-desc">说明一次最多上传5个文件单个文件大小不能大于100M</span>
<span class="upload-desc">说明一次最多上传{{ limit }}个文件单个文件大小不能大于100M</span>
<span class="upload-desc">仅支持图片音频视频wordpptpdftxtzip文件</span>
</div>
</el-form-item>
<el-form-item>
@ -23,7 +24,8 @@
<div class="flex-type flex">
<span class="name">类别</span>
<el-select v-model="item.fileData.fileFlag" placeholder="Select" style="width: 100px">
<el-option v-for="item in resourceType" :key="item.alue" :label="item.label" :value="item.value" />
<el-option v-for="el in resourceType" :key="el.alue" :label="el.label" :value="el.value"
:disabled="checkFile(el, item)" />
</el-select>
</div>
@ -58,6 +60,7 @@ const props = defineProps({
},
})
const dialogValue = ref(false)
const limit = ref(5)
// emit
const emit = defineEmits(['update:modelValue', 'submitFile'])
//
@ -93,6 +96,8 @@ 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的文件!')
@ -102,13 +107,28 @@ const hanleFileChange = (file) => {
// 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)
@ -203,11 +223,14 @@ const submitFile = () => {
}
}
}
.file-input {
border-bottom: solid #dfdfdf 1px;
&:hover {
border-color: #409EFF;
}
&:focus {
border-color: #409EFF;
}
@ -216,11 +239,12 @@ const submitFile = () => {
:deep(.el-input__wrapper) {
box-shadow: none
}
:deep(.el-input__wrapper.is-focus) {
box-shadow: none
}
:deep(.el-input__wrapper:hover) {
box-shadow: none
}
</style>

View File

@ -71,7 +71,6 @@ const submitFile = (data) => {
item.fileData = fileData
item.callback = fileCallBack
})
// console.log(fileList)
uploaderState().pushFile(fileList)
}