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
de8085ee
Commit
de8085ee
authored
Dec 16, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:联调课程相关接口
parent
8ed646dd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
23 deletions
+48
-23
src/components/CropperModal.tsx
+1
-0
src/modules/course-manage/AddLive.jsx
+8
-6
src/modules/course-manage/components/AddLiveIntro.jsx
+30
-16
src/modules/course-manage/components/LiveCourseList.jsx
+9
-1
No files found.
src/components/CropperModal.tsx
View file @
de8085ee
...
@@ -62,6 +62,7 @@ const CropperModal = (props: CropperModalProps) => {
...
@@ -62,6 +62,7 @@ const CropperModal = (props: CropperModalProps) => {
});
});
}
}
function
_handleSave
():
any
{
function
_handleSave
():
any
{
const
$image
=
$
(
'#image'
);
const
$image
=
$
(
'#image'
);
(
$image
as
any
).
cropper
(
'getCroppedCanvas'
).
toBlob
((
blob
:
any
)
=>
{
(
$image
as
any
).
cropper
(
'getCroppedCanvas'
).
toBlob
((
blob
:
any
)
=>
{
...
...
src/modules/course-manage/AddLive.jsx
View file @
de8085ee
...
@@ -52,6 +52,7 @@ const defaultIntroInfo = {
...
@@ -52,6 +52,7 @@ const defaultIntroInfo = {
liveCourseWarmMedia
:
{},
liveCourseWarmMedia
:
{},
// 讲师简介
// 讲师简介
liveCourseMediaRequests
:
[{
liveCourseMediaRequests
:
[{
contentType
:
"INTRO"
,
mediaType
:
'TEXT'
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
mediaContent
:
''
,
}],
}],
...
@@ -95,6 +96,7 @@ class AddLive extends React.Component {
...
@@ -95,6 +96,7 @@ class AddLive extends React.Component {
whetherVisitorsJoin
:
'NO'
,
whetherVisitorsJoin
:
'NO'
,
liveCourseWarmMedia
:
{},
liveCourseWarmMedia
:
{},
liveCourseMediaRequests
:
[{
liveCourseMediaRequests
:
[{
contentType
:
"INTRO"
,
mediaType
:
'TEXT'
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
mediaContent
:
''
,
}]
}]
...
@@ -125,6 +127,7 @@ class AddLive extends React.Component {
...
@@ -125,6 +127,7 @@ class AddLive extends React.Component {
courseMediaVOS
,
courseMediaVOS
,
nickname
,
nickname
,
needRecord
,
needRecord
,
whetherVisitorsJoin
,
warmMedia
,
warmMedia
,
}
=
res
.
result
;
}
=
res
.
result
;
...
@@ -153,11 +156,12 @@ class AddLive extends React.Component {
...
@@ -153,11 +156,12 @@ class AddLive extends React.Component {
}
}
const
liveCourseMediaRequests
=
courseMediaVOS
.
length
const
liveCourseMediaRequests
=
courseMediaVOS
.
length
?
[...
courseMediaVOS
]
?
[...
courseMediaVOS
]
:
[{
mediaType
:
'TEXT'
,
mediaContent
:
''
,
key
:
window
.
random_string
(
16
)
},
...
courseMediaVOS
];
:
[{
contentType
:
"INTRO"
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
key
:
window
.
random_string
(
16
)
},
...
courseMediaVOS
];
const
addLiveIntroInfo
=
{
const
addLiveIntroInfo
=
{
liveCourseWarmMedia
:
warmMedia
,
liveCourseWarmMedia
:
warmMedia
,
needRecord
,
needRecord
,
whetherVisitorsJoin
,
liveCourseMediaRequests
,
liveCourseMediaRequests
,
}
}
// 晚于开课前30分钟
// 晚于开课前30分钟
...
@@ -177,7 +181,6 @@ class AddLive extends React.Component {
...
@@ -177,7 +181,6 @@ class AddLive extends React.Component {
// 修改基本信息
// 修改基本信息
handleChangeBasicInfo
=
(
field
,
value
,
_coverUrl
)
=>
{
handleChangeBasicInfo
=
(
field
,
value
,
_coverUrl
)
=>
{
const
{
coverUrl
}
=
this
.
state
.
addLiveBasicInfo
;
const
{
coverUrl
}
=
this
.
state
.
addLiveBasicInfo
;
console
.
log
(
field
,
value
);
this
.
setState
({
this
.
setState
({
addLiveBasicInfo
:
{
addLiveBasicInfo
:
{
...
this
.
state
.
addLiveBasicInfo
,
...
this
.
state
.
addLiveBasicInfo
,
...
@@ -255,7 +258,7 @@ class AddLive extends React.Component {
...
@@ -255,7 +258,7 @@ class AddLive extends React.Component {
}
=
addLiveClassInfo
;
}
=
addLiveClassInfo
;
let
{
startTime
,
endTime
}
=
addLiveClassInfo
;
let
{
startTime
,
endTime
}
=
addLiveClassInfo
;
const
{
liveCourseMediaRequests
,
needRecord
,
liveCourseWarmMedia
}
=
addLiveIntroInfo
;
const
{
liveCourseMediaRequests
,
needRecord
,
whetherVisitorsJoin
,
liveCourseWarmMedia
}
=
addLiveIntroInfo
;
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
startTime
=
startTime
;
startTime
=
startTime
;
endTime
=
endTime
;
endTime
=
endTime
;
...
@@ -276,6 +279,8 @@ class AddLive extends React.Component {
...
@@ -276,6 +279,8 @@ class AddLive extends React.Component {
courseName
:
courseName
.
trim
(),
courseName
:
courseName
.
trim
(),
storeId
:
User
.
getStoreId
(),
storeId
:
User
.
getStoreId
(),
teacherId
:
teacherId
,
teacherId
:
teacherId
,
whetherVisitorsJoin
,
scheduleMediaRequests
:[...
liveCourseMediaRequests
]
}
}
if
(
type
===
'add'
)
{
if
(
type
===
'add'
)
{
const
params
=
{
const
params
=
{
...
@@ -312,8 +317,6 @@ class AddLive extends React.Component {
...
@@ -312,8 +317,6 @@ class AddLive extends React.Component {
handleValidate
=
(
addLiveBasicInfo
,
addLiveClassInfo
,
addLiveIntroInfo
,
isEdit
)
=>
{
handleValidate
=
(
addLiveBasicInfo
,
addLiveClassInfo
,
addLiveIntroInfo
,
isEdit
)
=>
{
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
{
type
}
=
this
.
state
;
const
{
type
}
=
this
.
state
;
// 校验基本信息(直播课名称)
console
.
log
(
"addLiveBasicInfo"
,
addLiveBasicInfo
);
const
{
courseName
,
parentCatalogId
}
=
addLiveBasicInfo
;
const
{
courseName
,
parentCatalogId
}
=
addLiveBasicInfo
;
const
{
const
{
liveDate
,
timeHorizonStart
,
timeHorizonEnd
,
teacherId
,
calendarTime
liveDate
,
timeHorizonStart
,
timeHorizonEnd
,
teacherId
,
calendarTime
...
@@ -447,7 +450,6 @@ class AddLive extends React.Component {
...
@@ -447,7 +450,6 @@ class AddLive extends React.Component {
// 取消编辑并返回上一级路由
// 取消编辑并返回上一级路由
handleGoBack
=
()
=>
{
handleGoBack
=
()
=>
{
console
.
log
(
'111'
);
// 比较state的addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo和默认数据是否相等
// 比较state的addLiveBasicInfo, addLiveClassInfo, addLiveIntroInfo和默认数据是否相等
const
{
addLiveBasicInfo
,
addLiveClassInfo
,
addLiveIntroInfo
}
=
this
.
state
;
const
{
addLiveBasicInfo
,
addLiveClassInfo
,
addLiveIntroInfo
}
=
this
.
state
;
if
(
!
_
.
isEqual
(
addLiveBasicInfo
,
defaultBasicInfo
)
||
if
(
!
_
.
isEqual
(
addLiveBasicInfo
,
defaultBasicInfo
)
||
...
...
src/modules/course-manage/components/AddLiveIntro.jsx
View file @
de8085ee
...
@@ -8,11 +8,10 @@
...
@@ -8,11 +8,10 @@
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Input
,
message
,
Upload
,
Radio
,
Row
,
Col
,
Button
,
Popover
,
Switch
}
from
'antd'
;
import
{
Input
,
message
,
Upload
,
Radio
,
Row
,
Col
,
Button
,
Popover
,
Switch
}
from
'antd'
;
import
Service
from
'@/common/js/service'
;
import
UploadOss
from
"@/core/upload"
;
import
EditorBox
from
'../components/EditorBox'
;
import
EditorBox
from
'../components/EditorBox'
;
import
User
from
'@/common/js/user'
;
import
UploadOss
from
'@/core/upload'
;
import
'./AddLiveIntro.less'
;
import
'./AddLiveIntro.less'
;
// import SelectPrepareFileModal from '../modal/SelectPrepareFileModal';
// import SelectPrepareFileModal from '../modal/SelectPrepareFileModal';
import
{
DISK_MAP
}
from
'@/common/constants/academic/lessonEnum'
;
import
{
DISK_MAP
}
from
'@/common/constants/academic/lessonEnum'
;
...
@@ -135,6 +134,7 @@ class AddLiveIntro extends React.Component {
...
@@ -135,6 +134,7 @@ class AddLiveIntro extends React.Component {
handleAddIntroText
=
()
=>
{
handleAddIntroText
=
()
=>
{
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
liveCourseMediaRequests
.
push
({
liveCourseMediaRequests
.
push
({
contentType
:
"INTRO"
,
mediaType
:
'TEXT'
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
mediaContent
:
''
,
key
:
window
.
random_string
(
16
)
key
:
window
.
random_string
(
16
)
...
@@ -158,16 +158,25 @@ class AddLiveIntro extends React.Component {
...
@@ -158,16 +158,25 @@ class AddLiveIntro extends React.Component {
const
{
instId
}
=
window
.
currentUserInstInfo
;
const
{
instId
}
=
window
.
currentUserInstInfo
;
const
{
name
,
size
}
=
Blob
;
const
{
name
,
size
}
=
Blob
;
const
resourceName
=
window
.
random_string
(
16
)
+
name
.
slice
(
name
.
lastIndexOf
(
'.'
));
const
resourceName
=
window
.
random_string
(
16
)
+
name
.
slice
(
name
.
lastIndexOf
(
'.'
));
// UploadOss.uploadBlobToOSS(Blob, 'avatar' + (new Date()).valueOf(),'', 'id').then((imgAddress) => {
// liveCourseMediaRequests.push({
// contentType:"INTRO",
// size,
// mediaName: name,
// mediaContent: imgAddress.resourceId,
// mediaType: 'PICTURE',
// });
// this.props.onChange('liveCourseMediaRequests', liveCourseMediaRequests);
// });
const
params
=
{
const
params
=
{
resourceName
,
resourceName
,
accessTypeEnum
:
'PUBLIC'
,
accessTypeEnum
:
'PUBLIC'
,
bizCode
:
'LIVE_COURSE_MEDIA'
,
bizCode
:
'LIVE_COURSE_MEDIA'
,
instId
:
instId
||
LS
.
get
(
'instId'
),
instId
:
User
.
getStoreId
(
),
}
}
window
.
axios
.
Apollo
(
"public/apollo
/commonOssAuthority"
,
params
).
then
((
res
)
=>
{
Service
.
Hades
(
"public/hades
/commonOssAuthority"
,
params
).
then
((
res
)
=>
{
const
{
resourceId
}
=
res
.
result
;
const
{
resourceId
}
=
res
.
result
;
const
signInfo
=
res
.
result
;
const
signInfo
=
res
.
result
;
// 构建上传的表单
// 构建上传的表单
const
xhr
=
new
XMLHttpRequest
();
const
xhr
=
new
XMLHttpRequest
();
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
...
@@ -179,7 +188,6 @@ class AddLiveIntro extends React.Component {
...
@@ -179,7 +188,6 @@ class AddLiveIntro extends React.Component {
formData
.
append
(
"file"
,
Blob
);
formData
.
append
(
"file"
,
Blob
);
formData
.
append
(
"success_action_status"
,
200
);
formData
.
append
(
"success_action_status"
,
200
);
xhr
.
open
(
"POST"
,
signInfo
.
host
);
xhr
.
open
(
"POST"
,
signInfo
.
host
);
xhr
.
onload
=
()
=>
{
xhr
.
onload
=
()
=>
{
liveCourseMediaRequests
.
push
({
liveCourseMediaRequests
.
push
({
size
,
size
,
...
@@ -188,7 +196,6 @@ class AddLiveIntro extends React.Component {
...
@@ -188,7 +196,6 @@ class AddLiveIntro extends React.Component {
mediaType
:
'PICTURE'
,
mediaType
:
'PICTURE'
,
mediaUrl
:
window
.
URL
.
createObjectURL
(
Blob
),
mediaUrl
:
window
.
URL
.
createObjectURL
(
Blob
),
});
});
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
};
};
xhr
.
onerror
=
()
=>
{
xhr
.
onerror
=
()
=>
{
...
@@ -198,16 +205,24 @@ class AddLiveIntro extends React.Component {
...
@@ -198,16 +205,24 @@ class AddLiveIntro extends React.Component {
this
.
setState
({
xhr
})
this
.
setState
({
xhr
})
});
});
}
}
whetherVisitorsJoinChange
=
()
=>
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
"NO"
){
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'YES'
)
}
else
{
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'NO'
)
}
}
componentWillMount
()
{
componentWillMount
()
{
this
.
handleFetchDiskList
();
this
.
handleFetchDiskList
();
}
}
componentWillUnmount
()
{
//
componentWillUnmount() {
const
{
xhr
}
=
this
.
state
;
//
const { xhr } = this.state;
xhr
&&
xhr
.
abort
();
//
xhr && xhr.abort();
}
//
}
render
()
{
render
()
{
const
{
liveType
,
isXiaomai
,
isEdit
,
data
:
{
introduction
,
needRecord
,
whetherVisitorsJoin
,
liveCourseMediaRequests
=
[],
liveCourseWarmMedia
=
{},
isAutoSendReport
}
}
=
this
.
props
;
const
{
liveType
,
isXiaomai
,
isEdit
,
data
:
{
introduction
,
needRecord
,
whetherVisitorsJoin
,
liveCourseMediaRequests
=
[],
liveCourseWarmMedia
=
{}
}
}
=
this
.
props
;
console
.
log
(
"whetherVisitorsJoin"
,
whetherVisitorsJoin
);
const
{
showCutModal
,
warmUrl
,
showSelectFileModal
,
diskList
,
imageFile
}
=
this
.
state
const
{
showCutModal
,
warmUrl
,
showSelectFileModal
,
diskList
,
imageFile
}
=
this
.
state
return
(
return
(
<
div
className=
"add-live__intro-info"
>
<
div
className=
"add-live__intro-info"
>
...
@@ -244,7 +259,7 @@ class AddLiveIntro extends React.Component {
...
@@ -244,7 +259,7 @@ class AddLiveIntro extends React.Component {
<
div
className=
"content"
>
<
div
className=
"content"
>
<
Row
>
<
Row
>
<
Col
span=
{
3
}
>
<
Col
span=
{
3
}
>
<
Switch
defaultChecked=
{
whetherVisitorsJoin
===
"YES"
?
true
:
fals
e
}
/>
<
Switch
checked=
{
whetherVisitorsJoin
===
"YES"
?
true
:
false
}
onChange=
{
this
.
whetherVisitorsJoinChang
e
}
/>
</
Col
>
</
Col
>
<
Col
span=
{
21
}
>
<
Col
span=
{
21
}
>
<
div
>
开启:用户可直接进入直播间观看直播
</
div
>
<
div
>
开启:用户可直接进入直播间观看直播
</
div
>
...
@@ -286,7 +301,6 @@ class AddLiveIntro extends React.Component {
...
@@ -286,7 +301,6 @@ class AddLiveIntro extends React.Component {
}
>
}
>
<
div
className=
"checkExample"
>
查看示例
</
div
>
<
div
className=
"checkExample"
>
查看示例
</
div
>
</
Popover
>
</
Popover
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/modules/course-manage/components/LiveCourseList.jsx
View file @
de8085ee
...
@@ -177,7 +177,15 @@ class LiveCourseList extends React.Component {
...
@@ -177,7 +177,15 @@ class LiveCourseList extends React.Component {
<
div
>
<
div
>
<
span
>
讲师:
{
record
.
teacherName
}
</
span
>
<
span
>
讲师:
{
record
.
teacherName
}
</
span
>
<
span
>
|
</
span
>
<
span
>
|
</
span
>
<
span
>
助教:周晓
</
span
>
<
span
>
助教:
{
record
.
admins
.
map
((
item
,
index
)
=>
{
return
<
span
>
{
item
.
adminName
}
</
span
>
})
}
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
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