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