master
yujialong 2 years ago
parent 427c032069
commit 94a8ffe016
  1. BIN
      src/assets/images/style/17.png
  2. BIN
      src/assets/images/style/18.png
  3. BIN
      src/assets/images/style/26.png
  4. 4
      src/components/modules/content.vue
  5. 31
      src/const/column.js
  6. 2
      src/pages/article/add/editor.js
  7. 105
      src/pages/article/add/index.vue
  8. 24
      src/pages/column/add/index.vue
  9. 7
      src/pages/setting/list/index.vue
  10. 2
      src/pages/setting/list/info.vue

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 220 KiB

@ -74,6 +74,7 @@
<script> <script>
import Link from '@/components/modules/link' import Link from '@/components/modules/link'
import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios' import Axios from 'axios'
@ -188,7 +189,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 }) => {
this.$set(this.curForm, 'pic', data.url) this.$set(this.curForm, 'pic', data.url)

@ -22,52 +22,43 @@ export default {
name: '子级优先栏目' name: '子级优先栏目'
} }
], ],
// 长页样式 // 出版物类型
pageStyle: [ publicationTypes: [
{ {
id: 1, id: 1,
path: 'home', name: '科技图书'
name: 'HOME'
}, },
{ {
id: 2, id: 2,
path: 'about', name: '科技期刊'
name: 'ABOUT'
}, },
{ {
id: 3, id: 3,
path: 'careers', name: '专利文献'
name: 'CAREERS'
}, },
{ {
id: 4, id: 4,
path: 'edu', name: '会议文献'
name: 'EDUCATION & COLLABORATION'
}, },
{ {
id: 5, id: 5,
path: 'news', name: '科技报告'
name: 'NEWS&EVENTS'
}, },
{ {
id: 6, id: 6,
path: 'newsPress', name: '政府出版物'
name: 'NEWS&EVENTS-PRESS ROOM'
}, },
{ {
id: 7, id: 7,
path: 'newsProcurement', name: '学位论文'
name: 'NEWS&EVENTS-PROCUREMENT'
}, },
{ {
id: 8, id: 8,
path: 'research', name: '标准文献'
name: 'RESEARCH'
}, },
{ {
id: 9, id: 9,
path: 'application', name: '产品资料和其它'
name: 'APPLICATION'
} }
], ],
} }

