Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
d9ac3788
Commit
d9ac3788
authored
Jul 13, 2021
by
guomingpang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style:全局tablist 中的switch使用small尺寸
parent
2b36c514
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
255 additions
and
263 deletions
+255
-263
src/modules/course-manage/components/LiveCourseList.jsx
+2
-1
src/modules/course-manage/graphics-course/components/GraphicsCourseList.jsx
+47
-41
src/modules/course-manage/offline-course/AddOfflineCourse.jsx
+26
-28
src/modules/course-manage/offline-course/components/AddGraphicsIntro.jsx
+92
-93
src/modules/course-manage/offline-course/components/OfflineCourseList.jsx
+8
-5
src/modules/course-manage/video-course/components/AddVideoIntro.jsx
+0
-0
src/modules/course-manage/video-course/components/VideoCourseList.jsx
+1
-0
src/modules/plan-manage/components/BasicInfo.jsx
+14
-9
src/modules/plan-manage/components/PlanList.jsx
+1
-0
src/modules/teach-tool/examination-manager/AddExam.tsx
+0
-0
src/routes/index.tsx
+64
-86
No files found.
src/modules/course-manage/components/LiveCourseList.jsx
View file @
d9ac3788
...
...
@@ -125,7 +125,7 @@ class LiveCourseList extends React.Component {
columns
=
[
{
title
:
'直播课'
,
width
:
'23%'
,
key
:
'course'
,
fixed
:
'left'
,
dataIndex
:
'courseName'
,
...
...
@@ -284,6 +284,7 @@ class LiveCourseList extends React.Component {
render
:
(
val
,
item
,
index
)
=>
{
return
(
<
Switch
size=
'small'
checked=
{
item
.
shelfState
===
'YES'
}
defaultChecked=
{
item
.
shelfState
===
'YES'
?
true
:
false
}
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
...
...
src/modules/course-manage/graphics-course/components/GraphicsCourseList.jsx
View file @
d9ac3788
...
...
@@ -9,7 +9,7 @@
import
User
from
'@/common/js/user'
;
import
college
from
'@/common/lottie/college'
;
import
{
PageControl
,
XMTable
}
from
'@/components'
;
import
{
appId
,
LIVE_SHARE
}
from
'@/domains/course-domain/constants'
;
import
{
LIVE_SHARE
}
from
'@/domains/course-domain/constants'
;
import
CourseService
from
'@/domains/course-domain/CourseService'
;
import
ShareLiveModal
from
'@/modules/course-manage/modal/ShareLiveModal'
;
import
{
Dropdown
,
message
,
Modal
,
Switch
,
Tooltip
}
from
'antd'
;
...
...
@@ -57,7 +57,7 @@ class GraphicsCourseList extends React.Component {
handlePlanName
=
(
planArray
)
=>
{
let
planStr
=
''
;
planArray
.
map
((
item
,
index
)
=>
{
planArray
.
forEach
((
item
,
index
)
=>
{
if
(
index
<
planArray
.
length
-
1
)
{
planStr
=
planStr
+
item
.
planName
+
'、'
;
}
else
{
...
...
@@ -76,18 +76,21 @@ class GraphicsCourseList extends React.Component {
width
:
321
,
fixed
:
'left'
,
render
:
(
val
,
record
)
=>
{
const
{
coverUrl
,
scheduleVideoUrl
}
=
record
;
const
{
coverUrl
}
=
record
;
return
(
<
div
className=
'record__item'
>
{
/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */
}
<
img
className=
'course-cover'
src=
{
coverUrl
||
defaultCoverUrl
}
/>
{
record
.
courseName
.
length
>
25
?
(
<
Tooltip
title=
{
record
.
courseName
}
>
<
img
className=
'course-cover'
src=
{
coverUrl
||
defaultCoverUrl
}
alt=
''
/>
<
Choose
>
<
When
condition=
{
record
.
courseName
.
length
>
25
}
>
<
Tooltip
title=
{
record
.
courseName
}
>
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
</
Tooltip
>
</
When
>
<
Otherwise
>
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
</
Tooltip
>
)
:
(
<
div
className=
'course-name'
>
{
record
.
courseName
}
</
div
>
)
}
</
Otherwise
>
</
Choose
>
</
div
>
);
},
...
...
@@ -144,12 +147,14 @@ class GraphicsCourseList extends React.Component {
width
:
120
,
dataIndex
:
'courseware'
,
render
:
(
val
,
item
,
index
)
=>
{
return
(
<
Switch
checked=
{
item
.
shelfState
===
"YES"
}
defaultChecked=
{
item
.
shelfState
===
"YES"
?
true
:
false
}
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
/>
)
return
(
<
Switch
size=
'small'
checked=
{
item
.
shelfState
===
'YES'
}
defaultChecked=
{
item
.
shelfState
===
'YES'
?
true
:
false
}
onChange=
{
(
checked
)
=>
this
.
changeShelfState
(
index
,
item
,
checked
)
}
/>
);
},
},
{
...
...
@@ -168,7 +173,7 @@ class GraphicsCourseList extends React.Component {
dataIndex
:
'created'
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
return
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
},
},
{
...
...
@@ -178,7 +183,7 @@ class GraphicsCourseList extends React.Component {
dataIndex
:
'updated'
,
sorter
:
true
,
render
:
(
val
)
=>
{
return
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
return
window
.
formatDate
(
'YYYY-MM-DD H:i'
,
val
);
},
},
{
...
...
@@ -189,19 +194,22 @@ class GraphicsCourseList extends React.Component {
render
:
(
val
,
record
)
=>
{
return
(
<
div
className=
'related-task'
>
{
record
.
relatedPlanList
?
(
<
Tooltip
title=
{
this
.
handlePlanName
(
record
.
relatedPlanList
)
}
placement=
'top'
arrowPointAtCenter
>
{
record
.
relatedPlanList
.
map
((
item
,
index
)
=>
{
return
(
<
span
>
{
item
.
planName
}
{
index
<
record
.
relatedPlanList
.
length
-
1
&&
<
span
>
、
</
span
>
}{
' '
}
</
span
>
);
})
}
</
Tooltip
>
)
:
(
<
span
></
span
>
)
}
<
Choose
>
<
When
condition=
{
record
.
relatedPlanList
}
>
<
Tooltip
title=
{
this
.
handlePlanName
(
record
.
relatedPlanList
)
}
placement=
'top'
arrowPointAtCenter
>
{
record
.
relatedPlanList
.
map
((
item
,
index
)
=>
{
return
(
<
span
>
{
item
.
planName
}
{
index
<
record
.
relatedPlanList
.
length
-
1
&&
<
span
>
、
</
span
>
}{
' '
}
</
span
>
);
})
}
</
Tooltip
>
</
When
>
<
Otherwise
>
<
span
></
span
>
</
Otherwise
>
</
Choose
>
</
div
>
);
},
...
...
@@ -297,7 +305,7 @@ class GraphicsCourseList extends React.Component {
className=
'operate__item'
key=
'edit'
onClick=
{
()
=>
{
RCHistory
.
push
(
`/create-graphics-course?type=edit&id=${item.id}`
);
window
.
RCHistory
.
push
(
`/create-graphics-course?type=edit&id=${item.id}`
);
}
}
>
编辑
</
div
>
...
...
@@ -305,17 +313,17 @@ class GraphicsCourseList extends React.Component {
删除
</
div
>
</
div
>
)
}
//改变上架状态
changeShelfState
=
(
index
,
item
,
checked
)
=>
{
let
_shelfState
=
checked
?
"YES"
:
"NO"
)
;
}
;
//改变上架状态
changeShelfState
=
(
index
,
item
,
checked
)
=>
{
let
_shelfState
=
checked
?
'YES'
:
'NO'
;
// if(_shelfState==='NO'){
// _shelfState = "YES";
// }else{
// _shelfState = "NO"
// }
const
params
=
{
const
params
=
{
courseId
:
item
.
id
,
shelfState
:
_shelfState
,
};
...
...
@@ -326,7 +334,7 @@ class GraphicsCourseList extends React.Component {
}
else
{
message
.
success
(
'已取消展示'
);
}
this
.
props
.
changeShelfState
(
index
,
_shelfState
)
this
.
props
.
changeShelfState
(
index
,
_shelfState
);
}
});
};
...
...
@@ -355,8 +363,6 @@ class GraphicsCourseList extends React.Component {
// 显示分享弹窗
handleShowShareModal
=
(
record
,
needStr
=
false
)
=>
{
const
{
id
,
scheduleVideoUrl
}
=
record
;
const
_appId
=
appId
;
const
htmlUrl
=
`
${
LIVE_SHARE
}
graphics_detail/
${
id
}
?id=
${
User
.
getStoreId
()}
`
;
const
longUrl
=
htmlUrl
;
const
{
coverUrl
,
courseName
}
=
record
;
...
...
src/modules/course-manage/offline-course/AddOfflineCourse.jsx
View file @
d9ac3788
...
...
@@ -10,11 +10,10 @@
import
React
from
'react'
;
import
{
Button
,
Input
,
Radio
,
message
,
Modal
,
TreeSelect
,
Select
,
Switch
,
TimePicker
,
InputNumber
,
Tooltip
}
from
'antd'
;
import
$
from
'jquery'
;
import
Bus
from
'@/core/bus'
;
import
RangePicker
from
'@/modules/common/DateRangePicker'
;
import
ShowTips
from
'@/components/ShowTips'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
SelectStudent
from
'../modal/select-student'
;
import
SelectPrepareFileModal
from
'../../prepare-lesson/modal/SelectPrepareFileModal'
;
import
PreviewOfflineModal
from
'./modal/PreviewOfflineModal'
;
import
StoreService
from
'@/domains/store-domain/storeService'
;
...
...
@@ -26,13 +25,11 @@ import moment from 'moment';
import
Upload
from
'@/core/upload'
;
import
GraphicsEditor
from
'../components/GraphicsEditor'
;
import
MultipleDatePicker
from
'@/components/MultipleDatePicker'
;
import
ImgClipModal
from
'@/components/ImgClipModal'
import
ImgClipModal
from
'@/components/ImgClipModal'
;
import
'./AddOfflineCourse.less'
;
import
Bus
from
'@/core/bus'
;
const
{
Option
}
=
Select
;
const
defaultCoverUrl
=
'https://image.xiaomaiketang.com/xm/pxbWKsYA87.png'
;
let
cutFlag
=
false
;
const
unitList
=
[
{
key
:
'HOUR'
,
value
:
'小时'
},
{
key
:
'MINUTE'
,
value
:
'分钟'
},
...
...
@@ -42,8 +39,8 @@ class AddOfflineCourse extends React.Component {
constructor
(
props
)
{
super
(
props
);
const
courseId
=
getParameterByName
(
'id'
);
const
pageType
=
getParameterByName
(
'type'
);
const
courseId
=
window
.
getParameterByName
(
'id'
);
const
pageType
=
window
.
getParameterByName
(
'type'
);
this
.
state
=
{
courseId
,
// 线下课ID,编辑的时候从URL上带过来
...
...
@@ -159,7 +156,6 @@ class AddOfflineCourse extends React.Component {
const
{
result
=
{}
}
=
res
||
{};
const
{
courseName
,
courseState
,
categoryId
,
offlinePlace
,
whetherVisitorsJoin
,
...
...
@@ -341,13 +337,12 @@ class AddOfflineCourse extends React.Component {
this
.
setState
({
previewOfflineModal
});
};
handleSelectCover
=
(
file
)
=>
{
handleSelectCover
=
(
file
)
=>
{
this
.
setState
({
visible
:
true
,
imageFile
:
file
imageFile
:
file
,
});
}
};
//获取resourceId
getSignature
=
(
blob
,
fileName
)
=>
{
...
...
@@ -620,7 +615,7 @@ class AddOfflineCourse extends React.Component {
};
StoreService
.
getStoreUserBasicPage
(
_query
).
then
((
res
)
=>
{
const
{
result
=
{}
}
=
res
;
const
{
records
=
[],
total
=
0
,
hasNext
}
=
result
;
const
{
records
=
[],
hasNext
}
=
result
;
const
list
=
current
>
1
?
teacherList
.
concat
(
records
)
:
records
;
this
.
setState
({
hasNext
,
...
...
@@ -677,14 +672,11 @@ class AddOfflineCourse extends React.Component {
coverUrl
,
introduce
,
categoryId
,
categoryList
,
courseCatalogList
,
whetherVisitorsJoin
,
loadintroduce
,
showSelectCoverModal
,
visible
,
hasImgReady
,
cutImageBlob
,
teacherId
,
teacherList
,
calendarTime
,
...
...
@@ -846,7 +838,7 @@ class AddOfflineCourse extends React.Component {
);
}
}
getPopupContainer=
{
()
=>
document
.
getElementById
(
'teacher'
)
}
>
{
_
.
map
(
teacherList
,
(
item
,
index
)
=>
{
{
_
.
map
(
teacherList
,
(
item
)
=>
{
return
(
<
Option
value=
{
item
.
id
}
key=
{
item
.
id
}
>
{
item
.
nickName
}
...
...
@@ -894,7 +886,7 @@ class AddOfflineCourse extends React.Component {
</
span
>
<
div
>
<
div
className=
'select-day'
>
已选
<
span
className=
'mark-day'
>
{
isLongArr
(
calendarTime
)
?
calendarTime
.
length
:
0
}
</
span
>
天
已选
<
span
className=
'mark-day'
>
{
window
.
isLongArr
(
calendarTime
)
?
calendarTime
.
length
:
0
}
</
span
>
天
</
div
>
<
MultipleDatePicker
disabled=
{
isEditDisablie
}
selectDateList=
{
calendarTime
}
onSelect=
{
this
.
selectMultiDate
}
canSelectTodayBefore=
{
false
}
/>
</
div
>
...
...
@@ -982,8 +974,8 @@ class AddOfflineCourse extends React.Component {
onChange=
{
(
dates
)
=>
{
this
.
handleChangeDates
(
dates
);
}
}
renderExtraFooter=
{
()
=>
calendarTime
[
0
]
?
(
renderExtraFooter=
{
()
=>
(
<
If
condition=
{
calendarTime
[
0
]
}
>
<
div
style=
{
{
position
:
'absolute'
,
bottom
:
8
,
cursor
:
'pointer'
}
}
>
<
span
onClick=
{
()
=>
...
...
@@ -1043,8 +1035,8 @@ class AddOfflineCourse extends React.Component {
上课前3天
</
span
>
</
div
>
)
:
null
}
</
If
>
)
}
/>
</
div
>
)
}
...
...
@@ -1275,12 +1267,18 @@ class AddOfflineCourse extends React.Component {
}
}
onSelect=
{
this
.
handleSelectCover
}
/>
)
}
{
visible
&&
<
ImgClipModal
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});}
}
/>
}
{
this
.
state
.
previewOfflineModal
}
)
}
{
visible
&&
(
<
ImgClipModal
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});
}
}
/>
)
}
{
this
.
state
.
previewOfflineModal
}
</
div
>
);
}
...
...
src/modules/course-manage/offline-course/components/AddGraphicsIntro.jsx
View file @
d9ac3788
This diff is collapsed.
Click to expand it.
src/modules/course-manage/offline-course/components/OfflineCourseList.jsx
View file @
d9ac3788
...
...
@@ -17,6 +17,7 @@ import OfflineCourseData from '@/modules/course-manage/offline-course/OfflineCou
import
{
Dropdown
,
message
,
Modal
,
Switch
,
Tooltip
}
from
'antd'
;
import
moment
from
'moment'
;
import
React
from
'react'
;
import
{
find
,
reduce
,
last
}
from
'underscore'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
ENUM
from
'../../../knowledge-base/ENUM.js'
;
import
PreviewOfflineModal
from
'../modal/PreviewOfflineModal'
;
...
...
@@ -44,7 +45,7 @@ class OfflineCourseList extends React.Component {
handlePlanName
=
(
planArray
)
=>
{
let
planStr
=
''
;
planArray
.
map
((
item
,
index
)
=>
{
planArray
.
forEach
((
item
,
index
)
=>
{
if
(
index
<
planArray
.
length
-
1
)
{
planStr
=
planStr
+
item
.
planName
+
'、'
;
}
else
{
...
...
@@ -64,13 +65,13 @@ class OfflineCourseList extends React.Component {
fixed
:
'left'
,
render
:
(
val
,
record
)
=>
{
const
{
courseMediaVOS
,
courseName
,
offlinePlace
,
calendarTime
,
startTime
,
endTime
}
=
record
;
const
coverUrl
=
(
_
.
find
(
courseMediaVOS
,
(
data
)
=>
data
.
contentType
===
'COVER'
)
||
{}).
mediaUrl
;
const
coverUrl
=
(
find
(
courseMediaVOS
,
(
data
)
=>
data
.
contentType
===
'COVER'
)
||
{}).
mediaUrl
;
let
isContinue
=
calendarTime
.
length
>
1
;
_
.
reduce
(
calendarTime
,
(
a
,
b
)
=>
{
reduce
(
calendarTime
,
(
a
,
b
)
=>
{
isContinue
=
isContinue
&&
b
-
a
===
86400000
;
return
b
;
});
const
lastTime
=
_
.
last
(
calendarTime
);
const
lastTime
=
last
(
calendarTime
);
const
time
=
`
${
!
isContinue
?
calendarTime
.
map
((
item
)
=>
moment
(
item
).
format
(
'MM-DD'
)).
join
(
'、'
)
...
...
@@ -138,7 +139,9 @@ class OfflineCourseList extends React.Component {
width
:
120
,
dataIndex
:
'courseware'
,
render
:
(
val
,
item
,
index
)
=>
{
return
<
Switch
disabled=
{
item
.
courseState
===
'EXPIRED'
}
checked=
{
item
.
shelfState
===
'YES'
}
onChange=
{
()
=>
this
.
changeShelfState
(
item
)
}
/>;
return
(
<
Switch
size=
'small'
disabled=
{
item
.
courseState
===
'EXPIRED'
}
checked=
{
item
.
shelfState
===
'YES'
}
onChange=
{
()
=>
this
.
changeShelfState
(
item
)
}
/>
);
},
},
{
...
...
src/modules/course-manage/video-course/components/AddVideoIntro.jsx
View file @
d9ac3788
This diff is collapsed.
Click to expand it.
src/modules/course-manage/video-course/components/VideoCourseList.jsx
View file @
d9ac3788
...
...
@@ -153,6 +153,7 @@ class VideoCourseList extends React.Component {
render
:
(
val
,
item
,
index
)
=>
{
return
(
<
Switch
size=
'small'
loading=
{
ShelfLoading
}
checked=
{
item
.
shelfState
===
'YES'
}
defaultChecked=
{
item
.
shelfState
}
...
...
src/modules/plan-manage/components/BasicInfo.jsx
View file @
d9ac3788
...
...
@@ -16,18 +16,16 @@
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
from
'react'
;
import
{
Button
,
Input
,
Switch
,
Radio
,
Row
,
Col
,
Modal
,
message
,
Tooltip
}
from
'antd'
;
import
{
Button
,
Input
,
Switch
,
Radio
,
Row
,
Col
,
message
,
Tooltip
}
from
'antd'
;
import
{
withRouter
}
from
'react-router-dom'
;
import
SelectOperatorModal
from
'../modal/SelectOperatorModal'
;
import
SelectPrepareFileModal
from
'@/modules/prepare-lesson/modal/SelectPrepareFileModal'
;
import
Upload
from
'@/core/upload'
;
import
GraphicsEditor
from
'@/modules/course-manage/components/GraphicsEditor'
;
import
ImgClipModal
from
'@/components/ImgClipModal'
import
ImgClipModal
from
'@/components/ImgClipModal'
;
import
'./BasicInfo.less'
;
const
{
TextArea
}
=
Input
;
const
defaultCover
=
'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png'
;
let
cutFlag
=
false
;
class
BasicInfo
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -84,7 +82,7 @@ class BasicInfo extends React.Component {
handleSelectCover
=
(
file
)
=>
{
this
.
setState
({
visible
:
true
,
imageFile
:
file
imageFile
:
file
,
});
};
//获取resourceId
...
...
@@ -139,7 +137,7 @@ class BasicInfo extends React.Component {
};
render
()
{
const
{
operatorModalVisible
,
showSelectFileModal
,
visible
,
hasImgReady
,
cutImageBlob
,
imageFile
}
=
this
.
state
;
const
{
operatorModalVisible
,
showSelectFileModal
,
visible
,
imageFile
}
=
this
.
state
;
const
{
data
}
=
this
.
props
;
const
{
planName
,
coverUrl
,
introduce
,
enableState
,
operateType
,
selectOperatorList
,
percentCompleteLive
,
percentCompleteVideo
,
percentCompletePicture
}
=
data
;
...
...
@@ -335,9 +333,16 @@ class BasicInfo extends React.Component {
onSelect=
{
this
.
handleSelectCover
}
/>
)
}
{
visible
&&
<
ImgClipModal
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});}
}
/>
}
{
visible
&&
(
<
ImgClipModal
visible=
{
visible
}
imgUrl=
{
imageFile
.
ossUrl
}
onConfirm=
{
this
.
getSignature
}
onClose=
{
()
=>
{
this
.
setState
({
visible
:
false
});
}
}
/>
)
}
</
div
>
);
}
...
...
src/modules/plan-manage/components/PlanList.jsx
View file @
d9ac3788
...
...
@@ -64,6 +64,7 @@ function PlanList(props) {
render
:
(
val
,
item
,
index
)
=>
{
return
(
<
Switch
size=
'small'
checked=
{
item
.
enableState
===
'NO'
?
false
:
true
}
onChange=
{
()
=>
changeEnableState
(
item
)
}
disabled=
{
User
.
getUserRole
()
===
'CloudManager'
||
User
.
getUserRole
()
===
'StoreManager'
?
false
:
true
}
...
...
src/modules/teach-tool/examination-manager/AddExam.tsx
View file @
d9ac3788
This diff is collapsed.
Click to expand it.
src/routes/index.tsx
View file @
d9ac3788
...
...
@@ -3,108 +3,86 @@
* @Date: 2020-04-28 18:05:30
* @LastEditors: wufan
* @LastEditTime: 2020-12-26 14:37:23
* @Description:
* @Description:
*/
import
mainRoutes
from
'./config/mainRoutes'
;
import
redirectRoutes
from
'./config/redirectRoutes'
;
import
React
from
'react'
import
{
Redirect
,
HashRouter
as
Router
,
Route
,
Switch
}
from
'react-router-dom'
;
import
React
from
'react'
;
import
{
HashRouter
as
Router
,
Route
,
Switch
}
from
'react-router-dom'
;
import
{
createHashHistory
}
from
'history'
;
import
App
from
'../modules/root/App'
;
import
AppContext
from
'@/modules/root/AppContent'
;
import
Login
from
'../modules/root/Login'
;
import
CollegeManagePage
from
'../modules/root/CollegeManagePage'
;
import
CreateCollege
from
'../modules/root/CreateCollege'
;
import
_
from
'underscore'
;
import
{
asyncComponent
}
from
'react-async-component'
import
SwitchRoute
from
'@/modules/root/SwitchRoute'
;
import
ErrorCollege
from
'@/modules/root/ErrorCollege'
;
const
history
=
createHashHistory
();
window
.
RCHistory
=
_
.
extend
({},
history
,
{
push
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
)
},
pushState
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
)
},
pushStateWithStatus
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
)
},
goBack
:
history
.
goBack
,
location
:
history
.
location
,
replace
:
(
obj
:
any
)
=>
{
history
.
replace
(
obj
)
}
push
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
);
},
pushState
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
);
},
pushStateWithStatus
:
(
obj
:
any
)
=>
{
history
.
push
(
obj
);
},
goBack
:
history
.
goBack
,
location
:
history
.
location
,
replace
:
(
obj
:
any
)
=>
{
history
.
replace
(
obj
);
},
});
const
cache
:
any
=
{
path
:
''
,
component
:
null
}
function
dynamic
(
component
:
any
)
{
const
resolveComponent
=
component
return
asyncComponent
({
resolve
:
()
=>
{
const
ts
=
resolveComponent
()
return
ts
},
})
}
export
const
RootRouter
=
()
=>
{
return
(
<
Router
{
...
history
}
>
<
Switch
>
<
Route
key=
"1"
exact
path=
"/login"
render=
{
()
=>
<
Login
/>
}
/>
<
Route
key=
"2"
exact
path=
"/switch-route"
render=
{
()
=>
<
SwitchRoute
/>
}
/>
<
Route
key=
"3"
exact
path=
"/college-manage"
render=
{
()
=>
<
CollegeManagePage
/>
}
/>
<
Route
key=
"4"
exact
path=
"/college-manage/create"
render=
{
()
=>
<
CreateCollege
/>
}
/>
<
Route
key=
"6"
exact
path=
"/error-college"
render=
{
()
=>
<
ErrorCollege
/>
}
/>
<
Route
key=
"5"
path=
"/"
render=
{
()
=>
<
AppContext
/>
}
/>
</
Switch
>
</
Router
>
)
}
return
(
<
Router
{
...
history
}
>
<
Switch
>
<
Route
key=
'1'
exact
path=
'/login'
render=
{
()
=>
<
Login
/>
}
/>
<
Route
key=
'2'
exact
path=
'/switch-route'
render=
{
()
=>
<
SwitchRoute
/>
}
/>
<
Route
key=
'3'
exact
path=
'/college-manage'
render=
{
()
=>
<
CollegeManagePage
/>
}
/>
<
Route
key=
'4'
exact
path=
'/college-manage/create'
render=
{
()
=>
<
CreateCollege
/>
}
/>
<
Route
key=
'6'
exact
path=
'/error-college'
render=
{
()
=>
<
ErrorCollege
/>
}
/>
<
Route
key=
'5'
path=
'/'
render=
{
()
=>
<
AppContext
/>
}
/>
</
Switch
>
</
Router
>
);
}
;
export
const
MainRoutes
=
()
=>
{
return
(
<
Switch
>
{
_
.
map
(
mainRoutes
,
({
path
,
component
,
},
key
)
=>
{
return
<
Route
key=
{
key
}
path=
{
path
}
render=
{
()
=>
{
const
Component
=
component
;
return
<
Component
/>
}
}
/>
})
}
</
Switch
>
)
}
return
(
<
Switch
>
{
_
.
map
(
mainRoutes
,
({
path
,
component
},
key
)
=>
{
return
(
<
Route
key=
{
key
}
path=
{
path
}
render=
{
()
=>
{
const
Component
=
component
;
return
<
Component
/>;
}
}
/>
);
})
}
</
Switch
>
);
};
export
const
RedirectRoutes
=
()
=>
{
return
(
<
Switch
>
{
_
.
map
(
redirectRoutes
,
({
path
,
component
,
},
key
)
=>
{
return
<
Route
key=
{
key
}
path=
{
path
}
render=
{
()
=>
{
const
Component
=
component
;
return
<
Component
/>
}
}
/>
})
}
</
Switch
>
)
}
return
(
<
Switch
>
{
_
.
map
(
redirectRoutes
,
({
path
,
component
},
key
)
=>
{
return
(
<
Route
key=
{
key
}
path=
{
path
}
render=
{
()
=>
{
const
Component
=
component
;
return
<
Component
/>;
}
}
/>
);
})
}
</
Switch
>
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment