一、实现功能首页各类排行榜加载数据:
向下遍历子节点并展开; 1.展开过程中动态加载简介summary、书类bookType; 2.book对象上包裹Rank节点,描述book对象在不同排行榜下所处位置(sort); 3.可控制排行榜下的book数目
代码语言:javascript复制query getRankList($rankTypeId: ID = 1, $totalCount: Int, $withBookTypeName: Boolean = false, $withSummary: Boolean = false) {
rankType(rankTypeId: $rankTypeId) {
typeId
typeName
rankList(totalCount: $totalCount) {
rankTypeId
book {
bookId
bookName
cover
banner
summary @include(if: $withSummary)
bookType @include(if: $withBookTypeName) {
typeName
}
author
}
sort
}
}
}
二、实现首页书类展示:
1.父类及子类展展开; 2.本站对应子类下的书籍作品数目展示; 3.限制子类数目
代码语言:javascript复制query getBookTypeList($rootId: Int=0, $totalCount: Int=12){
bookTypeList(parentTypeId: $rootId){
typeId
typeName
children(totalCount: $totalCount){
typeId
typeName
parentTypeId
bookCount
}
}
}