调整Upload组件
This commit is contained in:
parent
198296713b
commit
297cc9379e
|
|
@ -107,11 +107,7 @@ export default OakComponent({
|
||||||
return (750 / windowWidth) * px;
|
return (750 / windowWidth) * px;
|
||||||
},
|
},
|
||||||
async onPick() {
|
async onPick() {
|
||||||
const {
|
const { selectCount, mediaType, sourceType } = this.props;
|
||||||
selectCount,
|
|
||||||
mediaType,
|
|
||||||
sourceType,
|
|
||||||
} = this.props;
|
|
||||||
try {
|
try {
|
||||||
const { errMsg, tempFiles } = await wx.chooseMedia({
|
const { errMsg, tempFiles } = await wx.chooseMedia({
|
||||||
count: selectCount,
|
count: selectCount,
|
||||||
|
|
@ -154,9 +150,9 @@ export default OakComponent({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async onWebPick(value) {
|
async onWebPick(uploadFiles) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
value.map(async (uploadFile) => {
|
uploadFiles.map(async (uploadFile) => {
|
||||||
const { name, type: fileType, size, raw } = uploadFile;
|
const { name, type: fileType, size, raw } = uploadFile;
|
||||||
this.pushExtraFile({
|
this.pushExtraFile({
|
||||||
name,
|
name,
|
||||||
|
|
@ -167,7 +163,12 @@ export default OakComponent({
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
async pushExtraFile(options: { name: string, extra1: any, fileType: string, size: number }) {
|
async pushExtraFile(options: {
|
||||||
|
name: string;
|
||||||
|
extra1: any;
|
||||||
|
fileType: string;
|
||||||
|
size: number;
|
||||||
|
}) {
|
||||||
const { type, origin, tag1, tag2, entity } = this.props;
|
const { type, origin, tag1, tag2, entity } = this.props;
|
||||||
const { name, extra1, fileType, size } = options;
|
const { name, extra1, fileType, size } = options;
|
||||||
const extension = name.substring(name.lastIndexOf('.') + 1);
|
const extension = name.substring(name.lastIndexOf('.') + 1);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Upload, UploadFile } from 'tdesign-mobile-react';
|
import { Upload, UploadFile } from 'tdesign-react';
|
||||||
import { composeFileUrl } from '../../../../lib/utils/extraFile';
|
import { composeFileUrl } from '../../../../lib/utils/extraFile';
|
||||||
|
|
||||||
function extraFileToUploadFile(extraFile, systemConfig) {
|
function extraFileToUploadFile(extraFile, systemConfig) {
|
||||||
|
|
@ -23,6 +23,8 @@ export default function render() {
|
||||||
autoUpload={false}
|
autoUpload={false}
|
||||||
max={maxNumber}
|
max={maxNumber}
|
||||||
accept={mediaType}
|
accept={mediaType}
|
||||||
|
showUploadProgress={false}
|
||||||
|
theme="image"
|
||||||
files={(files || []).map((ele) =>
|
files={(files || []).map((ele) =>
|
||||||
extraFileToUploadFile(ele, systemConfig)
|
extraFileToUploadFile(ele, systemConfig)
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -31,5 +31,5 @@
|
||||||
}
|
}
|
||||||
.btn-item {
|
.btn-item {
|
||||||
margin-top: 32rpx;
|
margin-top: 32rpx;
|
||||||
margin-right: 32rpx;
|
margin-right: 32rpx !important;
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ const locale: LocaleDef<Schema, '', '', {
|
||||||
depth: '深度',
|
depth: '深度',
|
||||||
parent: '上级地区',
|
parent: '上级地区',
|
||||||
name: '名称',
|
name: '名称',
|
||||||
code: '邮政编码',
|
code: '地区编码',
|
||||||
center: '中心坐标',
|
center: '中心坐标',
|
||||||
},
|
},
|
||||||
v: {
|
v: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue