parent
618d28cd62
commit
5b9c976e78
@ -0,0 +1,3 @@ |
||||
export default definePageConfig({ |
||||
navigationBarTitleText: '更多课程' |
||||
}) |
@ -0,0 +1,50 @@ |
||||
import {View} from "@tarojs/components"; |
||||
import {Profile} from '@/store' |
||||
import {FC, useEffect, useState} from "react"; |
||||
import {getCurrentInstance} from "@tarojs/runtime"; |
||||
import {curriculum} from "@/api"; |
||||
import VideoCover from "@/components/videoCover/videoCover"; |
||||
|
||||
const Index: FC = () => { |
||||
const {company} = Profile.useContainer() |
||||
const {categoryId} = getCurrentInstance()?.router?.params as { categoryId: number } |
||||
const [data, setData] = useState<Curriculum[]>([]) |
||||
|
||||
async function getData() { |
||||
try { |
||||
const res = await curriculum.categoryCur(categoryId!, company?.id!) |
||||
setData(res) |
||||
} catch (e) { |
||||
} |
||||
} |
||||
|
||||
|
||||
useEffect(() => { |
||||
getData() |
||||
}, []) |
||||
return ( |
||||
<> |
||||
<View className='flex flex-wrap px-1'> |
||||
{data.map(d => <VideoCover |
||||
thumb={d.thumb} |
||||
title={d.title} |
||||
id={d.id} |
||||
depId={d.id} |
||||
/>) |
||||
} |
||||
</View> |
||||
<View className='text-center text-muted'>- 暂无更多 -</View> |
||||
</> |
||||
) |
||||
} |
||||
|
||||
|
||||
const CategoryCur = () => { |
||||
return ( |
||||
<Profile.Provider> |
||||
<Index/> |
||||
</Profile.Provider> |
||||
) |
||||
} |
||||
|
||||
export default CategoryCur |
@ -1,3 +0,0 @@ |
||||
export default definePageConfig({ |
||||
navigationBarTitleText: '课程' |
||||
}) |
@ -1,3 +1,4 @@ |
||||
export default definePageConfig({ |
||||
navigationStyle: 'custom' |
||||
navigationStyle: 'custom', |
||||
onReachBottomDistance: 30 |
||||
}) |
||||
|
Loading…
Reference in new issue