Przeglądaj źródła

修改js为上传组件的修改做准备 增加蒙版

长阳分支推送专用
杨晓琪 2 lat temu
rodzic
commit
be8f8d72fa
4 zmienionych plików z 98 dodań i 39 usunięć
  1. +3
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/customform.js
  2. +75
    -31
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js
  3. +4
    -2
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js
  4. +16
    -5
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/upload-file.vue

+ 3
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/customform.js Wyświetl plik

@@ -241,6 +241,7 @@ export default {

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({
@@ -248,7 +249,8 @@ export default {
type: fileType,
uid:wxfile.F_Id,
folderId:wxfile.F_FolderId,
size: fileSize
size: fileSize,
name:fileName
})
}
return fileList


+ 75
- 31
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js Wyświetl plik

@@ -191,22 +191,38 @@ export default {
return val ? moment(val).format('YYYY-MM-DD HH:mm') : ''

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:
return val || ''
@@ -245,21 +261,49 @@ export default {
async convertToFormValue(scheme, val, dataSource) {
switch (scheme.type) {
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 'select':


+ 4
- 2
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/mixins.js Wyświetl plik

@@ -237,7 +237,7 @@ export default {
return await this.HTTP_GET('learun/adms/annexes/wxlist', folderId)
},
// 根据文件夹id获取图片列表
// 根据文件夹id获取图片列表用于上传组件
async getFileListById(folderId){
if(!folderId){
return []
@@ -251,6 +251,7 @@ export default {
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({
@@ -258,7 +259,8 @@ export default {
type: fileType,
uid:wxfile.F_Id,
folderId:wxfile.F_FolderId,
size: fileSize
size: fileSize,
name:fileName
})
}
return fileList


+ 16
- 5
Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/learun-app/upload-file.vue Wyświetl plik

@@ -9,7 +9,8 @@

<view class="cu-form-group" style="border-top: none;">
<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
v-if="isImgFile(file.type)"
@click="fileClick(index)"
@@ -54,8 +55,7 @@ export default {

isImgFile(type) {
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) {
@@ -107,9 +107,10 @@ export default {
count: Number(this.number),
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: ({ tempFilePaths }) => {
success: ({ tempFilePaths,tempFiles }) => {
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('change', newList)
@@ -171,4 +172,14 @@ export default {
line-height: 100%;
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>

Ładowanie…
Anuluj
Zapisz