Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
biz.qingxiao.com
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxuelai
biz.qingxiao.com
Commits
a143786c
Commit
a143786c
authored
Nov 27, 2019
by
baixian
Browse files
Options
Browse Files
Download
Plain Diff
bug修改
parents
b607a202
1c27a803
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
392 additions
and
55 deletions
+392
-55
Project_Default.xml
.idea/inspectionProfiles/Project_Default.xml
+11
-0
index.html
index.html
+1
-1
UploadCourseware.js
src/components/UploadCourseware.js
+38
-8
UploadCourseware.less
src/components/UploadCourseware.less
+40
-0
coursegatherdetail.js
src/models/coursegatherdetail.js
+168
-33
coursemateria.js
src/models/coursemateria.js
+16
-0
onlineclasses.js
src/models/onlineclasses.js
+91
-9
uploadcourseware.js
src/models/uploadcourseware.js
+5
-1
CourseBox.js
src/pages/coursegather/detail/CourseBox.js
+3
-3
index.js
src/utils/index.js
+19
-0
No files found.
.idea/inspectionProfiles/Project_Default.xml
View file @
a143786c
<component
name=
"InspectionProjectProfileManager"
>
<profile
version=
"1.0"
>
<option
name=
"myName"
value=
"Project Default"
/>
<inspection_tool
class=
"CssUnknownProperty"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<option
name=
"myCustomPropertiesEnabled"
value=
"true"
/>
<option
name=
"myIgnoreVendorSpecificProperties"
value=
"false"
/>
<option
name=
"myCustomPropertiesList"
>
<value>
<list
size=
"1"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"textoverflow"
/>
</list>
</value>
</option>
</inspection_tool>
<inspection_tool
class=
"Eslint"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
/>
</profile>
</component>
\ No newline at end of file
index.html
View file @
a143786c
...
...
@@ -17,6 +17,6 @@
</head>
<body>
<div
id=
"root"
></div>
<script
src=
"dist/main.js?15748
27384999
"
charset=
"utf-8"
></script>
<script
src=
"dist/main.js?15748
37184040
"
charset=
"utf-8"
></script>
</body>
</html>
\ No newline at end of file
src/components/UploadCourseware.js
View file @
a143786c
import
{
connect
}
from
'dva'
;
import
React
from
'react'
;
import
{
Button
,
Row
,
Carousel
,
Icon
,
Col
,
Input
,
Select
,
Pagination
,
Radio
,
DatePicker
,
Modal
,
Form
,
TimePicker
,
InputNumber
,
Table
}
from
'antd'
;
import
{
Button
,
Row
,
Carousel
,
Icon
,
Col
,
Input
,
Select
,
Pagination
,
Radio
,
DatePicker
,
Modal
,
Form
,
TimePicker
,
InputNumber
,
Table
,
Spin
}
from
'antd'
;
import
pageStyle
from
'./UploadCourseware.less'
;
import
{
pageIn
,
...
...
@@ -69,11 +69,26 @@ class UploadCourseware extends React.Component {
});
delCourseware
();
}
reLoadVideoPoster
=
(
src
)
=>
{
console
.
log
(
src
,
'src'
);
const
that
=
this
;
const
img
=
new
Image
();
img
.
src
=
videoPoster
(
src
);
img
.
onload
=
function
()
{
document
.
getElementById
(
'videoposter'
).
setAttribute
(
'src'
,
videoPoster
(
src
));
};
img
.
onerror
=
function
()
{
document
.
getElementById
(
'videoposter'
).
setAttribute
(
'src'
,
`
${
__IMGCDN__
}
course/video_default.png`
);
that
.
reLoadVideoPoster
(
src
);
};
}
render
()
{
const
{
visible
,
info
,
chooseFromCourseMateria
,
saveStatus
,
loading
,
}
=
this
.
props
;
return
(
<
Modal
...
...
@@ -83,7 +98,7 @@ class UploadCourseware extends React.Component {
onCancel
=
{
this
.
hide
}
onOk
=
{
this
.
save
}
className
=
"UploadCoursewareContent"
// confirmLoading={callStudentSubmitt
ing}
confirmLoading
=
{
load
ing
}
zIndex
=
{
110
}
maskClosable
=
{
false
}
width
=
{
600
}
...
...
@@ -113,6 +128,12 @@ class UploadCourseware extends React.Component {
<
/div
>
<
/div
>
<
div
className
=
{
pageStyle
.
uploadBox
}
style
=
{{
display
:
info
.
src
?
'block'
:
'none'
}}
>
{
saveStatus
.
status
!=
0
&&
<
div
className
=
{
`
${
pageStyle
.
uploadLoading
}
uploadLoading`
}
>
<
Spin
size
=
"large"
wrapperClassName
=
{
pageStyle
.
uploadLoadingSpin
}
/
>
<
div
className
=
{
pageStyle
.
uploadLoadingText
}
>
{
saveStatus
.
text
}
<
/div
>
<
/div
>
}
{
info
.
mediaType
==
1
&&
<
Carousel
className
=
{
pageStyle
.
Carousel
}
...
...
@@ -131,7 +152,7 @@ class UploadCourseware extends React.Component {
}
{
info
.
mediaType
==
2
&&
<
div
className
=
{
pageStyle
.
videobox
}
>
<
img
className
=
{
pageStyle
.
videoImg
}
alt
=
""
src
=
{
v
ideoPoster
(
info
.
src
)}
/
>
<
img
className
=
{
pageStyle
.
videoImg
}
alt
=
""
id
=
"videoposter"
src
=
{
videoPoster
(
info
.
src
)}
onError
=
{()
=>
this
.
reLoadV
ideoPoster
(
info
.
src
)}
/
>
<
div
className
=
{
pageStyle
.
videoplay
}
>
<
img
className
=
{
pageStyle
.
videoplayicon
}
src
=
{
`
${
__IMGCDN__
}
smallplayicon.png`
}
alt
=
""
/>
<
/div
>
...
...
@@ -169,20 +190,27 @@ class UploadCourseware extends React.Component {
<
div
className
=
{
pageStyle
.
uploaddesc
}
>
MOV
/
MP4
格式,大小≦
**
MB
<
/div
>
<
/div
>
<
div
className
=
{
pageStyle
.
right
}
>
<
div
className
=
{
pageStyle
.
btn
}
onClick
=
{
chooseFromCourseMateria
}
>
<
div
className
=
{
pageStyle
.
btn
}
onClick
=
{
chooseFromCourseMateria
}
style
=
{{
marginRight
:
'10px'
}}
>
<
img
src
=
{
`
${
__IMGCDN__
}
course/check.png`
}
alt
=
""
className
=
{
`
${
pageStyle
.
btnicon
}
${
pageStyle
.
leftbtnicon
}
`
}
/
>
<
span
>
素材库
<
/span
>
<
/div
>
<
div
className
=
{
pageStyle
.
btn
}
>
<
img
src
=
{
`
${
__IMGCDN__
}
course/uploadImg.png`
}
alt
=
""
className
=
{
`
${
pageStyle
.
btnicon
}
${
pageStyle
.
rightbtnicon
}
`
}
/
>
<
span
>
上传
<
/span
>
<
input
type
=
"file"
className
=
{
pageStyle
.
uploadInput
}
accept
=
".ppt, .pptx, image/*, application/vnd.ms-powerpoint, video/mp4, application/pdf, audio/*"
onChange
=
{
this
.
uploadCourseMateria
}
id
=
"uploadcourseware"
/>
<
/div
>
{
info
.
src
&&
<
div
className
=
{
pageStyle
.
delbtn
}
onClick
=
{
this
.
delCourseware
}
>
<
Icon
type
=
"delete"
className
=
{
pageStyle
.
delIcon
}
/
>
<
span
className
=
{
pageStyle
.
delText
}
>
删除
<
/span
>
<
/div
>
}
{
/* <div className={pageStyle.btn}>
<img src={`${__IMGCDN__}course/uploadImg.png`} alt="" className={`${pageStyle.btnicon} ${pageStyle.rightbtnicon}`} />
<span>上传</span>
</div> */
}
<
/div
>
<
/div
>
<
/Modal
>
...
...
@@ -193,10 +221,12 @@ function mapStateToProps(state) {
const
{
visible
,
info
,
saveStatus
,
}
=
state
.
uploadcourseware
;
return
{
visible
,
info
,
saveStatus
,
};
}
export
default
connect
(
mapStateToProps
)(
UploadCourseware
);
...
...
src/components/UploadCourseware.less
View file @
a143786c
...
...
@@ -73,6 +73,16 @@
align-items: center;
justify-content: center;
cursor: pointer;
position: relative;
.uploadInput {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 2;
opacity: 0;
}
.btnicon {
display: block;
&.leftbtnicon {
...
...
@@ -137,6 +147,9 @@
width: 100%;
height: 254px;
position: relative;
display: flex;
align-items: center;
justify-content: center;
.videoImg {
max-width: 100%;
max-height: 100%;
...
...
@@ -196,4 +209,31 @@
text-overflow: ellipsis;
white-space: nowrap;
}
}
:global {
.uploadLoading {
.ant-spin-dot-item {
background-color: #fff;
}
}
}
.uploadLoading {
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 5;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
.uploadLoadingText {
text-align: center;
color: #fff;
font-size: 18px;
position: relative;
z-index: 6;
font-weight: 700;
margin-top: 10px;
}
}
\ No newline at end of file
src/models/coursegatherdetail.js
View file @
a143786c
This diff is collapsed.
Click to expand it.
src/models/coursemateria.js
View file @
a143786c
...
...
@@ -173,11 +173,27 @@ export default {
break
;
case
2
:
// 视频
duration
=
yield
call
(
getVideoDuration
,
file
);
if
(
duration
==
0
)
{
yield
call
(
uploadMateriaLoading
);
message
.
error
(
'视频格式不支持,请上传MP4格式的文件'
,
2
);
if
(
successCallBack
&&
(
typeof
successCallBack
==
'function'
))
{
successCallBack
();
}
return
;
}
ajax
=
uploader
.
uploadVideoSignature
;
params
=
{
type
:
1
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
case
3
:
// 录音
duration
=
yield
call
(
getAudioDuration
,
file
);
if
(
duration
==
0
)
{
yield
call
(
uploadMateriaLoading
);
message
.
error
(
'音频格式不支持,重新上传'
,
2
);
if
(
successCallBack
&&
(
typeof
successCallBack
==
'function'
))
{
successCallBack
();
}
return
;
}
ajax
=
uploader
.
uploadVideoSignature
;
params
=
{
type
:
2
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
...
...
src/models/onlineclasses.js
View file @
a143786c
...
...
@@ -961,6 +961,21 @@ export default {
},
});
}
else
{
yield
put
({
type
:
'uploadcourseware/updateState'
,
payload
:
{
saveStatus
:
{
status
:
0
,
// 1 转换中 2 保存中
text
:
''
,
},
},
});
yield
put
({
type
:
'updateState'
,
payload
:
{
coursewareSubmitting
:
false
,
},
});
yield
put
({
type
:
'webapp/errorrequestresolve'
,
payload
:
{
...
...
@@ -1009,17 +1024,41 @@ export default {
},
});
}
else
{
yield
put
({
type
:
'uploadcourseware/updateState'
,
payload
:
{
saveStatus
:
{
status
:
0
,
// 1 转换中 2 保存中
text
:
''
,
},
},
});
yield
put
({
type
:
'webapp/errorrequestresolve'
,
payload
:
{
data
:
transformData
,
},
});
yield
put
({
type
:
'updateState'
,
payload
:
{
coursewareSubmitting
:
false
,
},
});
}
},
*
uploadCourseware
({
payload
},
{
call
,
put
,
select
})
{
const
{
info
}
=
payload
;
const
{
addCourseObj
,
coursewareSubmitting
}
=
yield
select
(
state
=>
state
.
onlineclasses
);
if
(
coursewareSubmitting
)
{
return
;
}
yield
put
({
type
:
'updateState'
,
payload
:
{
coursewareSubmitting
:
true
,
},
});
const
{
from
}
=
info
;
if
(
from
==
'upload'
)
{
// 课件上传得到需要转码
if
(
info
.
type
==
4
)
{
// 其他文件需要转码
...
...
@@ -1029,6 +1068,15 @@ export default {
info
,
},
});
yield
put
({
type
:
'uploadcourseware/updateState'
,
payload
:
{
saveStatus
:
{
status
:
1
,
// 1 转换中 2 保存中
text
:
'文件解析中,请稍等...'
,
},
},
});
}
else
{
yield
put
({
type
:
'saveCourseWare'
,
...
...
@@ -1059,6 +1107,12 @@ export default {
},
});
}
else
{
// 打开弹窗没操作 直接关闭弹窗
yield
put
({
type
:
'updateState'
,
payload
:
{
coursewareSubmitting
:
false
,
},
});
yield
put
({
type
:
'uploadcourseware/updateState'
,
payload
:
{
...
...
@@ -1071,19 +1125,28 @@ export default {
*
saveCourseWare
({
payload
},
{
call
,
put
,
select
})
{
const
{
info
}
=
payload
;
const
{
addCourseObj
,
coursewareSubmitting
}
=
yield
select
(
state
=>
state
.
onlineclasses
);
if
(
coursewareSubmitting
)
{
return
;
// if (coursewareSubmitting) {
// return;
// }
// yield put({
// type: 'updateState',
// payload: {
// coursewareSubmitting: true,
// },
// });
if
(
info
.
from
)
{
delete
info
.
from
;
}
yield
put
({
type
:
'updateState'
,
type
:
'up
loadcourseware/up
dateState'
,
payload
:
{
coursewareSubmitting
:
true
,
saveStatus
:
{
status
:
2
,
// 1 转换中 2 保存中
text
:
'保存中...'
,
},
},
});
if
(
info
.
from
)
{
delete
info
.
from
;
}
const
loadmessage
=
message
.
loading
(
'保存中...'
,
0
);
// const loadmessage = message.loading('保存中...', 0);
const
data
=
yield
call
(
courseMateriaAjax
.
uploadCourseware
,
{
content
:
JSON
.
stringify
(
info
),
id
:
addCourseObj
.
id
,
...
...
@@ -1094,7 +1157,7 @@ export default {
coursewareSubmitting
:
false
,
},
});
setTimeout
(
loadmessage
);
console
.
log
(
1111111111111
);
if
(
data
.
code
==
200
)
{
yield
put
({
type
:
'uploadcourseware/updateState'
,
...
...
@@ -1103,6 +1166,15 @@ export default {
info
:
{},
},
});
yield
put
({
type
:
'uploadcourseware/updateState'
,
payload
:
{
saveStatus
:
{
status
:
0
,
// 1 转换中 2 保存中
text
:
''
,
},
},
});
yield
put
({
type
:
'updateState'
,
payload
:
{
...
...
@@ -1125,7 +1197,17 @@ export default {
params
:
{},
},
});
message
.
success
(
'课件保存成功...'
,
1
);
}
else
{
yield
put
({
type
:
'uploadcourseware/updateState'
,
payload
:
{
saveStatus
:
{
status
:
0
,
// 1 转换中 2 保存中
text
:
''
,
},
},
});
yield
put
({
type
:
'webapp/errorrequestresolve'
,
payload
:
{
...
...
src/models/uploadcourseware.js
View file @
a143786c
...
...
@@ -20,6 +20,10 @@ export default {
state
:
{
visible
:
false
,
info
:
{},
saveStatus
:
{
status
:
0
,
// 1 转换中 2 保存中
text
:
''
,
},
},
subscriptions
:
{
setup
({
dispatch
,
history
})
{
// eslint-disable-line
...
...
@@ -72,7 +76,7 @@ export default {
return
;
}
let
signature
=
{};
const
uploaderLoading
=
message
.
loading
(
'
课
件上传中...'
);
const
uploaderLoading
=
message
.
loading
(
'
文
件上传中...'
);
const
uploadSignature
=
yield
call
(
ajax
,
params
);
signature
=
uploadSignature
.
data
;
if
(
uploadSignature
.
code
==
200
)
{
...
...
src/pages/coursegather/detail/CourseBox.js
View file @
a143786c
...
...
@@ -124,13 +124,13 @@ class CourseBoxForm extends React.Component {
<
List
size
=
"large"
grid
=
{{
gutter
:
2
0
,
gutter
:
1
0
,
xs
:
1
,
sm
:
1
,
md
:
1
,
lg
:
2
,
xl
:
2
,
xxl
:
3
,
xl
:
3
,
xxl
:
4
,
}}
dataSource
=
{
list
}
footer
=
{
...
...
src/utils/index.js
View file @
a143786c
...
...
@@ -839,6 +839,15 @@ function getAudioDuration(file) {
duration
=
0
;
},
false
);
},
false
);
audioElement
.
addEventListener
(
'error'
,
(
event
)
=>
{
// eslint-disable-next-line prefer-destructuring
duration
=
audioElement
.
duration
;
resolve
(
0
);
// callback(duration);
audioElement
.
removeEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
duration
=
0
;
},
false
);
},
false
);
});
}
function
getVideoDuration
(
file
)
{
...
...
@@ -848,6 +857,7 @@ function getVideoDuration(file) {
videoElement
.
id
=
'videoElement'
;
videoElement
.
src
=
url
;
let
duration
;
// document.body.appendChild(videoElement);
videoElement
.
addEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
// eslint-disable-next-line prefer-destructuring
duration
=
videoElement
.
duration
;
...
...
@@ -857,6 +867,15 @@ function getVideoDuration(file) {
duration
=
0
;
},
false
);
},
false
);
videoElement
.
addEventListener
(
'error'
,
(
event
)
=>
{
// eslint-disable-next-line prefer-destructuring
// duration = videoElement.duration;
resolve
(
0
);
// callback(duration);
videoElement
.
removeEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
duration
=
0
;
},
false
);
},
false
);
});
}
function
voiceTimeFormat
(
time
)
{
...
...
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