mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-09-20 07:25:54 +08:00
hotfix: upload state
This commit is contained in:
parent
0232df8b93
commit
c5efdcb2e1
|
@ -1598,10 +1598,11 @@ class RbFormImage extends RbFormElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mp
|
let mp
|
||||||
let mpCount = 0
|
let mp_inpro = []
|
||||||
const mp_end = function () {
|
const mp_end = function (name) {
|
||||||
if (--mpCount > 0) return
|
if (mp_inpro === 0) mp_inpro = []
|
||||||
mpCount = 0
|
else mp_inpro.remove(name)
|
||||||
|
if (mp_inpro.length > 0) return
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (mp) mp.end()
|
if (mp) mp.end()
|
||||||
mp = null
|
mp = null
|
||||||
|
@ -1611,25 +1612,24 @@ class RbFormImage extends RbFormElement {
|
||||||
$createUploader(
|
$createUploader(
|
||||||
this._fieldValue__input,
|
this._fieldValue__input,
|
||||||
(res) => {
|
(res) => {
|
||||||
mpCount++
|
if (!mp_inpro.includes(res.file.name)) mp_inpro.push(res.file.name)
|
||||||
if (!mp) mp = new Mprogress({ template: 2, start: true })
|
if (!mp) mp = new Mprogress({ template: 2, start: true })
|
||||||
mp.set(res.percent / 100) // 0.x
|
mp.set(res.percent / 100) // 0.x
|
||||||
},
|
},
|
||||||
(res) => {
|
(res) => {
|
||||||
mp_end()
|
mp_end(res.file.name)
|
||||||
const paths = this.state.value || []
|
const paths = this.state.value || []
|
||||||
// 最多上传,多余忽略
|
// 最多上传,多余忽略
|
||||||
if (paths.length < this.__maxUpload) {
|
if (paths.length < this.__maxUpload) {
|
||||||
let hasByName = $fileCutName(res.key)
|
let hasByName = $fileCutName(res.key)
|
||||||
hasByName = paths.find((x) => $fileCutName(x) === hasByName)
|
hasByName = paths.find((x) => $fileCutName(x) === hasByName)
|
||||||
console.log(hasByName)
|
|
||||||
if (!hasByName) {
|
if (!hasByName) {
|
||||||
paths.push(res.key)
|
paths.push(res.key)
|
||||||
this.handleChange({ target: { value: paths } }, true)
|
this.handleChange({ target: { value: paths } }, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() => mp_end()
|
() => mp_end(0)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 拖拽上传
|
// 拖拽上传
|
||||||
|
|
Loading…
Reference in a new issue