|
|
@@ -482,6 +482,8 @@ function isExists (obj) {
|
|
|
if (file) {
|
|
|
return {
|
|
|
result: true,
|
|
|
+ type: 'warning',
|
|
|
+ title: '文件上传',
|
|
|
message: obj.name === file.name ? `${obj.name}已在上传列表中` : `${obj.name}在上传列表中存在同内容文件${file.name}`
|
|
|
}
|
|
|
}
|
|
|
@@ -500,14 +502,17 @@ function isExists (obj) {
|
|
|
({ data }) => {
|
|
|
return {
|
|
|
result: true,
|
|
|
- message: `${obj.name}已上传过,文件名为${data.originalName}`
|
|
|
+ type: 'warning',
|
|
|
+ title: '文件上传',
|
|
|
+ message: `${obj.name}已上传过,文件名为${data.originalName}`,
|
|
|
+ duration: 0
|
|
|
}
|
|
|
},
|
|
|
({ errCode, data }) => {
|
|
|
if (errCode === '666') {
|
|
|
return {
|
|
|
result: false,
|
|
|
- message: data
|
|
|
+ chunks: data
|
|
|
}
|
|
|
}
|
|
|
return Promise.reject()
|
|
|
@@ -518,12 +523,12 @@ function isExists (obj) {
|
|
|
async function startCheck (obj) {
|
|
|
try {
|
|
|
setState(obj, State.CHECK)
|
|
|
- const { result, message } = await isExists(obj)
|
|
|
+ const { result, ...options } = await isExists(obj)
|
|
|
if (result) {
|
|
|
- finish(obj, message)
|
|
|
+ finish(obj, options)
|
|
|
return
|
|
|
}
|
|
|
- message.forEach(chunkNumber => {
|
|
|
+ options.chunks.forEach(chunkNumber => {
|
|
|
const index = obj.chunks.findIndex(({ index }) => index === chunkNumber)
|
|
|
if (~index) {
|
|
|
obj.chunks.splice(index, 1)
|
|
|
@@ -570,11 +575,11 @@ function idleTask () {
|
|
|
shuntTask()
|
|
|
}
|
|
|
|
|
|
-function finish (obj, message) {
|
|
|
- Notification({
|
|
|
+function finish (obj, options) {
|
|
|
+ Notification(options || {
|
|
|
type: 'success',
|
|
|
title: '文件上传',
|
|
|
- message: message || `${obj.name}上传成功`
|
|
|
+ message: `${obj.name}上传成功`
|
|
|
})
|
|
|
setState(obj, State.SUCCESS)
|
|
|
emit('uploaded', obj)
|