Przeglądaj źródła

Merge pull request #2021 from visuddhinanda/agile

修正chapter list offset = 20问题
visuddhinanda 2 lat temu
rodzic
commit
c98e22a01c

+ 1 - 1
dashboard/src/components/channel/ChapterInChannelList.tsx

@@ -169,7 +169,7 @@ const ChapterInChannelListWidget = ({ channelId, onSelect }: IWidget) => {
       request={async (params = {}, sorter, filter) => {
         // TODO 加排序
         console.log(params, sorter, filter);
-        const offset = (params.current || 1 - 1) * (params.pageSize || 20);
+        const offset = ((params.current || 1) - 1) * (params.pageSize || 20);
         const res = await get<IChapterListResponse>(
           `/v2/progress?view=chapter&channel=${channelId}&progress=0.01&offset=${offset}`
         );

+ 3 - 4
dashboard/src/components/corpus/TopChapter.tsx

@@ -61,15 +61,14 @@ const TopChapterWidget = ({ studioName }: IWidget) => {
       showActions="hover"
       grid={{ gutter: 16, column: 2, md: 1 }}
       request={async (params = {}, sorter, filter) => {
-        console.log(params, sorter, filter);
-        const offset = (params.current || 1 - 1) * (params.pageSize || 20);
+        console.info(params, sorter, filter);
         const res = await get<IChapterListResponse>(
           `/v2/progress?view=chapter&studio=${studioName}&progress=0.9&limit=4`
         );
-        console.log(res.data.rows);
+        console.debug("result", res.data.rows);
         const items: IItem[] = res.data.rows.map((item, id) => {
           return {
-            sn: id + offset + 1,
+            sn: id + 1,
             book: item.book,
             paragraph: item.para,
             view: item.view,