@ -357,7 +357,7 @@ export default {
setup: function(editor) { setup: function(editor) {
editor.on('init', function(ed) { editor.on('init', function(ed) {
// 设置默认字体 // 设置默认字体
ed.target.editorCommands.execCommand("fontName", false, "PingFang SC") ed.target.editorCommands.execCommand("fontName", false, "Microsoft Yahei")
ed.target.editorCommands.execCommand("fontSize", false, "19px") ed.target.editorCommands.execCommand("fontSize", false, "19px")
ed.target.editorCommands.execCommand("lineHeight", false, "1.5") ed.target.editorCommands.execCommand("lineHeight", false, "1.5")
top.document.querySelector('#articleTitle').focus() // 第一个字段聚焦 top.document.querySelector('#articleTitle').focus() // 第一个字段聚焦

@ -69,7 +69,38 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</div> </div>
<div class="item-line"> <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-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

@ -219,7 +219,8 @@
</div> </div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import Setting from '@/setting'
import Util from "@/libs/util";
import ColumnConst from '@/const/column' import ColumnConst from '@/const/column'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Cropper from '@/components/img-upload/Cropper' import Cropper from '@/components/img-upload/Cropper'
@ -579,7 +580,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.columnBanner let url = this.form.columnBanner
@ -595,7 +597,7 @@ export default {
changeFile(file) { changeFile(file) {
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
} }
@ -620,24 +622,24 @@ export default {
submit(next) { submit(next) {
if (this.submiting) return false if (this.submiting) return false
const { form } = this const { form } = this
if (!form.columnName) return util.errorMsg('请填写栏目名称') if (!form.columnName) return Util.errorMsg('请填写栏目名称')
if (this.nameRepeat) return util.errorMsg('同级下已存在重复栏目!') if (this.nameRepeat) return Util.errorMsg('同级下已存在重复栏目!')
if (!form.pageSize) return util.errorMsg('请填写分页条数') if (!form.pageSize) return Util.errorMsg('请填写分页条数')
if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] // id if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] // id
if (form.typeId === 2 && form.connectionType !== 2) { if (form.typeId === 2 && form.connectionType !== 2) {
const { links, article, otherLink, otherArticle } = this const { links, article, otherLink, otherArticle } = this
if (form.connectionType === 1) { if (form.connectionType === 1) {
if (!links.length) return util.errorMsg('请选择站内链接') if (!links.length) return Util.errorMsg('请选择站内链接')
form.linkAddress = links.join() form.linkAddress = links.join()
if (article) form.linkAddress += '-' + article if (article) form.linkAddress += '-' + article
} }
if (form.connectionType === 3) { if (form.connectionType === 3) {
if (!otherLink.length) return util.errorMsg('请选择栏目') if (!otherLink.length) return Util.errorMsg('请选择栏目')
form.linkAddress = otherLink.join() form.linkAddress = otherLink.join()
if (otherArticle) form.linkAddress += '-' + otherArticle if (otherArticle) form.linkAddress += '-' + otherArticle
} }
} }
if (form.typeId !== 2 && !form.listStyleId) return util.errorMsg('请选择列表样式') if (form.typeId !== 2 && !form.listStyleId) return Util.errorMsg('请选择列表样式')
// //
this.fileId && this.$post(this.api.updateFile, { this.fileId && this.$post(this.api.updateFile, {
id: this.fileId, id: this.fileId,
@ -653,7 +655,7 @@ export default {
this.$post(this.api.updateColumn, form).then(res => { this.$post(this.api.updateColumn, form).then(res => {
// //
// if (this.originTypeId !== 3 && form.typeId === 3) this.savePage(form.id) // if (this.originTypeId !== 3 && form.typeId === 3) this.savePage(form.id)
util.successMsg("修改成功") Util.successMsg("修改成功")
next ? next() : this.$router.back() next ? next() : this.$router.back()
}).catch(err => { }).catch(err => {
this.submiting = false this.submiting = false
@ -662,7 +664,7 @@ export default {
this.$post(this.api.saveColumn, form).then(({ data }) => { this.$post(this.api.saveColumn, form).then(({ data }) => {
// //
form.typeId === 3 && this.savePage(data) form.typeId === 3 && this.savePage(data)
util.successMsg("创建成功") Util.successMsg("创建成功")
next ? next() : this.$router.back() next ? next() : this.$router.back()
}).catch(err => { }).catch(err => {
this.submiting = false this.submiting = false

@ -4,7 +4,7 @@
<div class="inner"> <div class="inner">
<div class="text-center"> <div class="text-center">
<img :src="avatar" class="avatar" /> <img :src="avatar" class="avatar" />
<el-upload :action="this.api.updateUserAvatars" name="file" :data="{ userId }" :limit="10" :show-file-list="false" :on-success="changeAvatar"> <el-upload :action="this.api.updateUserAvatars" name="file" :data="{ userId }" :limit="10" :show-file-list="false" :headers="headers" :on-success="changeAvatar">
<el-button type="text" size="small">点击更换头像</el-button> <el-button type="text" size="small">点击更换头像</el-button>
</el-upload> </el-upload>
</div> </div>
@ -22,10 +22,15 @@
<script> <script>
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import Setting from '@/setting'
import util from '@/libs/util'
import info from './info' import info from './info'
export default { export default {
data() { data() {
return { return {
headers: {
token: util.local.get(Setting.tokenKey)
},
typeList: [ typeList: [
{ {
index: '1', index: '1',

@ -289,7 +289,7 @@ export default {
sex: form.sex, sex: form.sex,
}).then(res => { }).then(res => {
this.$emit('updateStatus', false) this.$emit('updateStatus', false)
this.setUserName(form.username) this.setUserName(form.realName)
this.$message.success("提交成功!") this.$message.success("提交成功!")
}).catch(res => {}) }).catch(res => {})
}, },

Loading…
Cancel
Save