@ -13,6 +13,7 @@
@ change = "ArticleTypeChange()" >
< el -radio -button :label ="1" > 健康指导 < / e l - r a d i o - b u t t o n >
< el -radio -button :label ="2" > 注意事项 < / e l - r a d i o - b u t t o n >
< el -radio -button :label ="3" > 院内介绍 < / e l - r a d i o - b u t t o n >
< / e l - r a d i o - g r o u p >
< / e l - f o r m - i t e m >
< / e l - r o w >
@ -27,7 +28,6 @@
< / e l - t a b l e - c o l u m n >
< el -table -column prop = "author" label = "作者" / >
< el -table -column prop = "order" label = "排序" / >
< el -table -column prop = "show_date" label = "显示时间" / >
< el -table -column label = "操作" >
< template # default = "scope" >
< el -button type = "primary" @click ="EditClick(scope.row)" :icon ="Edit" circle / >
@ -40,10 +40,10 @@
: page - sizes = "[15, 50, 100, 200]" layout = "total,sizes, prev, pager, next" : total = "total"
@ size - change = "PageSizeChange" @ current - change = "PageCurrentChange" / >
< / div >
< el -dialog v-model ="dialogVisible" title=" 套餐信息 " width="60%">
< el -dialog v-model ="dialogVisible" title=" 文章编辑 " width="60%">
< el -form :model ="Info" label -width = " 100px " v-loading ="loading" >
< el -form -item label = " 名称 ">
{{ Info . name } }
< el -form -item label = " 标题 ">
<el -input v -model = " Info.title " / >
< / e l - f o r m - i t e m >
< el -form -item label = "Logo" >
< el -upload class = "avatar-uploader" :action ="upfileurl" :headers ="headerObj"
@ -54,37 +54,11 @@
< / e l - i c o n >
< / e l - u p l o a d >
< / e l - f o r m - i t e m >
< el -form -item label = "体检类型" >
< el -checkbox -group v-model ="Info.checkup_type_id" >
< el -select :filterable ="true" clearable v-model ="Info.checkup_type_id" placeholder="选择体检类型" >
< el -option v -for = " ( item , index ) in CheckUpTypeEnableList " :key ="index" :label ="item.name"
: value = "item.id" / >
< / e l - s e l e c t >
< / e l - c h e c k b o x - g r o u p >
< el -form -item label = "作者" >
< el -input v -model = " Info.author " / >
< / e l - f o r m - i t e m >
< el -form -item label = "套餐类型" >
< el -select :filterable ="true" clearable v-model ="Info.type_id" placeholder="选择套餐类型" >
< el -option v -for = " ( item , index ) in ComboTypeList " :key ="index" :label ="item.name"
: value = "item.id" / >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
< el -form -item label = "适应人群" >
< el -select :filterable ="true" clearable v-model ="Info.crowd_id" placeholder="选择适应人群" >
< el -option v -for = " ( item , index ) in ComboCrowdList " :key ="index" :label ="item.name"
: value = "item.id" / >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
< el -form -item label = "标签" >
< el -input v -model = " Info.tags " type = "textarea" / >
< / e l - f o r m - i t e m >
< el -form -item label = "标签2" >
< el -input v -model = " Info.tags2 " type = "textarea" / >
< / e l - f o r m - i t e m >
< el -form -item label = "简介" >
< el -input v -model = " Info.intro " type = "textarea" / >
< / e l - f o r m - i t e m >
< el -form -item label = "服务承诺" >
< el -input v -model = " Info.sub_intro " type = "textarea" / >
< el -form -item label = "排序" >
< el -input -number v -model = " Info.order " :min ="1" :max ="999" / >
< / e l - f o r m - i t e m >
< el -form -item label = "详情" >
< div style = "border: 1px solid #ccc" >
@ -120,11 +94,11 @@
Toolbar
} from '@wangeditor/editor-for-vue'
import {
ElMessage
ElMessage , ElMessageBox
} from 'element-plus'
import {
UpFileUrl ,
ArticleGetList
ArticleGetList , ArticleSave , ArticleGetDetail , ArticleGetDel
} from '@/api/api.js'
import {
Edit ,
@ -154,7 +128,7 @@
let BaseUrl = ref ( import . meta . env . VITE _APP _FILE )
const upLoadSuccess = ( res ) => {
logo . value = BaseUrl . value + res . data
Info . value . cover = res . data
Info . value . head_img = res . data
}
let searchInfo = ref ( { } ) ;
let Info = ref ( { } ) ;
@ -212,16 +186,76 @@
editorRef . value = editor / / 记 录 e d i t o r 实 例 , 重 要 !
}
const ArticleTypeChange = ( ) => {
Info . value . type = searchInfo . value . ArticleType
GetList ( )
}
const AddClick = ( ) => {
dialogVisible . value = true
Info . value . order = 1
Info . value . id = 0
}
const EditClick = ( ) => {
const EditClick = ( row ) => {
dialogVisible . value = true
loading . value = true
ArticleGetDetail ( {
id : row . id
} ) . then ( res => {
loading . value = false
if ( res . status ) {
Info . value = res . data
logo . value = BaseUrl . value + res . data . head _img
editorRef . value . setHtml ( Info . value . content )
} else {
ElMessage . error ( res . msg )
}
} )
}
const Save = ( ) => {
Info . value . content = editorRef . value . getHtml ( )
loading . value = true
ArticleSave ( {
Info : Info . value
} ) . then ( res => {
loading . value = false
if ( res . status ) {
dialogVisible . value = false
GetList ( )
} else {
ElMessage . error ( res . msg )
}
} )
}
const Del = ( row ) => {
ElMessageBox . confirm (
'确定删除吗?' ,
'提示' ,
{
confirmButtonText : '确定' ,
cancelButtonText : '取消' ,
type : 'warning' ,
}
)
. then ( ( ) => {
loading . value = true
ArticleGetDel ( {
id : row . id
} ) . then ( res => {
loading . value = false
if ( res . status ) {
ElMessage ( {
type : 'success' ,
message : '删除完成' ,
} )
GetList ( )
} else {
ElMessage . error ( res . msg )
}
} )
} )
}
onMounted ( ( ) => {
searchInfo . value . ArticleType = 1
Info . value . type = 1
GetList ( )
} )
< / script >