diff --git a/activitylink/src/views/zhongchou/gift/index.vue b/activitylink/src/views/zhongchou/gift/index.vue
index 7e90931..b7c9928 100644
--- a/activitylink/src/views/zhongchou/gift/index.vue
+++ b/activitylink/src/views/zhongchou/gift/index.vue
@@ -20,8 +20,10 @@
-
-
+
+
导入内定名单
@@ -53,18 +55,19 @@
:on-change="handleImageChange" :on-success="handleUploadSuccess" :on-error="handleUploadError"
:before-upload="beforeUpload" :show-file-list="false">
-
-
-
+
+
+
+
+
+
只能上传jpg、png格式的图片,且不超过1MB
-
-
![预览图]()
-
@@ -90,8 +93,9 @@
-
-
+
+
@@ -100,9 +104,6 @@
-
-
![预览图]()
-
@@ -360,59 +361,55 @@ const handleUploadSuccess = (response, file, fileList) => {
addForm.value.imageUrl = response.data.url;
} else if (editVisible.value) {
editForm.value.imageUrl = response.data.url;
- } else {
- if (addVisible.value) {
- addForm.value.imageUrl = null;
- } else if (editVisible.value) {
- editForm.value.imageUrl = null;
- }
}
+ console.log('==========================', response.data.url)
} catch (error) {
+ console.log('看看报错信息', error)
ElMessage.error(response.msg || '图片上传失败');
}
}
- const handleUploadError = (error) => {
- console.error('上传失败:', error);
- if (addVisible.value) {
- addForm.value.imageUrl = null;
- } else if (editVisible.value) {
- editForm.value.imageUrl = null;
- }
- ElMessage.error('图片上传失败,请重试');
+const handleUploadError = (error) => {
+ console.error('上传失败:', error);
+ if (addVisible.value) {
+ addForm.value.imageUrl = null;
+ } else if (editVisible.value) {
+ editForm.value.imageUrl = null;
}
+ ElMessage.error('图片上传失败,请重试');
+}
- const beforeUpload = (file) => {
- const isJPG = file.type === 'image/jpeg';
- const isPNG = file.type === 'image/png';
- const isLt1 = file.size / 1024 < 1024;
+const beforeUpload = (file) => {
+ const isJPG = file.type === 'image/jpeg';
+ const isPNG = file.type === 'image/png';
+ const isLt1 = file.size / 1024 < 1024;
- if (!isJPG && !isPNG) {
- ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
- return false;
- }
- if (!isLt1) {
- ElMessage.error('上传图片大小不能超过1MB');
- return false;
- }
- return true;
+ if (!isJPG && !isPNG) {
+ ElMessage.error('上传图片只能是 JPG 或 PNG 格式');
+ return false;
}
-
- const handleSizeChange = (val) => {
- pagination.value.pageSize = val
- pagination.value.pageNum = 1
- getPrizes()
+ if (!isLt1) {
+ ElMessage.error('上传图片大小不能超过1MB');
+ return false;
}
+ return true;
+}
- const handleCurrentChange = (val) => {
- pagination.value.pageNum = val
- getPrizes()
- }
+const handleSizeChange = (val) => {
+ pagination.value.pageSize = val
+ pagination.value.pageNum = 1
+ getPrizes()
+}
- onMounted(() => {
- getPrizes()
- getGradeNames()
- })
+const handleCurrentChange = (val) => {
+ pagination.value.pageNum = val
+ getPrizes()
+}
+
+onMounted(() => {
+ getPrizes()
+ getGradeNames()
+})
\ No newline at end of file