|
@@ -494,24 +494,24 @@ export default {
|
|
|
handleUploadSuccess(res) {
|
|
handleUploadSuccess(res) {
|
|
|
if (res && res.code === 200 && res.data && res.data.url) {
|
|
if (res && res.code === 200 && res.data && res.data.url) {
|
|
|
this.form.coverImage = res.data.url
|
|
this.form.coverImage = res.data.url
|
|
|
- this..success('上传成功')
|
|
|
|
|
|
|
+ this.$message.success('上传成功')
|
|
|
} else {
|
|
} else {
|
|
|
- this..error('上传失败')
|
|
|
|
|
|
|
+ this.$message.error('上传失败')
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handleUploadError(err) {
|
|
handleUploadError(err) {
|
|
|
console.error('[HomeBanner] 上传失败', err)
|
|
console.error('[HomeBanner] 上传失败', err)
|
|
|
- this..error('图片上传失败,请重试')
|
|
|
|
|
|
|
+ this.$message.error('图片上传失败,请重试')
|
|
|
},
|
|
},
|
|
|
beforeUpload(file) {
|
|
beforeUpload(file) {
|
|
|
const isImage = file.type.startsWith('image/jpeg') || file.type.startsWith('image/png') || file.type.startsWith('image/gif') || file.type.startsWith('image/webp')
|
|
const isImage = file.type.startsWith('image/jpeg') || file.type.startsWith('image/png') || file.type.startsWith('image/gif') || file.type.startsWith('image/webp')
|
|
|
if (!isImage) {
|
|
if (!isImage) {
|
|
|
- this..error('只能上传图片格式(jpg/png/gif/webp)')
|
|
|
|
|
|
|
+ this.$message.error('只能上传图片格式(jpg/png/gif/webp)')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
const isLt5M = file.size / 1024 / 1024 < 5
|
|
const isLt5M = file.size / 1024 / 1024 < 5
|
|
|
if (!isLt5M) {
|
|
if (!isLt5M) {
|
|
|
- this..error('图片大小不能超过 5MB')
|
|
|
|
|
|
|
+ this.$message.error('图片大小不能超过 5MB')
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
return true
|
|
return true
|