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
0ea48be7
Commit
0ea48be7
authored
Nov 25, 2019
by
wangxuelai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
''
parent
76a213fe
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
69 additions
and
30 deletions
+69
-30
index.html
index.html
+1
-1
coursegatherindex.js
src/models/coursegatherindex.js
+6
-6
coursemateria.js
src/models/coursemateria.js
+9
-0
uploadcourseware.js
src/models/uploadcourseware.js
+15
-13
ManageCourse.js
src/pages/coursegather/detail/ManageCourse.js
+0
-7
index.js
src/pages/coursegather/detail/index.js
+1
-3
singleDetail.js
src/pages/onlineclasses/singleclass/singleDetail.js
+1
-0
index.js
src/utils/index.js
+36
-0
No files found.
index.html
View file @
0ea48be7
...
...
@@ -17,6 +17,6 @@
</head>
<body>
<div
id=
"root"
></div>
<script
src=
"dist/main.js?157467
3220194
"
charset=
"utf-8"
></script>
<script
src=
"dist/main.js?157467
7618779
"
charset=
"utf-8"
></script>
</body>
</html>
\ No newline at end of file
src/models/coursegatherindex.js
View file @
0ea48be7
...
...
@@ -37,12 +37,12 @@ export default {
params
:
{},
},
});
yield
put
({
type
:
'selectCourseList'
,
payload
:
{
params
:
{},
},
});
//
yield put({
//
type: 'selectCourseList',
//
payload: {
//
params: {},
//
},
//
});
},
*
pageInit
({
payload
},
{
call
,
put
,
select
})
{
yield
put
({
...
...
src/models/coursemateria.js
View file @
0ea48be7
...
...
@@ -5,6 +5,8 @@ import { message } from 'antd';
import
{
getFileType
,
getRandomFilename
,
getAudioDuration
,
getVideoDuration
,
}
from
'../utils/index'
;
import
*
as
uploader
from
'../services/uploader'
;
import
errorcode
from
'../common/errorcode'
;
...
...
@@ -157,6 +159,7 @@ export default {
message
.
error
(
'上传失败'
,
1
);
return
;
}
let
duration
=
0
;
const
{
name
,
size
,
type
:
fileType
}
=
file
;
const
typeObject
=
getFileType
(
fileType
);
let
ajax
=
null
;
...
...
@@ -167,10 +170,12 @@ export default {
params
=
{
type
:
1
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
case
2
:
// 视频
duration
=
yield
call
(
getVideoDuration
,
file
);
ajax
=
uploader
.
uploadVideoSignature
;
params
=
{
type
:
1
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
case
3
:
// 录音
duration
=
yield
call
(
getAudioDuration
,
file
);
ajax
=
uploader
.
uploadVideoSignature
;
params
=
{
type
:
2
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
...
...
@@ -196,6 +201,7 @@ export default {
yield
put
({
type
:
'uploadFile'
,
payload
:
{
duration
,
signature
,
successCallBack
,
file
,
...
...
@@ -237,6 +243,7 @@ export default {
file
,
successCallBack
,
uploaderLoading
,
duration
,
}
=
payload
;
const
filename
=
`
${
signature
.
dir
}${
getRandomFilename
(
file
.
name
)}
`
;
const
{
name
,
size
,
type
:
fileType
}
=
file
;
...
...
@@ -258,6 +265,7 @@ export default {
name
,
size
,
fileType
,
duration
,
},
filename
,
type
:
getFileType
(
fileType
).
filetype
,
...
...
@@ -274,6 +282,7 @@ export default {
name
,
size
,
fileType
,
duration
,
},
filename
,
images
:
getFileType
(
fileType
).
filetype
==
1
?
[
filename
]
:
[],
...
...
src/models/uploadcourseware.js
View file @
0ea48be7
...
...
@@ -6,7 +6,15 @@ import { message } from 'antd';
import
*
as
uploader
from
'../services/uploader'
;
import
*
as
courseMateriaAjax
from
'../services/courseMateria'
;
import
errorcode
from
'../common/errorcode'
;
import
{
getRandomFilename
,
getFileType
,
imagify
,
videoPoster
,
LocalStorage
}
from
'../utils/index'
;
import
{
getRandomFilename
,
getFileType
,
imagify
,
videoPoster
,
LocalStorage
,
getAudioDuration
,
getVideoDuration
,
}
from
'../utils/index'
;
export
default
{
namespace
:
'uploadcourseware'
,
state
:
{
...
...
@@ -33,16 +41,19 @@ export default {
const
typeObject
=
getFileType
(
fileType
);
let
ajax
=
null
;
let
params
=
null
;
let
duration
=
0
;
switch
(
typeObject
.
fileSmalltype
)
{
case
1
:
// 图片
ajax
=
uploader
.
uploadImageSignature
;
params
=
{
type
:
1
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
case
2
:
// 视频
duration
=
yield
call
(
getVideoDuration
,
file
);
ajax
=
uploader
.
uploadVideoSignature
;
params
=
{
type
:
1
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
case
3
:
// 录音
duration
=
yield
call
(
getAudioDuration
,
file
);
ajax
=
uploader
.
uploadVideoSignature
;
params
=
{
type
:
2
,
token
:
userInfo
.
token
,
schoolId
:
sid
};
break
;
...
...
@@ -72,6 +83,7 @@ export default {
successCallBack
,
file
,
uploaderLoading
,
duration
,
},
});
}
else
{
...
...
@@ -89,6 +101,7 @@ export default {
file
,
successCallBack
,
uploaderLoading
,
duration
,
}
=
payload
;
const
filename
=
`
${
signature
.
dir
}${
getRandomFilename
(
file
.
name
)}
`
;
const
{
name
,
size
,
type
:
fileType
}
=
file
;
...
...
@@ -102,18 +115,6 @@ export default {
};
const
uploadFileData
=
yield
call
(
uploader
.
uploadImg
,
params
);
setTimeout
(
uploaderLoading
);
// yield put({
// type: 'createCourseMateria',
// payload: {
// content: {
// name,
// size,
// fileType,
// },
// filename,
// type: getFileType(fileType).filetype,
// },
// });
yield
put
({
type
:
'updateState'
,
payload
:
{
...
...
@@ -122,6 +123,7 @@ export default {
name
,
size
,
fileType
,
duration
,
},
images
:
getFileType
(
fileType
).
filetype
==
1
?
[
filename
]
:
[],
src
:
filename
,
...
...
src/pages/coursegather/detail/ManageCourse.js
View file @
0ea48be7
...
...
@@ -214,13 +214,6 @@ class ManageCourse extends React.Component { // eslint-disable-line
render
:
(
text
,
record
)
=>
{
const
{
content
}
=
record
;
let
hasWare
=
false
;
// if (!content) {
// hasWare = false;
// } else if (content && !JSON.parse(content).src) {
// hasWare = false;
// } else if (content && JSON.parse(content).src) {
// hasWare = true;
// }
let
name
=
''
;
if
(
manageCourseObj
[
record
.
id
]
&&
manageCourseObj
[
record
.
id
].
content
&&
manageCourseObj
[
record
.
id
].
content
.
src
)
{
hasWare
=
true
;
...
...
src/pages/coursegather/detail/index.js
View file @
0ea48be7
...
...
@@ -350,8 +350,7 @@ class StaticCenter extends React.Component {
}
materialSave
=
(
values
)
=>
{
const
{
dispatch
,
materiaSaveTo
,
editSingleCourseInfo
}
=
this
.
props
;
console
.
log
(
values
,
'values'
);
console
.
log
(
materiaSaveTo
,
'materiaSaveTo'
);
console
.
log
(
materiaSaveTo
,
'materiaSaveTomateriaSaveTo'
);
if
(
materiaSaveTo
==
1
)
{
dispatch
({
type
:
'coursegatherdetail/updateCover'
,
...
...
@@ -502,7 +501,6 @@ class StaticCenter extends React.Component {
uploadCourseware
=
(
values
)
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
addWareType
}
=
this
.
state
;
console
.
log
(
addWareType
,
'asdasdas'
);
if
(
addWareType
==
1
)
{
dispatch
({
type
:
'coursegatherdetail/saveCourseWare'
,
...
...
src/pages/onlineclasses/singleclass/singleDetail.js
View file @
0ea48be7
...
...
@@ -97,6 +97,7 @@ class singleDetailForm extends React.Component {
size
:
content
.
size
,
fileType
:
content
.
fileType
,
name
:
content
.
name
,
duration
:
content
.
duration
,
},
images
:
content
.
images
,
src
:
checkValue
.
src
,
...
...
src/utils/index.js
View file @
0ea48be7
...
...
@@ -820,7 +820,42 @@ function getFileType(type) {
fileSmalltype
,
};
}
function
getAudioDuration
(
file
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
url
=
URL
.
createObjectURL
(
file
);
const
audioElement
=
new
Audio
(
url
);
let
duration
;
audioElement
.
addEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
// eslint-disable-next-line prefer-destructuring
duration
=
audioElement
.
duration
;
resolve
(
Number
(
duration
).
toFixed
(
0
));
// callback(duration);
audioElement
.
removeEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
duration
=
0
;
},
false
);
},
false
);
});
}
function
getVideoDuration
(
file
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
url
=
URL
.
createObjectURL
(
file
);
const
videoElement
=
document
.
createElement
(
'video'
);
videoElement
.
id
=
'videoElement'
;
videoElement
.
src
=
url
;
let
duration
;
videoElement
.
addEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
// eslint-disable-next-line prefer-destructuring
duration
=
videoElement
.
duration
;
resolve
(
Number
(
duration
).
toFixed
(
0
));
// callback(duration);
videoElement
.
removeEventListener
(
'loadedmetadata'
,
(
event
)
=>
{
duration
=
0
;
},
false
);
},
false
);
});
}
export
{
getAudioDuration
,
pageIn
,
SessionStorage
,
LocalStorage
,
...
...
@@ -866,4 +901,5 @@ export {
getDateStamp
,
getFileType
,
pptImagify
,
getVideoDuration
,
};
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