|
|
@@ -2,11 +2,11 @@ import { useState, useEffect } from "react";
|
|
|
|
|
|
import { get } from "../../request";
|
|
|
import { IApiResponseChapterChannelList } from "../api/Corpus";
|
|
|
-import { IParagraph } from "./BookViewer";
|
|
|
+import { IChapter } from "./BookViewer";
|
|
|
import ChapterInChannel, { IChapterChannelData } from "./ChapterInChannel";
|
|
|
|
|
|
interface IWidgetPaliChapterChannelList {
|
|
|
- para: IParagraph;
|
|
|
+ para: IChapter;
|
|
|
}
|
|
|
const defaultData: IChapterChannelData[] = [];
|
|
|
const Widget = ({ para }: IWidgetPaliChapterChannelList) => {
|
|
|
@@ -15,19 +15,15 @@ const Widget = ({ para }: IWidgetPaliChapterChannelList) => {
|
|
|
useEffect(() => {
|
|
|
console.log("palichapterlist useEffect");
|
|
|
let url = `/v2/progress?view=chapter_channels&book=${para.book}&par=${para.para}`;
|
|
|
- get(url).then(function (myJson) {
|
|
|
- console.log("ajex", myJson);
|
|
|
- const data = myJson as unknown as IApiResponseChapterChannelList;
|
|
|
- const newData: IChapterChannelData[] = data.data.rows.map((item) => {
|
|
|
+ get<IApiResponseChapterChannelList>(url).then(function (json) {
|
|
|
+ const newData: IChapterChannelData[] = json.data.rows.map((item) => {
|
|
|
return {
|
|
|
channel: {
|
|
|
- channelName: item.channel.name,
|
|
|
- channelId: item.channel.uid,
|
|
|
- channelType: item.channel.type,
|
|
|
- studioName: "V",
|
|
|
- studioId: "123",
|
|
|
- studioType: "p",
|
|
|
+ name: item.channel.name,
|
|
|
+ id: item.channel.uid,
|
|
|
+ type: item.channel.type,
|
|
|
},
|
|
|
+ studio: item.studio,
|
|
|
progress: Math.ceil(item.progress * 100),
|
|
|
hit: item.views,
|
|
|
like: 0,
|