diff --git a/src/api/curriculum.ts b/src/api/curriculum.ts index b304600..ecaec40 100644 --- a/src/api/curriculum.ts +++ b/src/api/curriculum.ts @@ -34,10 +34,18 @@ export interface HourPlayData { } export interface Course { - courses: Curriculum[] - learn_course_records: unknown - user_course_hour_count: unknown - stats: CueStats + /** 完成 */ + finished_count: number; + /** 未完成 */ + not_finished_count: number + /** 选修课时数量 */ + not_required_count: number + /** 必修课时数量 */ + required_count: number + /** 今天 */ + today_learn_time: number + /** 累计 */ + total_learn_time: number } interface AnswerRecord { @@ -87,7 +95,7 @@ export const curriculum = { }, /** 课程进度 */ course() { - return request(`/api/v1/user/courses`, "GET") + return request(`/api/v1/user/all/course/info`, "GET") }, /** 课程结束 */ curEnd(courseId: number, id: number, data: CurEndParam) { diff --git a/src/api/home.ts b/src/api/home.ts index f8817b0..da8a404 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -59,5 +59,9 @@ export const HomeApi = { }, skillList(categoryId: number, page: number, page_size: number) { return request<{ data: Kill[], total: number }>('/home/v1/skill/index', "GET", {categoryId, page, page_size}) + }, + /** 疾病知识 */ + illness(page: number, page_size: number) { + return request('/home/v1/article/illness_list', "GET", {page, page_size}) } } diff --git a/src/pages/home/components/feature_recommended.tsx b/src/pages/home/components/feature_recommended.tsx index 779a5e7..3250dc8 100644 --- a/src/pages/home/components/feature_recommended.tsx +++ b/src/pages/home/components/feature_recommended.tsx @@ -93,8 +93,14 @@ const FeatureRecommended: FC = () => { return [] } + /** 疾病 */ + async function getIllness() { + const res = await HomeApi.illness(1, 3) + console.log(res) + } + useEffect(() => { - Promise.all([getBrand(), getHealth(), getKill()]).then(([brand, health, kill]) => { + Promise.all([getBrand(), getHealth(), getKill(), getIllness()]).then(([brand, health, kill]) => { const oldData: Data[] = JSON.parse(JSON.stringify(data)) oldData[0].data = brand oldData[1].data = health diff --git a/src/pages/my/components/header/time.tsx b/src/pages/my/components/header/time.tsx index c542e33..a2aeeda 100644 --- a/src/pages/my/components/header/time.tsx +++ b/src/pages/my/components/header/time.tsx @@ -22,8 +22,8 @@ const Time: FC = () => { const [list, setList] = useState([ {title: '今日时长', time: '00:00', src: time1}, {title: '累计时长', time: '00:00', src: time2}, - {title: '必修课', time: '0/0', src: curriculum1, type: 1}, - {title: '选修课', time: '0/0', src: curriculum2, type: 2}, + {title: '必修课', time: '0', src: curriculum1, type: 1}, + {title: '选修课', time: '0', src: curriculum2, type: 2}, {title: '已完成', time: '0', src: over, type: 3}, {title: '未完成', time: '0', src: incomplete, type: 4}, ]) @@ -31,14 +31,14 @@ const Time: FC = () => { Taro.useDidShow(async () => { try { - const {stats} = await curriculum.course() + const res = await curriculum.course() const oldList: List[] = JSON.parse(JSON.stringify(list)) - oldList[0].time = formatMinute(stats.today_learn_duration) - oldList[1].time = formatMinute(stats.learn_duration) - oldList[2].time = stats.required_course_count - oldList[3].time = stats.nun_required_course_count - oldList[4].time = stats.required_finished_course_count + stats.nun_required_finished_course_count - oldList[5].time = stats.total_course_count - (stats.required_finished_course_count + stats.nun_required_finished_course_count) + oldList[0].time = formatMinute(res.today_learn_time) + oldList[1].time = formatMinute(res.total_learn_time) + oldList[2].time = res.required_count + oldList[3].time = res.not_required_count + oldList[4].time = res.finished_count + oldList[5].time = res.not_finished_count setList(oldList) } catch (e) { } diff --git a/src/pages/preview/profession/profession.tsx b/src/pages/preview/profession/profession.tsx index cb26871..3c98948 100644 --- a/src/pages/preview/profession/profession.tsx +++ b/src/pages/preview/profession/profession.tsx @@ -89,7 +89,7 @@ const Profession = () => { className={styles.height}> { data.data.map(d => - jump(d.resource.url)} > + jump(d.resource.url)}> {d.resource.name} @@ -107,7 +107,7 @@ const Profession = () => { d.value === categoryId)} + current={tabs.findIndex(d => d.value === categoryId)} onChange={swiperChange} className={styles.height} style={{paddingTop: '10px'}}>