课程登录后刷新

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

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

@ -89,7 +89,7 @@ const My: FC = () => {
<View className={styles.bg}/> <View className={styles.bg}/>
<View className={styles.content}> <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)}/> <Header companyList={companyList} showCompany={() => companyList.length >= 2 && setCompanyShow(true)}/>
</View> </View>

Loading…
Cancel
Save