|
@@ -26,7 +26,6 @@
|
|
|
upload-icon="plus"
|
|
|
:before-read="beforeRead"
|
|
|
:after-read="clzpAfterRead"
|
|
|
- :before-upload="beforeUpload"
|
|
|
accept=".jpg,.png,.mp4"
|
|
|
:max-count="6"
|
|
|
v-model="formData.problemDescImgs"
|
|
@@ -222,6 +221,7 @@
|
|
|
const areaList = ref({});
|
|
|
const props = defineProps(['columns', 'addres']);
|
|
|
const emit = defineEmits(['submit']);
|
|
|
+ import { showToast } from 'vant';
|
|
|
const propsOptions = props.columns;
|
|
|
const loading = ref(false);
|
|
|
const setObjId = ref({
|
|
@@ -296,29 +296,29 @@
|
|
|
console.log('beforeUpload', file);
|
|
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
if (!isJpgOrPng) {
|
|
|
- message.error('You can only upload JPG file!');
|
|
|
+ showToast('You can only upload JPG file!');
|
|
|
}
|
|
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
if (!isLt2M) {
|
|
|
- message.error('Image must smaller than 2MB!');
|
|
|
+ showToast('Image must smaller than 2MB!');
|
|
|
}
|
|
|
return isJpgOrPng && isLt2M;
|
|
|
}; //校验图片的格式
|
|
|
function beforeRead(file) {
|
|
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'video/mp4';
|
|
|
if (!isJpgOrPng) {
|
|
|
- message.error(t('feedback.fileTips'));
|
|
|
+ showToast(t('feedback.fileTips'));
|
|
|
return false;
|
|
|
}
|
|
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
const isLt50M = file.size / 1024 / 1024 < 50;
|
|
|
if (!isLt2M && (file.type === 'image/jpeg' || file.type === 'image/png')) {
|
|
|
- message.error(t('feedback.fileTips'));
|
|
|
+ showToast(t('feedback.fileTips'));
|
|
|
return false;
|
|
|
}
|
|
|
if (!isLt50M && file.type === 'video/mp4') {
|
|
|
- message.error(t('feedback.fileTips'));
|
|
|
- return Upload.LIST_IGNORE;
|
|
|
+ showToast(t('feedback.fileTips'));
|
|
|
+ return false;
|
|
|
}
|
|
|
if (!/(jpg|jpeg|png|JPG|PNG|mp4)/i.test(file.type)) {
|
|
|
showToast(t('feedback.upload'));
|