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
59fa070f
Commit
59fa070f
authored
Jul 09, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:添加因合并分支丢失的视频上传相关方法的代码
parent
3ef91dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
172 additions
and
33 deletions
+172
-33
src/modules/course-manage/video-course/AddVideoCourse.jsx
+172
-33
No files found.
src/modules/course-manage/video-course/AddVideoCourse.jsx
View file @
59fa070f
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-08-05 10:07:47
* @Date: 2020-08-05 10:07:47
* @LastEditors:
Please set LastEditors
* @LastEditors:
yuananting
* @LastEditTime: 2021-07-09 1
1:50:51
* @LastEditTime: 2021-07-09 1
4:16:04
* @Description: 视频课新增/编辑页
* @Description: 视频课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -341,40 +341,179 @@ class AddVideoCourse extends React.Component {
...
@@ -341,40 +341,179 @@ class AddVideoCourse extends React.Component {
})
})
}
}
// 校验课节名称
// 校验课节名称
handleValidateChapterName
=
(
chapterName
)
=>
{
handleValidateChapterName
=
(
chapterName
)
=>
{
let
hasError
=
false
;
let
hasError
=
false
;
return
new
Promise
((
resolve
)
=>
{
return
new
Promise
((
resolve
)
=>
{
if
(
!
chapterName
)
{
if
(
!
chapterName
)
{
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
"error"
,
chapterNameValidateStatus
:
"error"
,
chapterNameHelpMsg
:
'请输入课节名称'
chapterNameHelpMsg
:
'请输入课节名称'
})
})
hasError
=
true
;
hasError
=
true
;
resolve
(
false
)
resolve
(
false
)
return
false
return
false
}
}
if
(
chapterName
.
length
>
40
)
{
if
(
chapterName
.
length
>
40
)
{
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
"error"
,
chapterNameValidateStatus
:
"error"
,
chapterNameHelpMsg
:
'不要超过40字'
chapterNameHelpMsg
:
'不要超过40字'
})
})
hasError
=
true
;
hasError
=
true
;
resolve
(
false
)
resolve
(
false
)
return
false
return
false
}
}
if
(
!
hasError
){
if
(
!
hasError
){
resolve
(
true
)
resolve
(
true
)
this
.
setState
({
this
.
setState
({
chapterNameValidateStatus
:
""
,
chapterNameValidateStatus
:
""
,
chapterNameHelpMsg
:
""
chapterNameHelpMsg
:
""
})
})
}
})
}
// 重命名
handleRenameCourseChapter
=
(
chapterId
)
=>
{
const
{
mediaNameAlias
}
=
this
.
state
;
this
.
handleValidateChapterName
(
mediaNameAlias
).
then
((
res
)
=>
{
// 校验不通过不能点确定保存修改课节名称
if
(
!
res
)
{
this
.
setState
({
chapterNameValidateStatus
:
''
,
chapterNameHelpMsg
:
''
,
mediaNameAlias
:
''
,
});
return
message
.
warning
(
'重命名失败'
);
}
let
{
courseChapterList
}
=
this
.
state
;
let
_courseChapterList
=
[];
_courseChapterList
=
courseChapterList
.
map
((
item
,
index
)
=>
{
if
(
item
.
id
===
chapterId
)
{
item
.
mediaName
=
mediaNameAlias
;
}
}
})
return
item
;
});
this
.
setState
({
courseChapterList
:
_courseChapterList
,
chapterNameValidateStatus
:
''
,
chapterNameHelpMsg
:
''
,
mediaNameAlias
:
''
,
});
});
};
// 校验课节名称
handleValidateChapterName
=
(
chapterName
)
=>
{
let
hasError
=
false
;
return
new
Promise
((
resolve
)
=>
{
if
(
!
chapterName
)
{
this
.
setState
({
chapterNameValidateStatus
:
'error'
,
chapterNameHelpMsg
:
'请输入课节名称'
,
});
hasError
=
true
;
resolve
(
false
);
return
false
;
}
if
(
chapterName
.
length
>
40
)
{
this
.
setState
({
chapterNameValidateStatus
:
'error'
,
chapterNameHelpMsg
:
'不要超过40字'
,
});
hasError
=
true
;
resolve
(
false
);
return
false
;
}
if
(
!
hasError
)
{
resolve
(
true
);
this
.
setState
({
chapterNameValidateStatus
:
''
,
chapterNameHelpMsg
:
''
,
});
}
});
};
handleDeleteCourseChapter
=
(
chapterId
)
=>
{
console
.
log
(
'chapterId---'
,
chapterId
);
let
{
courseChapterList
}
=
this
.
state
;
let
_courseChapterList
=
courseChapterList
.
filter
((
item
,
index
)
=>
{
return
item
.
id
!==
chapterId
;
});
this
.
setState
({
courseChapterList
:
_courseChapterList
,
});
};
renderChapterTitle
=
(
item
)
=>
{
const
{
chapterNameValidateStatus
,
chapterNameHelpMsg
}
=
this
.
state
;
return
(
<
div
className=
'course-chapter-title-popover'
>
<
div
className=
'tag-title'
>
课节名称
</
div
>
<
Form
>
<
Form
.
Item
validateStatus=
{
chapterNameValidateStatus
}
help=
{
chapterNameHelpMsg
}
>
<
TextArea
defaultValue=
{
item
.
mediaName
}
placeholder=
'请输入课节名称'
maxLength=
{
40
}
autoSize
style=
{
{
width
:
'318px'
}
}
onChange=
{
(
e
)
=>
{
this
.
setState
(
{
mediaNameAlias
:
e
.
target
.
value
.
trim
(),
},
()
=>
{
this
.
handleValidateChapterName
(
this
.
state
.
mediaNameAlias
);
}
);
}
}
/>
</
Form
.
Item
>
</
Form
>
</
div
>
);
};
// 上下移动
handleChangeIndex
=
(
isUp
,
sortIndex
)
=>
{
const
{
courseChapterList
}
=
this
.
state
;
// 第一个上移和最后一个下移不能使用
if
((
isUp
&&
sortIndex
===
0
)
||
(
!
isUp
&&
sortIndex
===
courseChapterList
.
length
-
1
))
{
return
;
}
}
let
_courseChapterList
=
[...
courseChapterList
];
const
temp
=
courseChapterList
[
sortIndex
];
// 若上移
if
(
isUp
)
{
_courseChapterList
[
sortIndex
-
1
]
=
temp
;
_courseChapterList
[
sortIndex
-
1
].
sort
=
sortIndex
-
1
;
_courseChapterList
[
sortIndex
]
=
courseChapterList
[
sortIndex
-
1
];
_courseChapterList
[
sortIndex
].
sort
=
sortIndex
;
}
else
{
// 若下移
_courseChapterList
[
sortIndex
+
1
]
=
temp
;
_courseChapterList
[
sortIndex
+
1
].
sort
=
sortIndex
+
1
;
_courseChapterList
[
sortIndex
]
=
courseChapterList
[
sortIndex
+
1
];
_courseChapterList
[
sortIndex
].
sort
=
sortIndex
;
}
this
.
setState
({
courseChapterList
:
_courseChapterList
,
});
};
// 保存
// 保存
handleSubmit
=
()
=>
{
handleSubmit
=
()
=>
{
//过期判断
//过期判断
...
...
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