import { httpProvider } from './http' ; export class PageProvider { /**
     * 获取所有页面
     */ static async getPages ( params ) { return httpProvider . get ( '/page' , { params : params } ) ; } /**
     * 获取所有已发布页面
     */ static async getAllPublisedPages ( ) { return httpProvider . get ( '/page' , { params : { status : 'publish' } } ) . then ( ( res ) => { return [ res [ 0 ] . sort ( ( a , b ) => - a . order + b . order ) , res [ 1 ] ] ; } ) ; } param id static async getPage ( id ) { return httpProvider . get ( `/page/${ id }` ) ; } param data static async addPage ( data ) { return httpProvider . post ( '/page' , data ) ; } param id param data static async updatePage ( id , data ) { return httpProvider . patch ( `/page/${ id }` , data ) ; } param id param data static async updatePageViews ( id ) { return httpProvider . post ( `/page/${ id }/views` ) ; } param id static async deletePage ( id ) { return httpProvider . delete ( `/page/${ id }` ) ; } }