@@ -241,6 +241,7 @@ export default { | |||||
const fileType = fileInfo.F_FileType | const fileType = fileInfo.F_FileType | ||||
const fileSize = fileInfo.F_FileSize | const fileSize = fileInfo.F_FileSize | ||||
const fileName = fileInfo.F_FileName | |||||
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | ||||
fileList.push({ | fileList.push({ | ||||
@@ -248,7 +249,8 @@ export default { | |||||
type: fileType, | type: fileType, | ||||
uid:wxfile.F_Id, | uid:wxfile.F_Id, | ||||
folderId:wxfile.F_FolderId, | folderId:wxfile.F_FolderId, | ||||
size: fileSize | |||||
size: fileSize, | |||||
name:fileName | |||||
}) | }) | ||||
} | } | ||||
return fileList | return fileList | ||||
@@ -191,22 +191,38 @@ export default { | |||||
return val ? moment(val).format('YYYY-MM-DD HH:mm') : '' | return val ? moment(val).format('YYYY-MM-DD HH:mm') : '' | ||||
case 'upload': | case 'upload': | ||||
const uploadUid = [] | |||||
for (const entity of val) { | |||||
if (entity.uid) { | |||||
uploadUid.push(entity.uid) | |||||
continue | |||||
} else { | |||||
const fileId = await this.HTTP_UPLOAD(entity) | |||||
if (fileId) { | |||||
uploadUid.push(fileId) | |||||
} | |||||
} | |||||
} | |||||
return uploadUid.join(',') | |||||
// const uploadUid = [] | |||||
// for (const entity of val) { | |||||
// if (entity.uid) { | |||||
// uploadUid.push(entity.uid) | |||||
// continue | |||||
// } else { | |||||
// const fileId = await this.HTTP_UPLOAD(entity) | |||||
// if (fileId) { | |||||
// uploadUid.push(fileId) | |||||
// } | |||||
// } | |||||
// } | |||||
// return uploadUid.join(',') | |||||
var uploadUid = ''; | |||||
for (const item of val) { | |||||
if (item.uid) { | |||||
uploadUid = item.uid | |||||
continue | |||||
} | |||||
const fileId = await this.HTTP_UPLOAD(item.path || item, undefined, guid || '') | |||||
if (fileId) { | |||||
uploadUid = fileId; | |||||
} | |||||
} | |||||
return uploadUid; | |||||
default: | default: | ||||
return val || '' | return val || '' | ||||
@@ -245,21 +261,49 @@ export default { | |||||
async convertToFormValue(scheme, val, dataSource) { | async convertToFormValue(scheme, val, dataSource) { | ||||
switch (scheme.type) { | switch (scheme.type) { | ||||
case 'upload': | case 'upload': | ||||
if (!val) { return [] } | |||||
const uidList = val.split(',') | |||||
const fileList = [] | |||||
for (const uid of uidList || []) { | |||||
const fileInfo = await this.FETCH_FILEINFO(uid) | |||||
if (!fileInfo) { continue } | |||||
const fileType = fileInfo.F_FileType | |||||
const fileSize = fileInfo.F_FileSize | |||||
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(uid, true) | |||||
fileList.push({ path, type: fileType, uid, size: fileSize }) | |||||
} | |||||
return fileList | |||||
// if (!val) { return [] } | |||||
// const uidList = val.split(',') | |||||
// const fileList = [] | |||||
// for (const uid of uidList || []) { | |||||
// const fileInfo = await this.FETCH_FILEINFO(uid) | |||||
// if (!fileInfo) { continue } | |||||
// const fileType = fileInfo.F_FileType | |||||
// const fileSize = fileInfo.F_FileSize | |||||
// const fileName = fileInfo.F_FileName | |||||
// const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(uid, true) | |||||
// fileList.push({ path, type: fileType, uid, size: fileSize, name:fileName }) | |||||
// } | |||||
// return fileList | |||||
if (!val) { | |||||
return [] | |||||
} | |||||
const uidList = val; | |||||
const fileList = [] | |||||
const wxlist = await this.FETCH_FILEList(uidList); | |||||
for (const wxfile of wxlist) { | |||||
const fileInfo = await this.FETCH_FILEINFO(wxfile.F_Id) | |||||
if (!fileInfo) { | |||||
continue | |||||
} | |||||
const fileType = fileInfo.F_FileType | |||||
const fileSize = fileInfo.F_FileSize | |||||
const fileName = fileInfo.F_FileName | |||||
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | |||||
fileList.push({ | |||||
path, | |||||
type: fileType, | |||||
uid:wxfile.F_Id, | |||||
folderId:wxfile.F_FolderId, | |||||
size: fileSize, | |||||
name:fileName | |||||
}) | |||||
} | |||||
return fileList | |||||
case 'radio': | case 'radio': | ||||
case 'select': | case 'select': | ||||
@@ -237,7 +237,7 @@ export default { | |||||
return await this.HTTP_GET('learun/adms/annexes/wxlist', folderId) | return await this.HTTP_GET('learun/adms/annexes/wxlist', folderId) | ||||
}, | }, | ||||
// 根据文件夹id获取图片列表 | |||||
// 根据文件夹id获取图片列表用于上传组件 | |||||
async getFileListById(folderId){ | async getFileListById(folderId){ | ||||
if(!folderId){ | if(!folderId){ | ||||
return [] | return [] | ||||
@@ -251,6 +251,7 @@ export default { | |||||
const fileType = fileInfo.F_FileType | const fileType = fileInfo.F_FileType | ||||
const fileSize = fileInfo.F_FileSize | const fileSize = fileInfo.F_FileSize | ||||
const fileName = fileInfo.F_FileName | |||||
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | ||||
fileList.push({ | fileList.push({ | ||||
@@ -258,7 +259,8 @@ export default { | |||||
type: fileType, | type: fileType, | ||||
uid:wxfile.F_Id, | uid:wxfile.F_Id, | ||||
folderId:wxfile.F_FolderId, | folderId:wxfile.F_FolderId, | ||||
size: fileSize | |||||
size: fileSize, | |||||
name:fileName | |||||
}) | }) | ||||
} | } | ||||
return fileList | return fileList | ||||
@@ -9,7 +9,8 @@ | |||||
<view class="cu-form-group" style="border-top: none;"> | <view class="cu-form-group" style="border-top: none;"> | ||||
<view class="grid col-4 grid-square flex-sub"> | <view class="grid col-4 grid-square flex-sub"> | ||||
<view v-for="(file, index) in value" :key="index" class="bg-img"> | |||||
<view v-for="(file, index) in value" :key="index" class="bg-img" style="position: relative;"> | |||||
<view v-if="file.noUpdated" class="mask"></view> | |||||
<image | <image | ||||
v-if="isImgFile(file.type)" | v-if="isImgFile(file.type)" | ||||
@click="fileClick(index)" | @click="fileClick(index)" | ||||
@@ -54,8 +55,7 @@ export default { | |||||
isImgFile(type) { | isImgFile(type) { | ||||
const typeString = (type || '').toLowerCase() | const typeString = (type || '').toLowerCase() | ||||
//return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'image'].includes(typeString) | |||||
return true; | |||||
return ['jpg','image/jpg','jpeg','image/jpeg', 'png', 'image/png','gif', 'image/gif','bmp', 'image/bmp','webp', 'image/webp','image'].includes(typeString) | |||||
}, | }, | ||||
isDocFile(type) { | isDocFile(type) { | ||||
@@ -107,9 +107,10 @@ export default { | |||||
count: Number(this.number), | count: Number(this.number), | ||||
sizeType: ['original', 'compressed'], | sizeType: ['original', 'compressed'], | ||||
sourceType: ['album', 'camera'], | sourceType: ['album', 'camera'], | ||||
success: ({ tempFilePaths }) => { | |||||
success: ({ tempFilePaths,tempFiles }) => { | |||||
const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | const newList = JSON.parse(JSON.stringify(this.value || [])).concat( | ||||
tempFilePaths//.map(t => ({ path: t, type: this.getFileExt(t) })) | |||||
// tempFilePaths//.map(t => ({ path: t, type: this.getFileExt(t) })) | |||||
tempFilePaths.map((t,i) => ({ path: t, type: tempFiles[i].type, size:tempFiles[i].size, name:tempFiles[i].name, noUpdated:true} )) | |||||
) | ) | ||||
this.$emit('input', newList) | this.$emit('input', newList) | ||||
this.$emit('change', newList) | this.$emit('change', newList) | ||||
@@ -171,4 +172,14 @@ export default { | |||||
line-height: 100%; | line-height: 100%; | ||||
position: static; | position: static; | ||||
} | } | ||||
.mask{ | |||||
position: absolute; | |||||
top: 0;left: 0; | |||||
width: 100%; | |||||
height: 100%; | |||||
// background: rgba(255,252,153,0.2); | |||||
background: rgba(0,0,0,0.7); | |||||
z-index: 100; | |||||
pointer-events: none; | |||||
} | |||||
</style> | </style> |