|
@@ -133,6 +133,10 @@ export default {
|
|
|
this.$message.error('上传照片名称长度必须要小于30个文字哦!');
|
|
|
return false;
|
|
|
}
|
|
|
+ if (!this.form.kindergartenId) {
|
|
|
+ this.$message.error('先选择图片上传场景!');
|
|
|
+
|
|
|
+ return false;}
|
|
|
},
|
|
|
// 删除文件之前的钩子
|
|
|
beforeRemove(file, fileList) {
|
|
@@ -160,15 +164,19 @@ export default {
|
|
|
fileNameLength
|
|
|
);
|
|
|
let fileName = _that.$moment(new Date()).format('YYYYMMDDHHmm') + '_' + getFileNameUUID() + '.' + fileFormat;
|
|
|
-
|
|
|
// https://github.com/ali-sdk/ali-oss#multipartuploadname-file-options
|
|
|
client(_that.dataObj)
|
|
|
.multipartUpload(`tmp/${fileName}`, file.file, {
|
|
|
parallel: 4, // 同时处理分片
|
|
|
partSize: 2 * 1024 * 1024, // 每个分片大小
|
|
|
- progress: function(p) { // p进度条的值
|
|
|
+ progress: function(p,content) { // p进度条的值
|
|
|
// todo 每个文件一个进度条???如何限定的业务参数(幼儿园id、活动id)
|
|
|
+ file.file.progressFlag= true;
|
|
|
+ file.file.percentage= Math.floor(p * 100);
|
|
|
+ file.file.progressPercent= Math.abs(file.file.percentage.toFixed(0));
|
|
|
console.log(p);
|
|
|
+ console.log(_that.fileList);
|
|
|
+ console.log('------ali-oss-multi.vue')
|
|
|
_that.showProgress = true;
|
|
|
_that.progress = Math.floor(p * 100);
|
|
|
}
|