前端考题

制作一个新闻阅读页面,页面涉及栏目列表页,文章列表页,文章详情页,下面提供三个所需的API,有疑问,可直接询问现场工作人员.

1. 栏目列表页API

https://user.wxls.pro/news//api/news?expand=category,content,hits&count=30&page=1&catid=972
{
    "data": {
        "_meta": {
            "page": 1,
            "per_page": 30,
            "total_items": 22,
            "total_pages": 1
        },
        "items": [
            {
                "ad_status": "1",
                "description": "播出:每日19:35",
                "examine": "1",
                "id": 397490, # 文章ID
                "inputtime": 1566958749, # 文章创建时间
                "islink": 1,
                "listorder": 23,
                "thumb": "http://www.lsol.com.cn/uploadfile/2019/0829/20190829090221454.jpg",
                "title": "丽水新闻", # 标题
                "url": "27" # 栏目ID
            },
            ...
        ]
    },
    "success": true
}

提示

返回的参数,这里注意一下,请求API后,返回的参数,url这里就是栏目的ID

2. 文章列表API

https://user.wxls.pro/news//api/news?expand=category,content,hits&count=5&page=1&catid=27
{
    "data": {
        "_meta": {
            "page": 1,
            "per_page": 5,
            "total_items": 25703,
            "total_pages": 5141
        },
        "items": [
            {
                "ad_status": "3",
                "category": {
                    "catid": 27,
                    "catname": "丽水新闻",
                    "image": ""
                },
                "content": "",
                "copyfrom": "",
                "description": "  滩坑引水工程,是丽水目前最大的引水项目,建成后可保障79万居民饮用水需求。",
                "examine": "1",
                "hits": 3251,
                "id": 425819,
                "inputtime": 1583066103,
                "islink": 0,
                "listorder": 0,
                "thumb": "http://www.lsol.com.cn/uploadfile/2020/0301/20200301084158349.jpg",
                "title": "两手抓 两手硬 两战赢:滩坑引水工程“复工”记",
                "tousource": "",
                "video": [
                    "202003/01/5e5bac2f-1131d-a7a4-4a37-9688b19f/transcode_d3aeb9cc-4faa-fedd-2d46-fac8775e.mp4"
                ]
            },
            ...
        ]
    },
    "success": true
}

提示

注意这个API的catid参数,就是上面栏目API的URL参数

3. 文章详情API

https://user.wxls.pro/news//api/new/414227?expand=category,content,hits
{
    "data": {
        "ad_status": "3",
        "description": "  扶贫项目和资金是基层群众脱贫致富的“雪中炭”,却也为滋生腐败提供了土壤。",
        "examine": "1",
        "id": 414227,
        "inputtime": 1578400361,
        "islink": 1,
        "listorder": 0,
        "thumb": "http://www.lsol.com.cn/uploadfile/2020/0107/20200107084216164.jpg",
        "title": "“不忘初心 牢记使命”主题教育:云和:抓好“管”与“防” 织好扶贫风险“防护网”",
        "url": "1234"
    },
    "success": true
}