This commit is contained in:
2025-07-08 13:07:21 +08:00
parent 7b30bde563
commit 6d18c43fd6

View File

@@ -17,6 +17,14 @@
<el-form-item label="category" prop="intro">
<el-input v-model="baseForm.intro"></el-input>
</el-form-item>
<el-form-item label="Image" prop="icon">
<el-upload class="avatar-uploader" :action="IMGup_Url+'master/Journal/up_file'"
:show-file-list="false" name="journalicon" :on-success="handleImageSuccess"
:on-error="handleAvatarError" :before-upload="beforeImageUpload">
<img v-if="SpecialImageUrl" :src="SpecialImageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="Summary" prop="abstract">
<quill-editor ref="myTextEditor" v-model="baseForm.abstract" :options="editorOption"></quill-editor>
</el-form-item>
@@ -228,6 +236,7 @@
id: -1,
link_Total: 0,
imageUrl: '',
SpecialImageUrl: '',
IMGdo_Url: this.IMGdoURL,
IMGup_Url: this.IMGupURL,
editVisible: false,
@@ -312,6 +321,8 @@
if (res.code == 0) {
this.baseForm = res.data.special;
this.SpecialImageUrl = res.data.special.icon?res.data.special.icon:'';
this.baseForm.first_name = res.data.editors[0].first_name;
this.baseForm.last_name = res.data.editors[0].last_name;
this.baseForm.email = res.data.editors[0].email;
@@ -352,6 +363,11 @@
saveBase(baseForm) {
this.$refs.base_Form.validate((valid) => {
if (valid) {
if(this.baseForm.icon==''){
this.$message.error(`请上传图片`);
return false
}
this.$api
.post('master/Special/editSpecialBasic', this.baseForm)
.then(res => {
@@ -531,7 +547,15 @@
});
},
//上传图片
handleImageSuccess(res, file) {
if (res.code == 0) {
this.baseForm.icon = res.upurl;
} else {
this.$message.error(res.msg);
}
this.SpecialImageUrl = URL.createObjectURL(file.raw);
},
//上传图片
handleAvatarSuccess(res, file) {
if (res.code == 0) {
@@ -552,6 +576,13 @@
handleAvatarError(res, file) {
// this.$message.error(res);
},
beforeImageUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 5;
if (!isLt2M) {
this.$message.error('图片大小不能超过 5M!');
}
return isLt2M;
},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 1;
if (!isLt2M) {