|
@@ -3,7 +3,7 @@
|
|
|
* @Author: Rockery
|
|
|
* @Date: 2021-12-27 11:19:47
|
|
|
* @LastEditors: Rockery
|
|
|
- * @LastEditTime: 2022-02-28 11:25:40
|
|
|
+ * @LastEditTime: 2022-03-01 17:46:31
|
|
|
* @FilePath: \party_construct_web\src\components\RocImgFileUpload\index.vue
|
|
|
* @Copyright: Copyright (c) 2016~2021 Rockery(1113269755@qq.com)
|
|
|
-->
|
|
@@ -40,12 +40,7 @@
|
|
|
size="small"
|
|
|
@click="submitRocImgFileUploadClick"
|
|
|
>上传文件</el-button>
|
|
|
- <el-button
|
|
|
- v-if="isSelect"
|
|
|
- type="info"
|
|
|
- size="small"
|
|
|
- @click="removeRocImgFileUploadClick"
|
|
|
- >移除文件</el-button>
|
|
|
+ <el-button v-if="isSelect" type="info" size="small" @click="removeRocImgFileUploadClick">移除文件</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -129,7 +124,7 @@ export default {
|
|
|
* 文件上传预处理
|
|
|
*/
|
|
|
handleRocImgFileUploadBeforeUpload(file) {
|
|
|
- if(!['image/png', 'image/jpeg'].includes(file.type || '')){
|
|
|
+ if (!['image/png', 'image/jpeg'].includes(file.type || '')) {
|
|
|
this.$refs.rocImgFileUploadRef.clearFiles();
|
|
|
this.msgError(`${this.fileTitle}格式错误,请上传类型格式为jpg或png的图片文件!`);
|
|
|
return;
|
|
@@ -168,7 +163,7 @@ export default {
|
|
|
*/
|
|
|
handleRocImgFileUploadOnchange(file, fileList) {
|
|
|
if (file.status === 'ready') {
|
|
|
- if(!['image/png', 'image/jpeg'].includes((file.raw || {}).type || '')){
|
|
|
+ if (!['image/png', 'image/jpeg'].includes((file.raw || {}).type || '')) {
|
|
|
this.$refs.rocImgFileUploadRef.clearFiles();
|
|
|
this.isSelect = false;
|
|
|
this.msgError(`${this.fileTitle}格式错误,请上传类型格式为jpg或png的图片文件!`);
|
|
@@ -179,6 +174,11 @@ export default {
|
|
|
this.$emit('input', '');
|
|
|
} else if (file.status === 'success') {
|
|
|
this.isUploadSuccess = true;
|
|
|
+ } else if (file.status === 'fail') {
|
|
|
+ this.isUploadSuccess = false;
|
|
|
+ this.isSelect = false;
|
|
|
+ this.$emit('input', '');
|
|
|
+ this.msgError(`上传失败!`);
|
|
|
} else {
|
|
|
this.isUploadSuccess = false;
|
|
|
this.isSelect = false;
|