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
13a2beac
Commit
13a2beac
authored
Mar 23, 2021
by
chenshu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:优化样式
parent
e0c2dd51
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
145 deletions
+149
-145
src/modules/course-manage/AddLive.jsx
+0
-0
src/modules/course-manage/components/AddLiveIntro.jsx
+18
-71
src/modules/course-manage/graphics-course/AddGraphicsCourse.jsx
+10
-1
src/modules/course-manage/video-course/AddVideoCourse.jsx
+100
-26
src/modules/course-manage/video-course/components/AddVideoIntro.jsx
+21
-47
No files found.
src/modules/course-manage/AddLive.jsx
View file @
13a2beac
This diff is collapsed.
Click to expand it.
src/modules/course-manage/components/AddLiveIntro.jsx
View file @
13a2beac
...
...
@@ -2,14 +2,14 @@
* @Author: 吴文洁
* @Date: 2020-07-16 11:05:17
* @Last Modified by: chenshu
* @Last Modified time: 2021-03-23 1
6:34:11
* @Last Modified time: 2021-03-23 1
7:39:50
* @Description: 添加直播-简介
*/
import
React
from
'react'
;
import
{
Input
,
message
,
Upload
,
Radio
,
Row
,
Col
,
Button
,
Popover
,
Switch
}
from
'antd'
;
import
Service
from
'@/common/js/service'
;
import
EditorBox
from
'../components/EditorBox
'
;
import
GraphicsEditor
from
'./GraphicsEditor
'
;
import
User
from
'@/common/js/user'
;
import
UploadOss
from
'@/core/upload'
;
import
'./AddLiveIntro.less'
;
...
...
@@ -138,32 +138,10 @@ class AddLiveIntro extends React.Component {
)
}
handleChangeIntro
=
(
index
,
value
,
length
)
=>
{
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
console
.
log
(
'index'
,
index
);
liveCourseMediaRequests
[
index
].
mediaContent
=
value
;
liveCourseMediaRequests
[
index
].
mediaContentLength
=
length
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
}
handleAddIntroText
=
()
=>
{
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
liveCourseMediaRequests
.
push
({
contentType
:
"INTRO"
,
mediaType
:
'TEXT'
,
mediaContent
:
''
,
key
:
Math
.
random
()
});
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
changeIntro
=
(
value
)
=>
{
this
.
props
.
onChange
(
'introduce'
,
value
);
}
handleUpload
=
(
Blob
)
=>
{
this
.
setState
({
showSelectFileModal
:
true
,
selectType
:
'INTRO'
})
}
whetherVisitorsJoinChange
=
()
=>
{
if
(
this
.
props
.
data
.
whetherVisitorsJoin
===
"NO"
){
this
.
props
.
onChange
(
'whetherVisitorsJoin'
,
'YES'
)
...
...
@@ -176,9 +154,8 @@ class AddLiveIntro extends React.Component {
}
render
()
{
const
{
liveType
,
isXiaomai
,
isEdit
,
data
:
{
i
ntroduction
,
needRecord
,
whetherVisitorsJoin
,
liveCourseMediaRequests
=
[]
,
liveCourseWarmMedia
=
{}
}
}
=
this
.
props
;
const
{
liveType
,
isXiaomai
,
isEdit
,
data
:
{
i
d
,
introduce
,
needRecord
,
whetherVisitorsJoin
,
loadintroduce
,
liveCourseWarmMedia
=
{}
}
}
=
this
.
props
;
const
{
showCutModal
,
warmUrl
,
showSelectFileModal
,
diskList
,
imageFile
,
selectType
}
=
this
.
state
console
.
log
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
return
(
<
div
className=
"add-live__intro-info"
>
<
div
className=
"playback"
>
...
...
@@ -266,50 +243,20 @@ class AddLiveIntro extends React.Component {
<
div
className=
"introduce"
>
<
span
className=
"label"
>
直播课简介:
</
span
>
<
div
className=
"content"
>
<
div
className=
"intro-list"
>
{
liveCourseMediaRequests
.
map
((
item
,
index
)
=>
{
if
(
item
.
mediaType
===
'TEXT'
)
{
return
(
<
div
className=
"intro-list__item"
key=
{
item
.
key
}
>
<
EditorBox
detail=
{
{
content
:
item
.
mediaContent
}
}
onChange=
{
(
val
,
length
)
=>
{
this
.
handleChangeIntro
(
index
,
val
,
length
)
}
}
/>
{
this
.
renderLittleIcon
(
index
)
}
</
div
>
)
}
if
(
item
.
mediaType
===
'PICTURE'
)
{
return
(
<
div
className=
"intro-list__item picture"
key=
{
index
}
>
<
div
className=
"img__wrap"
>
<
img
src=
{
item
.
mediaUrl
}
/>
</
div
>
{
this
.
renderLittleIcon
(
index
)
}
</
div
>
)
}
})
}
</
div
>
<
div
className=
"operate"
>
<
div
className=
"operate__item"
onClick=
{
this
.
handleAddIntroText
}
>
<
span
className=
"icon iconfont"
>

</
span
>
<
span
className=
"text"
>
文字
</
span
>
</
div
>
<
div
className=
"operate__item"
onClick=
{
this
.
handleUpload
}
>
<
span
className=
"icon iconfont"
>

</
span
>
<
span
className=
"text"
>
图片
</
span
>
</
div
>
</
div
>
<
div
className=
"tips"
>
• 图片支持jpeg、jpg、png、gif格式
<
div
className=
"intro-list"
>
<
div
className=
"intro-list__item introduce-editor"
>
{
(
!
id
||
loadintroduce
)
&&
<
GraphicsEditor
id=
"intro"
isIntro=
{
true
}
detail=
{
{
content
:
introduce
}
}
onChange=
{
(
val
)
=>
{
this
.
changeIntro
(
val
)
}
}
/>
}
</
div
>
</
div
>
</
div
>
</
div
>
{
/* 选择暖场图文件弹窗 */
}
...
...
src/modules/course-manage/graphics-course/AddGraphicsCourse.jsx
View file @
13a2beac
...
...
@@ -82,11 +82,20 @@ class AddGraphicsCourse extends React.Component {
}
}
componentWillUnmount
()
{
this
.
removeBus
();
}
initBus
=
()
=>
{
Bus
.
bind
(
'graphicsEditorImage'
,
this
.
uploadImage
)
Bus
.
bind
(
'graphicsEditorVideo'
,
this
.
uploadVideo
)
}
removeBus
=
()
=>
{
Bus
.
unbind
(
'graphicsEditorImage'
,
this
.
uploadImage
)
Bus
.
unbind
(
'graphicsEditorVideo'
,
this
.
uploadVideo
)
}
uploadImage
=
()
=>
{
this
.
setState
({
showSelectImageModal
:
true
})
}
...
...
@@ -155,7 +164,6 @@ class AddGraphicsCourse extends React.Component {
}
return
item
;
})
!
hasIntro
&&
this
.
setState
({
loadintroduce
:
true
})
let
categoryName
;
if
(
categoryTwoName
){
...
...
@@ -164,6 +172,7 @@ class AddGraphicsCourse extends React.Component {
categoryName
=
`
${
categoryOneName
}
`
;
}
this
.
setState
({
loadintroduce
:
!
hasIntro
,
coverId
,
coverUrl
,
courseName
,
...
...
src/modules/course-manage/video-course/AddVideoCourse.jsx
View file @
13a2beac
...
...
@@ -21,9 +21,13 @@ import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFile
import
PreviewCourseModal
from
'../modal/PreviewCourseModal'
;
import
StoreService
from
"@/domains/store-domain/storeService"
;
import
CourseService
from
"@/domains/course-domain/CourseService"
;
import
Service
from
'@/common/js/service'
;
import
User
from
'@/common/js/user'
;
import
_
from
"underscore"
;
import
Upload
from
'@/core/upload'
;
import
{
randomString
}
from
'@/domains/basic-domain/utils'
;
import
$
from
'jquery'
;
import
Bus
from
'../../../core/bus'
// import PhotoClip from 'photoclip';
import
'./AddVideoCourse.less'
;
...
...
@@ -76,6 +80,7 @@ class AddVideoCourse extends React.Component {
whetherVisitorsJoin
:
'NO'
,
// 是否允许游客加入
showSelectCoverModal
:
false
,
cutImageBlob
:
null
,
introduce
:
''
,
}
}
...
...
@@ -85,7 +90,21 @@ class AddVideoCourse extends React.Component {
if
(
pageType
===
'edit'
)
{
this
.
handleFetchScheudleDetail
(
id
);
}
this
.
initBus
()
}
initBus
=
()
=>
{
Bus
.
bind
(
'graphicsEditorImage'
,
this
.
uploadIntroImage
)
}
removeBus
=
()
=>
{
Bus
.
unbind
(
'graphicsEditorImage'
,
this
.
uploadIntroImage
)
}
uploadIntroImage
=
()
=>
{
this
.
setState
({
showSelectImageModal
:
true
})
}
//获取分类列表
getCourseCatalogList
=
()
=>
{
StoreService
.
getCourseCatalogList
({
current
:
1
,
size
:
1000
}).
then
((
res
)
=>
{
...
...
@@ -132,6 +151,7 @@ class AddVideoCourse extends React.Component {
let
scheduleMedia
=
[];
let
scheduleVideoId
;
let
scheduleVideoUrl
;
let
hasIntro
;
courseMediaVOS
.
map
((
item
)
=>
{
switch
(
item
.
contentType
){
...
...
@@ -147,7 +167,8 @@ class AddVideoCourse extends React.Component {
videoType
=
item
.
mediaType
;
break
;
case
"INTRO"
:
scheduleMedia
=
[...
scheduleMedia
,
item
]
hasIntro
=
true
;
this
.
getTextDetail
(
'introduce'
,
item
.
mediaUrl
);
break
;
default
:
break
;
...
...
@@ -162,6 +183,7 @@ class AddVideoCourse extends React.Component {
categoryName
=
`
${
categoryOneName
}
`
;
}
this
.
setState
({
loadintroduce
:
!
hasIntro
,
coverId
,
coverUrl
,
videoType
,
...
...
@@ -179,6 +201,18 @@ class AddVideoCourse extends React.Component {
})
}
getTextDetail
=
(
key
,
url
)
=>
{
$
.
ajax
({
data
:
{},
type
:
'GET'
,
url
,
contentType
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
success
:
(
res
)
=>
{
this
.
setState
({
[
key
]:
res
,
[
`load
${
key
}
`
]:
true
});
}
})
}
handleGoBack
=
()
=>
{
const
{
...
...
@@ -330,13 +364,14 @@ class AddVideoCourse extends React.Component {
scheduleVideoUrl
,
categoryId
,
shelfState
,
whetherVisitorsJoin
whetherVisitorsJoin
,
introduce
,
}
=
this
.
state
;
const
commonParams
=
{
videoName
,
videoDuration
,
scheduleVideoId
,
courseMediaId
:
scheduleVideoId
,
scheduleMedia
:
scheduleMedia
.
filter
(
item
=>
!!
item
.
mediaContent
),
categoryId
,
courseName
,
...
...
@@ -344,33 +379,40 @@ class AddVideoCourse extends React.Component {
operatorId
:
User
.
getStoreUserId
(),
storeId
:
User
.
getStoreId
(),
shelfState
,
whetherVisitorsJoin
whetherVisitorsJoin
,
courseType
:
'VOICE'
,
};
// 校验必填字段:课程名称, 课程视频
this
.
handleValidate
(
courseName
,
scheduleVideoId
,
categoryId
,
scheduleMedia
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
if
(
pageType
===
'add'
)
{
CourseService
.
createVideoSchedule
(
commonParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
message
.
success
(
"新建成功"
);
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
});
})
}
else
{
const
editParams
=
{
courseId
:
id
,
...
commonParams
,
}
CourseService
.
editVideoSchedule
(
editParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
message
.
success
(
"保存成功"
);
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
});
Upload
.
uploadTextToOSS
(
introduce
,
`
${
randomString
()}
.txt`
,
(
introduceId
)
=>
{
this
.
submitRemote
({
id
,
pageType
,
commonParams
:
{
...
commonParams
,
introduceId
}
})
});
});
}
submitRemote
=
({
id
,
pageType
,
commonParams
})
=>
{
if
(
pageType
===
'add'
)
{
Service
.
Hades
(
'public/hades/createMediaCourse'
,
commonParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
message
.
success
(
"新建成功"
);
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
});
})
}
else
{
const
editParams
=
{
courseId
:
id
,
...
commonParams
,
}
});
Service
.
Hades
(
'public/hades/editMediaCourse'
,
editParams
).
then
((
res
)
=>
{
if
(
!
res
)
return
;
message
.
success
(
"保存成功"
);
window
.
RCHistory
.
push
({
pathname
:
`/video-course`
,
});
});
}
}
handleValidate
=
(
courseName
,
scheduleVideoId
,
categoryId
,
scheduleMedia
)
=>
{
...
...
@@ -404,6 +446,17 @@ class AddVideoCourse extends React.Component {
handleSelectCover
=
(
file
)
=>
{
this
.
uploadImage
(
file
);
}
handleSelectImage
=
(
file
)
=>
{
this
.
setState
({
showSelectImageModal
:
false
})
const
{
ossUrl
}
=
file
;
const
{
introduce
}
=
this
.
state
;
this
.
setState
({
introduce
:
`
${
introduce
}
<p><img style="max-width: 100%;" src="
${
ossUrl
}
" /><br/><p>`
});
}
//上传图片
uploadImage
=
(
imageFile
)
=>
{
...
...
@@ -516,7 +569,11 @@ class AddVideoCourse extends React.Component {
showCutModal
,
showSelectFileModal
,
diskList
,
imageFile
,
joinType
,
videoName
,
videoType
,
shelfState
,
categoryName
,
courseCatalogList
,
whetherVisitorsJoin
,
visible
,
showSelectCoverModal
,
hasImgReady
,
cutImageBlob
visible
,
showSelectCoverModal
,
hasImgReady
,
cutImageBlob
,
introduce
,
loadintroduce
,
id
,
showSelectImageModal
,
}
=
this
.
state
;
// 已选择的上课学员数量
...
...
@@ -605,10 +662,12 @@ class AddVideoCourse extends React.Component {
<
div
className=
"intro-info mt16"
>
<
AddVideoIntro
data=
{
{
id
,
liveCourseMediaRequests
:
scheduleMedia
,
shelfState
,
whetherVisitorsJoin
,
label
:
'视频课简介'
introduce
,
loadintroduce
,
}
}
onChange=
{
this
.
handleChangeForm
}
/>
...
...
@@ -642,6 +701,21 @@ class AddVideoCourse extends React.Component {
onSelect=
{
this
.
handleSelectVideo
}
/>
}
{
showSelectImageModal
&&
<
SelectPrepareFileModal
key=
"basic"
operateType=
"select"
multiple=
{
false
}
accept=
"image/jpeg,image/png,image/jpg"
selectTypeList=
{
[
'JPG'
,
'JPEG'
,
'PNG'
]
}
tooltip=
'支持文件类型:jpg、jpeg、png'
isOpen=
{
showSelectImageModal
}
onClose=
{
()
=>
{
this
.
setState
({
showSelectImageModal
:
false
})
}
}
onSelect=
{
this
.
handleSelectImage
}
/>
}
{
showSelectCoverModal
&&
<
SelectPrepareFileModal
key=
"basic"
...
...
src/modules/course-manage/video-course/components/AddVideoIntro.jsx
View file @
13a2beac
/*
* @Author: 吴文洁
* @Date: 2020-07-16 11:05:17
* @Last Modified by:
mikey.zhaopeng
* @Last Modified time: 202
0-11-24 14:29:52
* @Last Modified by:
chenshu
* @Last Modified time: 202
1-03-23 18:12:05
* @Description: 添加直播-简介
*/
import
React
from
'react'
;
import
{
Input
,
message
,
Upload
,
Radio
,
Row
,
Col
,
Button
,
Popover
,
Switch
}
from
'antd'
;
import
Service
from
'@/common/js/service'
;
import
EditorBox
from
'../../components/EditorBox
'
;
import
GraphicsEditor
from
'../../components/GraphicsEditor
'
;
import
User
from
'@/common/js/user'
;
import
UploadOss
from
'@/core/upload'
;
import
'./AddVideoIntro.less'
;
...
...
@@ -144,6 +144,10 @@ class AddVideoIntro extends React.Component {
this
.
props
.
onChange
(
'liveCourseMediaRequests'
,
liveCourseMediaRequests
);
}
changeIntro
=
(
value
)
=>
{
this
.
props
.
onChange
(
'introduce'
,
value
);
}
handleAddIntroText
=
()
=>
{
const
{
liveCourseMediaRequests
}
=
this
.
props
.
data
;
liveCourseMediaRequests
.
push
({
...
...
@@ -180,7 +184,7 @@ class AddVideoIntro extends React.Component {
}
render
()
{
const
{
data
:
{
whetherVisitorsJoin
,
liveCourseMediaRequests
=
[],
shelfState
}
}
=
this
.
props
;
const
{
data
:
{
whetherVisitorsJoin
,
liveCourseMediaRequests
=
[],
shelfState
,
id
,
introduce
,
loadintroduce
}
}
=
this
.
props
;
const
{
showSelectFileModal
,
selectType
}
=
this
.
state
return
(
<
div
className=
"add-video__intro-info"
>
...
...
@@ -217,50 +221,20 @@ class AddVideoIntro extends React.Component {
<
div
className=
"introduce"
>
<
span
className=
"label"
>
视频课简介:
</
span
>
<
div
className=
"content"
>
<
div
className=
"intro-list"
>
{
liveCourseMediaRequests
.
map
((
item
,
index
)
=>
{
if
(
item
.
mediaType
===
'TEXT'
)
{
return
(
<
div
className=
"intro-list__item"
key=
{
item
.
key
}
>
<
EditorBox
detail=
{
{
content
:
item
.
mediaContent
}
}
onChange=
{
(
val
,
length
)
=>
{
this
.
handleChangeIntro
(
index
,
val
,
length
)
}
}
/>
{
this
.
renderLittleIcon
(
index
)
}
</
div
>
)
}
if
(
item
.
mediaType
===
'PICTURE'
)
{
return
(
<
div
className=
"intro-list__item picture"
key=
{
index
}
>
<
div
className=
"img__wrap"
>
<
img
src=
{
item
.
mediaUrl
}
/>
</
div
>
{
this
.
renderLittleIcon
(
index
)
}
</
div
>
)
}
})
}
</
div
>
<
div
className=
"operate"
>
<
div
className=
"operate__item"
onClick=
{
this
.
handleAddIntroText
}
>
<
span
className=
"icon iconfont"
>

</
span
>
<
span
className=
"text"
>
文字
</
span
>
</
div
>
<
div
className=
"operate__item"
onClick=
{
this
.
handleUpload
}
>
<
span
className=
"icon iconfont"
>

</
span
>
<
span
className=
"text"
>
图片
</
span
>
</
div
>
</
div
>
<
div
className=
"tips"
>
• 图片支持jpeg、jpg、png、gif格式
<
div
className=
"intro-list"
>
<
div
className=
"intro-list__item introduce-editor"
>
{
(
!
id
||
loadintroduce
)
&&
<
GraphicsEditor
id=
"intro"
isIntro=
{
true
}
detail=
{
{
content
:
introduce
}
}
onChange=
{
(
val
)
=>
{
this
.
changeIntro
(
val
)
}
}
/>
}
</
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