一、實現功能首頁各類排行榜加載數據:
向下遍歷子節點並展開;
1.展開過程中動態加載簡介summary、書類bookType;
2.book對象上包裹Rank節點,描述book對象在不同排行榜下所處位置(sort);
3.可控制排行榜下的book數目
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.限制子類數目
query getBookTypeList($rootId: Int=0, $totalCount: Int=12){
bookTypeList(parentTypeId: $rootId){
typeId
typeName
children(totalCount: $totalCount){
typeId
typeName
parentTypeId
bookCount
}
}
}