一杯沧海 1 year ago
commit 36e8076861
  1. 18
      src/api/curriculum.ts
  2. 4
      src/api/home.ts
  3. 8
      src/pages/home/components/feature_recommended.tsx
  4. 18
      src/pages/my/components/header/time.tsx
  5. 4
      src/pages/preview/profession/profession.tsx

@ -34,10 +34,18 @@ export interface HourPlayData {
} }
export interface Course { export interface Course {
courses: Curriculum[] /** 完成 */
learn_course_records: unknown finished_count: number;
user_course_hour_count: unknown /** 未完成 */
stats: CueStats not_finished_count: number
/** 选修课时数量 */
not_required_count: number
/** 必修课时数量 */
required_count: number
/** 今天 */
today_learn_time: number
/** 累计 */
total_learn_time: number
} }
interface AnswerRecord { interface AnswerRecord {
@ -87,7 +95,7 @@ export const curriculum = {
}, },
/** 课程进度 */ /** 课程进度 */
course() { course() {
return request<Course>(`/api/v1/user/courses`, "GET") return request<Course>(`/api/v1/user/all/course/info`, "GET")
}, },
/** 课程结束 */ /** 课程结束 */
curEnd(courseId: number, id: number, data: CurEndParam) { curEnd(courseId: number, id: number, data: CurEndParam) {

@ -59,5 +59,9 @@ export const HomeApi = {
}, },
skillList(categoryId: number, page: number, page_size: number) { skillList(categoryId: number, page: number, page_size: number) {
return request<{ data: Kill[], total: number }>('/home/v1/skill/index', "GET", {categoryId, page, page_size}) 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})
} }
} }

@ -93,8 +93,14 @@ const FeatureRecommended: FC = () => {
return [] return []
} }
/** 疾病 */
async function getIllness() {
const res = await HomeApi.illness(1, 3)
console.log(res)
}
useEffect(() => { 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)) const oldData: Data[] = JSON.parse(JSON.stringify(data))
oldData[0].data = brand oldData[0].data = brand
oldData[1].data = health oldData[1].data = health

@ -22,8 +22,8 @@ const Time: FC = () => {
const [list, setList] = useState<List[]>([ const [list, setList] = useState<List[]>([
{title: '今日时长', time: '00:00', src: time1}, {title: '今日时长', time: '00:00', src: time1},
{title: '累计时长', time: '00:00', src: time2}, {title: '累计时长', time: '00:00', src: time2},
{title: '必修课', time: '0/0', src: curriculum1, type: 1}, {title: '必修课', time: '0', src: curriculum1, type: 1},
{title: '选修课', time: '0/0', src: curriculum2, type: 2}, {title: '选修课', time: '0', src: curriculum2, type: 2},
{title: '已完成', time: '0', src: over, type: 3}, {title: '已完成', time: '0', src: over, type: 3},
{title: '未完成', time: '0', src: incomplete, type: 4}, {title: '未完成', time: '0', src: incomplete, type: 4},
]) ])
@ -31,14 +31,14 @@ const Time: FC = () => {
Taro.useDidShow(async () => { Taro.useDidShow(async () => {
try { try {
const {stats} = await curriculum.course() const res = await curriculum.course()
const oldList: List[] = JSON.parse(JSON.stringify(list)) const oldList: List[] = JSON.parse(JSON.stringify(list))
oldList[0].time = formatMinute(stats.today_learn_duration) oldList[0].time = formatMinute(res.today_learn_time)
oldList[1].time = formatMinute(stats.learn_duration) oldList[1].time = formatMinute(res.total_learn_time)
oldList[2].time = stats.required_course_count oldList[2].time = res.required_count
oldList[3].time = stats.nun_required_course_count oldList[3].time = res.not_required_count
oldList[4].time = stats.required_finished_course_count + stats.nun_required_finished_course_count oldList[4].time = res.finished_count
oldList[5].time = stats.total_course_count - (stats.required_finished_course_count + stats.nun_required_finished_course_count) oldList[5].time = res.not_finished_count
setList(oldList) setList(oldList)
} catch (e) { } catch (e) {
} }

@ -89,7 +89,7 @@ const Profession = () => {
className={styles.height}> className={styles.height}>
{ {
data.data.map(d => data.data.map(d =>
<View className={styles.killBox} onClick={() => jump(d.resource.url)} > <View className={styles.killBox} onClick={() => jump(d.resource.url)}>
<Image src={d.url_path} mode='widthFix'/> <Image src={d.url_path} mode='widthFix'/>
<View className='text-ellipsis flex-1'>{d.resource.name}</View> <View className='text-ellipsis flex-1'>{d.resource.name}</View>
</View> </View>
@ -107,7 +107,7 @@ const Profession = () => {
</View> </View>
<Swiper <Swiper
current={tabs.findIndex(d=>d.value === categoryId)} current={tabs.findIndex(d => d.value === categoryId)}
onChange={swiperChange} onChange={swiperChange}
className={styles.height} className={styles.height}
style={{paddingTop: '10px'}}> style={{paddingTop: '10px'}}>

Loading…
Cancel
Save