|
|
|
@ -69,7 +69,38 @@ |
|
|
|
|
</el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<template v-if="form.articleTemplate === 26"> |
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="doi" label="DOI"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入DOI" |
|
|
|
|
v-model.trim="form.doi" |
|
|
|
|
clearable |
|
|
|
|
maxlength="50" |
|
|
|
|
class="inline-input" |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="publicationYear" label="出版年份"> |
|
|
|
|
<el-date-picker |
|
|
|
|
style="width: 300px" |
|
|
|
|
v-model="form.publicationYear" |
|
|
|
|
type="year" |
|
|
|
|
placeholder="请选择出版年份" |
|
|
|
|
format="yyyy" |
|
|
|
|
value-format="yyyy"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<el-form-item prop="author" label="作者"> |
|
|
|
|
<el-input |
|
|
|
|
style="width: 940px" |
|
|
|
|
type="textarea" |
|
|
|
|
v-model="form.author" |
|
|
|
|
:rows="3" |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<div v-else class="item-line"> |
|
|
|
|
<el-form-item prop="source" label="来源"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入来源" |
|
|
|
@ -222,7 +253,7 @@ |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item v-if="form.articleTemplate !== 23" prop="bannerImg" label="Banner图(选填)" style="flex: 1;"> |
|
|
|
|
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 25" prop="bannerImg" label="Banner图(选填)" style="flex: 1;"> |
|
|
|
|
<el-upload |
|
|
|
|
class="avatar-uploader avatar-uploader-lg" |
|
|
|
|
accept=".jpg,.png,.jpeg,.gif" |
|
|
|
@ -241,6 +272,30 @@ |
|
|
|
|
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 23 || form.articleTemplate === 25" prop="mainBody" label="正文"> |
|
|
|
|
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mainBody" :init="editorConfig" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<template v-if="form.articleTemplate === 26"> |
|
|
|
|
<el-form-item prop="publicationTypeId" label="出版物类型"> |
|
|
|
|
<el-select style="width: 234px;" v-model="form.publicationTypeId"> |
|
|
|
|
<template v-for="item in publicationTypes"> |
|
|
|
|
<el-option |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</template> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="quote" label="引用"> |
|
|
|
|
<el-input |
|
|
|
|
style="width: 940px" |
|
|
|
|
type="textarea" |
|
|
|
|
v-model="form.quote" |
|
|
|
|
:rows="3" |
|
|
|
|
></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="mainBody" label="摘要"> |
|
|
|
|
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mainBody" :init="editorConfig" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<el-form-item v-if="form.articleTemplate === 22 || form.articleTemplate === 23 || form.articleTemplate === 25" prop="file" label="文件上传"> |
|
|
|
|
<el-upload |
|
|
|
|
:before-upload="fileBeforeUpload" |
|
|
|
@ -384,17 +439,19 @@ |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
import util from '@/libs/util' |
|
|
|
|
import Util from '@/libs/util' |
|
|
|
|
import { mapState } from 'vuex' |
|
|
|
|
import Editor from '@tinymce/tinymce-vue' |
|
|
|
|
import editorConfig from './editor' |
|
|
|
|
import Cropper from '@/components/img-upload/Cropper' |
|
|
|
|
import Axios from 'axios' |
|
|
|
|
import ColumnConst from '@/const/column' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
site: this.$store.state.content.site, |
|
|
|
|
userId: this.$store.state.user.userId, |
|
|
|
|
publicationTypes: ColumnConst.publicationTypes, |
|
|
|
|
nameRepeat: false, |
|
|
|
|
sites: [], |
|
|
|
|
otherColumns: [], |
|
|
|
@ -468,6 +525,9 @@ export default { |
|
|
|
|
releaseTime: [ |
|
|
|
|
{ required: true, message: '请选择发布日期', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
publicationYear: [ |
|
|
|
|
{ required: true, message: '请选择出版年份', trigger: 'change' } |
|
|
|
|
], |
|
|
|
|
titleImg: [ |
|
|
|
|
{ required: true, message: '请上传封面图', trigger: 'change' } |
|
|
|
|
], |
|
|
|
@ -711,7 +771,7 @@ export default { |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.delClassif}?id=${row.id}`).then(res => { |
|
|
|
|
util.successMsg('删除成功') |
|
|
|
|
Util.successMsg('删除成功') |
|
|
|
|
this.getClassification() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
@ -721,7 +781,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 提交所属分类 |
|
|
|
|
submitClass(row, showMsg = 1) { |
|
|
|
|
if (!row.classificationName) return util.errorMsg('请输入分类名称') |
|
|
|
|
if (!row.classificationName) return Util.errorMsg('请输入分类名称') |
|
|
|
|
this.$post(`${this.api.checkClassif}?classificationName=${row.classificationName}&siteId=${this.site.id}&classificationId=${row.id}`).then(res => { |
|
|
|
|
this.$post(this.api[row.id ? 'updateClassif' : 'saveClassif'], { |
|
|
|
|
classificationName: row.classificationName, |
|
|
|
@ -731,7 +791,7 @@ export default { |
|
|
|
|
editorId: this.userId, |
|
|
|
|
founderId: this.userId |
|
|
|
|
}).then(res => { |
|
|
|
|
showMsg && util.successMsg((row.id ? '修改' : '新增') + '成功') |
|
|
|
|
showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') |
|
|
|
|
this.getClassification() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -785,7 +845,7 @@ export default { |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$post(`${this.api.delLabel}?id=${row.id}`).then(res => { |
|
|
|
|
util.successMsg('删除成功') |
|
|
|
|
Util.successMsg('删除成功') |
|
|
|
|
this.getLabel() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
@ -795,7 +855,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 提交标签 |
|
|
|
|
submitLabel(row, showMsg = 1) { |
|
|
|
|
if (!row.labelName) return util.errorMsg('请输入主题名称') |
|
|
|
|
if (!row.labelName) return Util.errorMsg('请输入主题名称') |
|
|
|
|
this.$post(`${this.api.checkLabel}?labelName=${row.labelName}&siteId=${this.site.id}&labelId=${row.id}`).then(res => { |
|
|
|
|
this.$post(this.api[row.id ? 'updateLabel' : 'saveLabel'], { |
|
|
|
|
labelName: row.labelName, |
|
|
|
@ -804,7 +864,7 @@ export default { |
|
|
|
|
editorId: this.userId, |
|
|
|
|
founderId: this.userId |
|
|
|
|
}).then(res => { |
|
|
|
|
showMsg && util.successMsg((row.id ? '修改' : '新增') + '成功') |
|
|
|
|
showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') |
|
|
|
|
this.getLabel() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
@ -899,7 +959,8 @@ export default { |
|
|
|
|
url: this.api.upload, |
|
|
|
|
data: formData, |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'multipart/form-data' |
|
|
|
|
'Content-Type': 'multipart/form-data', |
|
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
let url = this.form[this.isBanner ? 'bannerImg' : 'titleImg'] |
|
|
|
@ -916,7 +977,7 @@ export default { |
|
|
|
|
this.isBanner = isBanner |
|
|
|
|
const { size, name } = file |
|
|
|
|
const ext = name.substring(name.lastIndexOf('.') + 1) |
|
|
|
|
if (!util.isImg(ext)) { |
|
|
|
|
if (!Util.isImg(ext)) { |
|
|
|
|
this.$message.error('请上传图片!') |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
@ -1006,34 +1067,34 @@ export default { |
|
|
|
|
submit(isRelease, next) { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const form = JSON.parse(JSON.stringify(this.form)) |
|
|
|
|
if (!form.title) return util.errorMsg('请填写标题') |
|
|
|
|
if (this.nameRepeat) return util.errorMsg('该标题已重复!') |
|
|
|
|
if (!form.title) return Util.errorMsg('请填写标题') |
|
|
|
|
if (this.nameRepeat) return Util.errorMsg('该标题已重复!') |
|
|
|
|
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] |
|
|
|
|
const tId = form.articleTemplate |
|
|
|
|
// 如果是发布 |
|
|
|
|
if (isRelease) { |
|
|
|
|
if (tId !== 25) { |
|
|
|
|
if (!form.releaseTime) return util.errorMsg('请选择发布日期') |
|
|
|
|
if (!form.releaseTime) return Util.errorMsg('请选择发布日期') |
|
|
|
|
} |
|
|
|
|
if (tId === 22 || tId === 23) { |
|
|
|
|
if (!form.titleImg ) return util.errorMsg('请上传封面') |
|
|
|
|
if (!form.titleImg ) return Util.errorMsg('请上传封面') |
|
|
|
|
} |
|
|
|
|
if (tId === 25) { |
|
|
|
|
if (!form.time.length && isRelease) return util.errorMsg('请选择起止时间') |
|
|
|
|
if (!form.time.length && isRelease) return Util.errorMsg('请选择起止时间') |
|
|
|
|
form.activityStartTime = form.time[0] |
|
|
|
|
form.activityEndTime = form.time[1] |
|
|
|
|
} |
|
|
|
|
if (tId === 24 && form.connectionType !== 2) { |
|
|
|
|
if (form.connectionType === 1) { |
|
|
|
|
if (!this.links.length) return util.errorMsg('请选择站内链接') |
|
|
|
|
if (!this.links.length) return Util.errorMsg('请选择站内链接') |
|
|
|
|
} |
|
|
|
|
if (!this.otherLink.length && form.connectionType === 3) { |
|
|
|
|
if (!this.otherLink.length) return util.errorMsg('请选择栏目') |
|
|
|
|
if (!this.otherLink.length) return Util.errorMsg('请选择栏目') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ((tId === 22 || tId === 23 || tId === 25) && !form.mainBody) return util.errorMsg('请输入正文') |
|
|
|
|
if ((tId === 22 || tId === 23 || tId === 25) && !form.mainBody) return Util.errorMsg('请输入正文') |
|
|
|
|
} |
|
|
|
|
if (this.uploading) return util.errorMsg('文件正在上传,请上传完成后再发布') |
|
|
|
|
if (this.uploading) return Util.errorMsg('文件正在上传,请上传完成后再发布') |
|
|
|
|
if (form.connectionType === 1) { |
|
|
|
|
form.linkAddress = this.links.join() |
|
|
|
|
} else if (form.connectionType === 3) { |
|
|
|
@ -1057,7 +1118,7 @@ export default { |
|
|
|
|
form.editorId = +this.$store.state.user.userId |
|
|
|
|
this.$post(this.api.updateArticle, form).then(res => { |
|
|
|
|
this.updateFile(fileId, form, form.id) |
|
|
|
|
util.successMsg('修改成功') |
|
|
|
|
Util.successMsg('修改成功') |
|
|
|
|
next ? next() : this.$router.push(`list?columnId=` + form.columnId) |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.submiting = false |
|
|
|
@ -1076,7 +1137,7 @@ export default { |
|
|
|
|
filePath: e.url |
|
|
|
|
}).then(res => {}).catch(err => {}) |
|
|
|
|
}) |
|
|
|
|
util.successMsg('创建成功') |
|
|
|
|
Util.successMsg('创建成功') |
|
|
|
|
next ? next() : this.$router.back() |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.submiting = false |
|
|
|
|