课程登录后刷新

v2
king 1 year ago
parent 22e012e711
commit fd06be84d5
  1. 34
      src/pages/business/videoInfo/components/catalogue.tsx
  2. 2
      src/pages/business/videoInfo/videoInfo.tsx
  3. 4
      src/pages/login/login.tsx
  4. 2
      src/pages/my/my.tsx

@ -20,6 +20,7 @@ interface Props {
setHors: (is_complete: boolean, id: number) => void
id: number //课程
playId: number | null
refresh: () => void
}
const tabList = [
@ -29,7 +30,7 @@ const tabList = [
]
const Catalogue: FC<Props> = ({data, setHors, id, playId}) => {
const Catalogue: FC<Props> = ({data, setHors, id, playId, refresh}) => {
const [current, setCurrent] = useState(1)
const [show, setShow] = useState(false)
const [playing, setPlaying] = useState(false)
@ -152,19 +153,24 @@ const Catalogue: FC<Props> = ({data, setHors, id, playId}) => {
{current === 0 && <View className='short_desc'>{data?.course.short_desc || data?.course.title}</View>}
{current === 1 && <View>
<View className='my-2'></View>
{!token && <LoginView offImage style={{
position: 'absolute',
left: 0,
height: 'auto',
right: 0,
bottom: 0,
top: 0,
margin: 'auto',
paddingTop: '100rpx',
justifyContent: 'flex-end',
flexDirection: 'column-reverse',
background: 'rgba(255,255,255,.9)'
}}/>}
{
!token && <LoginView
onSuccess={refresh}
offImage
style={{
position: 'absolute',
left: 0,
height: 'auto',
right: 0,
bottom: 0,
top: 0,
margin: 'auto',
paddingTop: '100rpx',
justifyContent: 'flex-end',
flexDirection: 'column-reverse',
background: 'rgba(255,255,255,.9)'
}}/>
}
{data?.chapters.length
? Object.values(data?.chapters || {}).map((d, index) => <View key={d.id}>
<Collapse title={`${index + 1}.${d.name}`}>

@ -121,7 +121,7 @@ const VideoInfo: FC = () => {
<Text>{((data?.learn_hour_records.length || 0) / (data?.course.class_hour || 1) * 100).toFixed(0)}%</Text>
</View>
</View>
<Catalogue data={data} setHors={setHors} id={id} playId={playId}/>
<Catalogue data={data} setHors={setHors} id={id} playId={playId} refresh={() => getData(false)}/>
</View>
)
}

@ -57,7 +57,9 @@ const Login: FC = () => {
setToken(token)
setCompany(company)
setLoading(false)
Taro.navigateBack()
setTimeout(() => {
Taro.navigateBack()
})
} else {
Taro.setStorageSync('openid', catch_key)
Taro.reLaunch({url: '/pages/check/check'})

@ -89,7 +89,7 @@ const My: FC = () => {
<View className={styles.bg}/>
<View className={styles.content}>
<View className='mb-4' style={{opacity: 1 - Number(navbarOpacity)}}>
<View className='mb-4'>
<Header companyList={companyList} showCompany={() => companyList.length >= 2 && setCompanyShow(true)}/>
</View>

Loading…
Cancel
Save