提交
This commit is contained in:
@@ -17,6 +17,14 @@
|
|||||||
<el-form-item label="category" prop="intro">
|
<el-form-item label="category" prop="intro">
|
||||||
<el-input v-model="baseForm.intro"></el-input>
|
<el-input v-model="baseForm.intro"></el-input>
|
||||||
</el-form-item>
|
</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">
|
<el-form-item label="Summary" prop="abstract">
|
||||||
<quill-editor ref="myTextEditor" v-model="baseForm.abstract" :options="editorOption"></quill-editor>
|
<quill-editor ref="myTextEditor" v-model="baseForm.abstract" :options="editorOption"></quill-editor>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -228,6 +236,7 @@
|
|||||||
id: -1,
|
id: -1,
|
||||||
link_Total: 0,
|
link_Total: 0,
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
|
SpecialImageUrl: '',
|
||||||
IMGdo_Url: this.IMGdoURL,
|
IMGdo_Url: this.IMGdoURL,
|
||||||
IMGup_Url: this.IMGupURL,
|
IMGup_Url: this.IMGupURL,
|
||||||
editVisible: false,
|
editVisible: false,
|
||||||
@@ -312,6 +321,8 @@
|
|||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
|
||||||
this.baseForm = res.data.special;
|
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.first_name = res.data.editors[0].first_name;
|
||||||
this.baseForm.last_name = res.data.editors[0].last_name;
|
this.baseForm.last_name = res.data.editors[0].last_name;
|
||||||
this.baseForm.email = res.data.editors[0].email;
|
this.baseForm.email = res.data.editors[0].email;
|
||||||
@@ -352,6 +363,11 @@
|
|||||||
saveBase(baseForm) {
|
saveBase(baseForm) {
|
||||||
this.$refs.base_Form.validate((valid) => {
|
this.$refs.base_Form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
if(this.baseForm.icon==''){
|
||||||
|
this.$message.error(`请上传图片`);
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
this.$api
|
this.$api
|
||||||
.post('master/Special/editSpecialBasic', this.baseForm)
|
.post('master/Special/editSpecialBasic', this.baseForm)
|
||||||
.then(res => {
|
.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) {
|
handleAvatarSuccess(res, file) {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
@@ -552,6 +576,13 @@
|
|||||||
handleAvatarError(res, file) {
|
handleAvatarError(res, file) {
|
||||||
// this.$message.error(res);
|
// this.$message.error(res);
|
||||||
},
|
},
|
||||||
|
beforeImageUpload(file) {
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 5;
|
||||||
|
if (!isLt2M) {
|
||||||
|
this.$message.error('图片大小不能超过 5M!');
|
||||||
|
}
|
||||||
|
return isLt2M;
|
||||||
|
},
|
||||||
beforeAvatarUpload(file) {
|
beforeAvatarUpload(file) {
|
||||||
const isLt2M = file.size / 1024 / 1024 < 1;
|
const isLt2M = file.size / 1024 / 1024 < 1;
|
||||||
if (!isLt2M) {
|
if (!isLt2M) {
|
||||||
|
|||||||
Reference in New Issue
Block a user