Skip to content

Commit

Permalink
fix: 接口返回时间过长体验问题
Browse files Browse the repository at this point in the history
  • Loading branch information
John-rong committed May 20, 2024
1 parent a5c40b2 commit 1b42d04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/pages/Initial/components/orgInit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const Index = () => {
size,
keyword,
},
silent: false,
loadingNeedMask: true,
})
.then((res) => {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/Initial/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TBizStudentGetInfo,
} from 'src/utils'
import useUpdateEffect from 'src/hooks/useUpdateEffect'
import Loading from 'src/components/baseBuiltComp/Loading'
import OrgInit from './components/orgInit'
import { getStudentInfoUrl, loginInterUrl } from './common'
import GradeInit from './components/gradeInit'
Expand All @@ -25,6 +26,7 @@ const Index = () => {
const userState = useSelector((root: RootState) => root.userinfoModel)
const orgCacheState = useSelector((root: RootState) => root.runtimeModel.organizationCache)
const [isLogin, setLogin] = useState<boolean | undefined>()
const [isLoading, setLoading] = useState<boolean | undefined>(true)
/** 用户信息 拿到token 组织 年级 班级 */
const {
orgId: _orgId,
Expand Down Expand Up @@ -87,7 +89,6 @@ const Index = () => {
// 有token获取用户信息
const result = await Get<TBizStudentGetInfo>({
url: getStudentInfoUrl,
loadingNeedMask: true,
silent: true,
})
const { code, data } = result
Expand Down Expand Up @@ -149,6 +150,7 @@ const Index = () => {
const eventMap = { back }
const fn = eventMap[action]
fn && fn()
setLoading(false)
})
/** END */

Expand All @@ -160,8 +162,10 @@ const Index = () => {
}, [isLogin])

// 未完善,跳转到组织初始化页面

const notHaveOrg = !hasOrg
const onlyHasOrg = hasOrg && !hasGrade
if (isLoading) return <Loading isCover isShow />
if (notHaveOrg) return <OrgInit />
if (onlyHasOrg || !hasClass) return <GradeInit />
return <InitAccomplish />
Expand Down

0 comments on commit 1b42d04

Please sign in to comment.