import request from '@/utils/request'

export function submitForm (data){
    console.log("文章列表",data)
    return request({
        url: '/api/acticle/createacticle',
        method: 'Post',
        data: data
    })
}

export function getArticleType(params){
     console.log("分类信息")
     return request({
         url:'/api/acticle/getArticleType',
         method: 'Get',
         params: params
     })
}

export function GetAllArticles(param,status,keyword,id){
    const params = {
        param:param,
        status:status,
        keyword:keyword,
        id:id,
    }
    console.log("params是什么?",params)
     return request({
         url:'/api/acticle/getAllArticles',
         method:'Get',
         params:params,
     })
}

export function addCategory(data){
    return request({
        url:'/api/article/addCategory',
        method:'Post',
        data:data
    })
}

export function GetCategorys(params){
      console.log("params",params)
     return request({
         url:'/api/acticle/getCategorys',
         method:'Get',
         params:params
     })
}

export function EditArticleCategory(id,data){
    console.log("abc",data)
    return request({
        url:'/api/acticle/edit?id='+id,
        method:'Post',
        data:data
    })
}

export function DeleteCategorys(data){
     return request({
         url:'/api/acticle/delete',
         method:'delete',
         data:data
     })
}

export function addVido(data){
    console.log("发布视频",data)
    return request({
        url:"/api/acticle/addvido",
        method:"post",
        data:data,
    })
}

export function Savedraft(data){
    return request({
        url:"/api/acticle/savedraft",
        method:"post",
        data:data,
    })
}

export function previewArticle(data){
    return request({
        url:"/api/acticle/prviewArticle",
        method:"post",
        data:data
    })
}

export function getarticlePreview(params){
   return request({
       url:"/api/acticle/getarticlePreview",
       method:'Get',
       params:params
   })
}

export function save(data){
   return request({
       url:"/api/acticle/save",
       method:"Post",
       data:data
   })
}

export function openDelete(data){
    return request({
        url:"/api/article/Delete",
        method:"delete",
        data:data
    })
}


export function getEditArticle(id,param){
    console.log("params是啥?",param)
    return request({
        url:"/api/acticle/getEditArticle?id="+id,
        method:"Get",
        param:param,
    })
}

export function getMenus(params){
    console.log("params是什么",params)
    return request({
        url:"/api/acticle/getMenus",
        method:'Get',
        params:params
    })
}

export function UpdataArticleInfo(id,data){
   console.log("修改文章内容",data)
   return request({
       url:"/api/acticle/updateArticlesInfo?id="+id,
       method:'Post',
       data:data
   })
}

export function previewEditArticle(id,data){
   return request({
       url:"/api/acticle/previewEditArticle?id="+id,
       method:'Post',
       data:data
   })
}

export function getPreviewInfo(params){
    return request({
        url:"/api/acticle/getPreviewInfo",
        method:'Post',
        params:params,
    })
}

export function getAllComment(params){
    console.log("评论",params)
    return request({
        url:"/api/acticle/getAllComment",
        method:'Get',
        params:params,
    })
}

export function getArticleCommentDetail(params,id){
    console.log("文章评论详情",id)
    return request({
        url:"/api/acticle/getArticleCommentDetail?id="+id,
        method:'Get',
        params:params,
    })
}
