@ -20,9 +20,9 @@
< template v-for ="(item, i) in detailStyle" >
< li v-if ="item.id !== column.detailStyle" :key="i" @click="form.articleTemplate = item.id" >
< div class = "review" >
< img : src = "require('@/assets/images/article' + item.id + '.png')" alt = "" >
<!-- < img : src = "require('@/assets/images/article' + item.id + '.png')" alt = "" > -- >
< / div >
< el -radio v-model ="form.articleTemplate" :label="item.id" > {{ item.nam e }} < / el -radio >
< el -radio v-model ="form.articleTemplate" :label="item.id" > {{ item.styl e }} < / el -radio >
< / li >
< / template >
< / ul >
@ -47,7 +47,20 @@
: props = "columnProps"
clearable > < / e l - c a s c a d e r >
< / e l - f o r m - i t e m >
< el -form -item prop = "releaseTime" label = "发布日期" >
< el -form -item v-if ="form.articleTemplate === 25" prop="classificationId" label="所属分类" >
< el -select style = "width: 234px;" v-model ="form.classificationId" >
< template v-for ="item in classifications" >
< el -option
v - if = "item.classificationName"
: key = "item.id"
: label = "item.classificationName"
: value = "item.id" >
< / e l - o p t i o n >
< / template >
< / e l - s e l e c t >
< el -button class = "set-btn" type = "primary" @click ="setClass" > 设置 < / el -button >
< / e l - f o r m - i t e m >
< el -form -item v -else prop = "releaseTime" label = "发布日期" >
< el -date -picker
v - model = "form.releaseTime"
type = "date"
@ -63,31 +76,58 @@
placeholder = "请输入来源"
v - model . trim = "form.source"
clearable
maxlength = "1 5"
maxlength = "50 "
class = "inline-input"
@ change = "nameChange"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< el -form -item prop = "author" label = "作者" >
< el -form -item v-if ="form.articleTemplate === 25" prop="time" label="起止时间" >
< el -date -picker
style = "width: 300px"
v - model = "form.time"
type = "datetimerange"
range - separator = "~"
start - placeholder = "开始日期"
end - placeholder = "结束日期" >
< / e l - d a t e - p i c k e r >
< / e l - f o r m - i t e m >
< el -form -item v -else prop = "author" label = "作者" >
< el -input
placeholder = "请输入作者"
v - model . trim = "form.author"
clearable
maxlength = "200"
class = "inline-input"
@ change = "nameChange"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / div >
< div class = "item-line" >
< div v-if ="form.articleTemplate === 25" class="item-line" >
< el -form -item prop = "lectureSeries" label = "演讲系列" >
< el -input
placeholder = "请输入演讲系列"
v - model . trim = "form.lectureSeries"
clearable
maxlength = "50"
class = "inline-input"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< el -form -item prop = "onlineLocation" label = "线上地点" >
< el -input
placeholder = "请输入线上地点"
v - model . trim = "form.onlineLocation"
clearable
maxlength = "50"
class = "inline-input"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / div >
< div v-if ="form.articleTemplate === 22" class="item-line" >
< el -form -item prop = "edit" label = "编辑" >
< el -input
placeholder = "请输入编辑"
v - model . trim = "form.edit"
clearable
maxlength = "15"
maxlength = "50 "
class = "inline-input"
@ change = "nameChange"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< el -form -item prop = "audit" label = "审核" >
@ -95,13 +135,42 @@
placeholder = "请输入审核"
v - model . trim = "form.audit"
clearable
maxlength = "1 5"
maxlength = "50 "
class = "inline-input"
@ change = "nameChange"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / div >
< div class = "item-line" >
< template v-if ="form.articleTemplate === 25" >
< el -form -item prop = "offlineLocation" label = "线下地点" >
< el -input
style = "width: 940px"
placeholder = "请输入线下地点"
v - model = "form.offlineLocation"
clearable
maxlength = "100"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< el -form -item prop = "keynoteSpeaker" label = "主讲人" >
< el -input
style = "width: 940px"
placeholder = "请输入主讲人"
v - model = "form.keynoteSpeaker"
clearable
maxlength = "100"
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< el -form -item prop = "eventProfile" label = "活动简介" >
< el -input
style = "width: 940px"
placeholder = "请输入活动简介"
v - model = "form.eventProfile"
type = "textarea"
clearable
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< / template >
< div v-if ="form.articleTemplate === 22" class="item-line" >
< el -form -item prop = "source" label = "所属分类" >
< el -select style = "width: 234px;" v-model ="form.classificationId" >
< template v-for ="item in classifications" >
@ -129,7 +198,7 @@
< el -button class = "set-btn" type = "primary" @click ="setLabel" > 设置 < / el -button >
< / e l - f o r m - i t e m >
< / div >
< el -form -item prop = "summary" label = "摘要" >
< el -form -item v-if ="form.articleTemplate === 22" prop="summary" label="摘要" >
< el -input
style = "width: 940px"
type = "textarea"
@ -138,7 +207,7 @@
clearable
> < / e l - i n p u t >
< / e l - f o r m - i t e m >
< el -form -item prop = "titleImg" label = "封面图" >
< el -form -item prop = "titleImg" : label = "form.articleTemplate === 25 ? '标题图' : ' 封面图' " >
< el -upload
class = "avatar-uploader"
accept = ".jpg,.png,.jpeg,.gif"
@ -170,27 +239,25 @@
< / div >
< / e l - u p l o a d >
< / e l - f o r m - i t e m >
< template v-if ="!form.templateStatus || (form.templateStatus && form.articleTemplate === 2)" >
< el -form -item prop = "mainBody" label = "正文" >
< Editor api -key = ' rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda ' v -model = " form.mainBody " :init ="editorConfig" / >
< / e l - f o r m - i t e m >
< el -form -item prop = "file" label = "文件上传" >
< el -upload
: on - remove = "handleRemove"
: on - success = "uploadSuccessFile"
: action = "this.api.upload"
: file - list = "fileList"
: data = " {
quote : form . title ,
site : site . siteName ,
uploader : userName
} "
>
< el -button > 上传 < / e l - b u t t o n >
< / e l - u p l o a d >
< / e l - f o r m - i t e m >
< / template >
< template v-if ="form.articleTemplate === 3" >
< el -form -item v-if ="form.articleTemplate === 22 || form.articleTemplate === 25" prop="mainBody" label="正文" >
< Editor api -key = ' rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda ' v -model = " form.mainBody " :init ="editorConfig" / >
< / e l - f o r m - i t e m >
< el -form -item v-if ="form.articleTemplate === 22 || form.articleTemplate === 25" prop="file" label="文件上传" >
< el -upload
: on - remove = "handleRemove"
: on - success = "uploadSuccessFile"
: action = "this.api.upload"
: file - list = "fileList"
: data = " {
quote : form . title ,
site : site . siteName ,
uploader : userName
} "
>
< el -button > 上传 < / e l - b u t t o n >
< / e l - u p l o a d >
< / e l - f o r m - i t e m >
< template v-if ="form.articleTemplate === 24" >
< el -form -item prop = "connectionType" label = "连接类型" >
< el -radio -group v-model ="form.connectionType" >
< el -radio :label ="1" > 站内链接 < / e l - r a d i o >
@ -232,13 +299,6 @@
< / e l - f o r m - i t e m >
< / template >
< / template >
< el -form -item v-show ="form.typeId === 4" prop="showWithDetails" label="栏目" >
< el -switch
v - model = "form.showWithDetails"
: active - value = "1"
: inactive - value = "0" >
< / e l - s w i t c h >
< / e l - f o r m - i t e m >
< / e l - f o r m >
< div class = "btns" >
< el -button type = "primary" @click ="submit(1)" > 发布 < / el -button >
@ -337,10 +397,8 @@ export default {
site : this . $store . state . content . site ,
userId : this . $store . state . user . userId ,
nameRepeat : false ,
types : ColumnConst . types ,
templates : ColumnConst . templates ,
sites : ColumnConst . sites ,
detailStyle : ColumnConst . detailStyle ,
detailStyle : [ ] ,
columns : [ ] ,
columnProps : {
checkStrictly : true ,
@ -355,17 +413,30 @@ export default {
editorId : this . $store . state . user . userId ,
templateStatus : 0 ,
articleTemplate : '' ,
doi : '' ,
quote : '' ,
publicationTypeId : '' ,
publicationYear : '' ,
activityEndTime : '' ,
activityStartTime : '' ,
time : '' ,
lectureSeries : '' ,
onlineLocation : '' ,
offlineLocation : '' ,
keynoteSpeaker : '' ,
eventProfile : '' ,
author : '' ,
edit : '' ,
audit : '' ,
bannerImg : '' ,
lableId : '' ,
lableId : [ ] ,
classificationId : '' ,
columnId : + this . $route . query . columnId ,
file : '' ,
isRelease : 0 ,
mainBody : '' ,
releaseTime : new Date ( ) ,
/ / r e l e a s e T i m e : ' ' ,
source : '' ,
summary : '' ,
title : '' ,
@ -381,6 +452,18 @@ export default {
columnId : [
{ required : true , message : '请选择所属栏目' , trigger : 'change' }
] ,
time : [
{ required : true , message : '请选择起始时间' , trigger : 'change' }
] ,
classificationId : [
{ required : false , message : '请选择所属分类' , trigger : 'change' }
] ,
keynoteSpeaker : [
{ required : true , message : '请输入主讲人' , trigger : 'blur' }
] ,
eventProfile : [
{ required : true , message : '请输入活动简介' , trigger : 'blur' }
] ,
releaseTime : [
{ required : true , message : '请选择发布日期' , trigger : 'change' }
] ,
@ -394,6 +477,7 @@ export default {
{ required : true , message : '请选择连接类型' , trigger : 'blur' }
] ,
} ,
columnInfo : { } ,
fileList : [ ] ,
editorConfig ,
submiting : false , / / 新 增 编 辑 防 抖 标 识
@ -466,14 +550,17 @@ export default {
name : '文章管理' ,
route : '/article'
} ,
{
name : this . $route . query . columnName
} ,
{
name : this . $route . query . id ? '编辑' : '新增'
}
] )
this . getList ( )
this . form . id && this . getData ( )
this . getClassification ( )
this . form . id ? this . getData ( ) : this . getColumn ( )
this . getLabel ( )
this . getTemplate ( )
} ,
methods : {
/ / 获 取 栏 目
@ -516,21 +603,51 @@ export default {
e . children . length ? this . getId ( e . children , e . ids ) : delete e . children
} )
} ,
/ / 获 取 详 情
/ / 获 取 文 章 详 情
getData ( ) {
this . $post ( ` ${ this . api . findArticle } ?id= ${ this . form . id } ` ) . then ( ( { data } ) => {
data . lableId = data . lableId . split ( ',' ) . map ( e => + e )
if ( data . activityStartTime && data . activityEndTime ) data . time = [ data . activityStartTime , data . activityEndTime ]
this . form = data
if ( data . articleTemplate === 3 && data . connectionType !== 2 && data . linkAddress ) this . links = data . linkAddress . split ( ',' ) . map ( e => + e )
/ / i f ( d a t a . a r t i c l e T e m p l a t e = = = 3 & & d a t a . c o n n e c t i o n T y p e ! = = 2 & & d a t a . l i n k A d d r e s s ) t h i s . l i n k s = d a t a . l i n k A d d r e s s . s p l i t ( ' , ' ) . m a p ( e = > + e )
this . originalName = data . title
this . getColumn ( )
/ / c o n s t { f i l e } = d a t a
/ / i f ( f i l e ) t h i s . f i l e L i s t = [ { n a m e : f i l e , u r l : f i l e } ] / / 文 件 上 传 回 显
this . getFile ( )
} ) . catch ( err => { } )
} ,
/ / 获 取 栏 目 详 情
getColumn ( ) {
this . $post ( ` ${ this . api . findColumn } ?id= ${ this . $route . query . columnId } ` ) . then ( ( { data } ) => {
this . columnInfo = data
const { form } = this
/ / 如 果 独 立 文 章 模 板 未 启 用 , 并 且 该 栏 目 的 类 型 为 常 规 / 子 级 优 先 , 则 把 栏 目 所 选 的 详 情 样 式 赋 值 到 文 章 模 板 ; 如 果 栏 目 类 型 为 长 页 或 者 链 接 , 则 文 章 模 板 默 认 为 文 章 ( 2 3 )
if ( ! form . templateStatus ) {
form . articleTemplate = ( data . typeId === 1 || data . typeId === 4 ) ? data . detailStyleId : 23
}
/ / 会 议 活 动
if ( form . articleTemplate === 25 ) {
this . rules . titleImg [ 0 ] . required = false
this . rules . classificationId [ 0 ] . required = true
}
this . getClassification ( )
} ) . catch ( err => { } )
} ,
/ / 获 取 所 有 模 板
getTemplate ( ) {
this . $post ( this . api . individualTemplateDetailsStyle ) . then ( ( { data } ) => {
const result = [ ]
data . map ( e => {
result . find ( n => n . style === e . style ) || result . push ( e )
} )
this . detailStyle = result
console . log ( "🚀 ~ file: index.vue ~ line 642 ~ this.$post ~ data" , result )
} ) . catch ( err => { } )
} ,
/ / 获 取 所 属 分 类
getClassification ( ) {
this . $post ( ` ${ this . api . queryClassif } ?siteId= ${ this . site . id } ` ) . then ( ( { data } ) => {
this . $post ( ` ${ this . api . queryClassif } ?siteId= ${ this . site . id } &templateId= ${ this . columnInfo . templateId } ` ) . then ( ( { data } ) => {
this . classifications = data
} ) . catch ( err => { } )
} ,
@ -571,6 +688,7 @@ export default {
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 ,
templateId : this . columnInfo . templateId ,
id : row . id ,
siteId : this . site . id ,
editorId : this . userId ,
@ -754,7 +872,6 @@ export default {
} ,
/ / 附 件 删 除
handleRemove ( e ) {
console . log ( "🚀 ~ file: index.vue ~ line 740 ~ handleRemove ~ e" , e )
this . $post ( ` ${ this . api . delContentFile } ?id= ${ e . id } ` ) . then ( res => { } ) . catch ( res => { } )
} ,
/ / b a n n e r 上 传 成 功
@ -813,16 +930,21 @@ export default {
const form = JSON . parse ( JSON . stringify ( this . form ) )
if ( ! form . title ) return util . errorMsg ( '请填写标题' )
if ( this . nameRepeat ) return util . errorMsg ( '该标题已重复!' )
if ( ! form . releaseTime && isRelease ) return util . errorMsg ( '请选择发布日期' )
if ( ! form . titleImg && isRelease ) return util . errorMsg ( '请上传封面' )
/ / i f ( ! f o r m . r e l e a s e T i m e & & i s R e l e a s e ) r e t u r n u t i l . e r r o r M s g ( ' 请 选 择 发 布 日 期 ' )
/ / i f ( ! f o r m . t i t l e I m g & & i s R e l e a s e ) r e t u r n u t i l . e r r o r M s g ( ' 请 上 传 封 面 ' )
if ( typeof form . fatherId === 'object' ) form . fatherId = form . fatherId [ form . fatherId . length - 1 ]
if ( form . articleTemplate === 3 && form . connectionType !== 2 ) {
const { links } = this
if ( ! links . length && form . connectionType === 1 && isRelease ) return util . errorMsg ( '请选择站内链接' )
if ( ! links . length && form . connectionType === 3 && isRelease ) return util . errorMsg ( '请选择栏目' )
form . linkAddress = links . join ( )
/ / i f ( f o r m . a r t i c l e T e m p l a t e = = = 2 4 & & f o r m . c o n n e c t i o n T y p e ! = = 2 ) {
/ / c o n s t { l i n k s } = t h i s
/ / i f ( ! l i n k s . l e n g t h & & f o r m . c o n n e c t i o n T y p e = = = 1 & & i s R e l e a s e ) r e t u r n u t i l . e r r o r M s g ( ' 请 选 择 站 内 链 接 ' )
/ / i f ( ! l i n k s . l e n g t h & & f o r m . c o n n e c t i o n T y p e = = = 3 & & i s R e l e a s e ) r e t u r n u t i l . e r r o r M s g ( ' 请 选 择 栏 目 ' )
/ / f o r m . l i n k A d d r e s s = l i n k s . j o i n ( )
/ / }
/ / i f ( ( ( f o r m . t e m p l a t e S t a t u s & & f o r m . a r t i c l e T e m p l a t e = = = 2 ) | | ! f o r m . t e m p l a t e S t a t u s ) & & ! f o r m . m a i n B o d y & & i s R e l e a s e ) r e t u r n u t i l . e r r o r M s g ( ' 请 输 入 正 文 ' )
if ( form . articleTemplate === 25 ) {
if ( ! form . time . length && isRelease ) return util . errorMsg ( '请选择起止时间' )
form . activityStartTime = form . time [ 0 ]
form . activityEndTime = form . time [ 1 ]
}
if ( ( ( form . templateStatus && form . articleTemplate === 2 ) || ! form . templateStatus ) && ! form . mainBody && isRelease ) return util . errorMsg ( '请输入正文' )
const { columnId , bannerImg , file , titleImg } = form
const fileId = [ ]
if ( typeof columnId === 'object' ) form . columnId = columnId [ columnId . length - 1 ] / / 如 果 更 换 了 栏 目 i d , 值 会 变 成 数 组 , 需 要 手 动 获 取 最 后 一 个
@ -942,9 +1064,13 @@ $upload-lg-height: 102px;
}
. styles {
display : flex ;
flex - wrap : wrap ;
width : 955 px ;
height : 320 px ;
margin - top : 20 px ;
overflow : auto ;
li {
margin - right : 20 px ;
margin : 0 20 px 10 px 0 ;
text - align : center ;
cursor : pointer ;
& : hover . review {