Commit 62f7ae6b by chenshu

feat:初始化

parent b11a9005
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: zhangleyuan * @LastEditors: zhangleyuan
* @LastEditTime: 2021-03-29 14:08:47 * @LastEditTime: 2021-03-29 14:08:47
* @Description: 图文课新增/编辑页 * @Description: 线下课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -25,7 +25,7 @@ import { randomString } from '@/domains/basic-domain/utils'; ...@@ -25,7 +25,7 @@ import { randomString } from '@/domains/basic-domain/utils';
import User from '@/common/js/user'; import User from '@/common/js/user';
import _ from "underscore"; import _ from "underscore";
import Upload from '@/core/upload'; import Upload from '@/core/upload';
import './AddGraphicsCourse.less'; import './AddOfflineCourse.less';
const EDIT_BOX_KEY = Math.random(); const EDIT_BOX_KEY = Math.random();
const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' }; const fieldNames = { label: 'categoryName', value: 'id', children: 'sonCategoryList' };
...@@ -36,7 +36,7 @@ const whetherVisitorsJoin = 'NO' ...@@ -36,7 +36,7 @@ const whetherVisitorsJoin = 'NO'
const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'; const defaultCoverUrl = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png';
let cutFlag = false; let cutFlag = false;
class AddGraphicsCourse extends React.Component { class AddOfflineCourse extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
...@@ -45,15 +45,15 @@ class AddGraphicsCourse extends React.Component { ...@@ -45,15 +45,15 @@ class AddGraphicsCourse extends React.Component {
const pageType = getParameterByName("type"); const pageType = getParameterByName("type");
this.state = { this.state = {
id, // 图文课ID,编辑的时候从URL上带过来 id, // 线下课ID,编辑的时候从URL上带过来
pageType, // 页面类型: add->新建 edit->编辑 pageType, // 页面类型: add->新建 edit->编辑
imageFile: null, // 需要被截取的图片 imageFile: null, // 需要被截取的图片
courseName: null, // 图文课名称 courseName: null, // 线下课名称
courseMedia: '', courseMedia: '',
introduce: '', introduce: '',
courseMediaId: null, // 图文课链接 courseMediaId: null, // 线下课链接
coverId: null, // 图文封面的recourceId coverId: null, // 线下封面的recourceId
coverUrl: defaultCoverUrl, // 图文课封面 coverUrl: defaultCoverUrl, // 线下课封面
studentList: [], // 上课学员列表 studentList: [], // 上课学员列表
shelfState:'YES', //是否开启学院展示 shelfState:'YES', //是否开启学院展示
diskList: [], // 机构可见磁盘目录 diskList: [], // 机构可见磁盘目录
...@@ -78,13 +78,13 @@ class AddGraphicsCourse extends React.Component { ...@@ -78,13 +78,13 @@ class AddGraphicsCourse extends React.Component {
} }
initBus = () => { initBus = () => {
Bus.bind('graphicsEditorImage', this.uploadImage) Bus.bind('offlineEditorImage', this.uploadImage)
Bus.bind('graphicsEditorVideo', this.uploadVideo) Bus.bind('offlineEditorVideo', this.uploadVideo)
} }
removeBus = () => { removeBus = () => {
Bus.unbind('graphicsEditorImage', this.uploadImage) Bus.unbind('offlineEditorImage', this.uploadImage)
Bus.unbind('graphicsEditorVideo', this.uploadVideo) Bus.unbind('offlineEditorVideo', this.uploadVideo)
} }
uploadImage = () => { uploadImage = () => {
...@@ -118,7 +118,7 @@ class AddGraphicsCourse extends React.Component { ...@@ -118,7 +118,7 @@ class AddGraphicsCourse extends React.Component {
break; break;
} }
} }
// 获取图文课详情 // 获取线下课详情
handleFetchScheudleDetail = (courseId) => { handleFetchScheudleDetail = (courseId) => {
Service.Hades('public/hades/mediaCourseDetail',{ Service.Hades('public/hades/mediaCourseDetail',{
courseId courseId
...@@ -207,13 +207,13 @@ class AddGraphicsCourse extends React.Component { ...@@ -207,13 +207,13 @@ class AddGraphicsCourse extends React.Component {
icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>, icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>,
onOk: () => { onOk: () => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/offline-course`,
}); });
} }
}); });
}else{ }else{
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/offline-course`,
}); });
} }
} }
...@@ -431,7 +431,7 @@ class AddGraphicsCourse extends React.Component { ...@@ -431,7 +431,7 @@ class AddGraphicsCourse extends React.Component {
whetherVisitorsJoin, whetherVisitorsJoin,
courseType: 'PICTURE', courseType: 'PICTURE',
}; };
// 校验必填字段:课程名称, 课程图文 // 校验必填字段:课程名称, 课程线下
this.handleValidate(courseName, courseMedia, categoryId).then((res) => { this.handleValidate(courseName, courseMedia, categoryId).then((res) => {
if (!res) return; if (!res) return;
Upload.uploadTextToOSS(courseMedia, `${randomString()}.txt`, (courseMediaId) => { Upload.uploadTextToOSS(courseMedia, `${randomString()}.txt`, (courseMediaId) => {
...@@ -457,7 +457,7 @@ class AddGraphicsCourse extends React.Component { ...@@ -457,7 +457,7 @@ class AddGraphicsCourse extends React.Component {
if (!res) return; if (!res) return;
message.success("新建成功"); message.success("新建成功");
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/offline-course`,
}); });
}) })
} else { } else {
...@@ -469,7 +469,7 @@ class AddGraphicsCourse extends React.Component { ...@@ -469,7 +469,7 @@ class AddGraphicsCourse extends React.Component {
if (!res) return; if (!res) return;
message.success("保存成功"); message.success("保存成功");
window.RCHistory.push({ window.RCHistory.push({
pathname: `/graphics-course`, pathname: `/offline-course`,
}); });
}); });
} }
...@@ -532,11 +532,12 @@ class AddGraphicsCourse extends React.Component { ...@@ -532,11 +532,12 @@ class AddGraphicsCourse extends React.Component {
const hasSelectedStu = studentList.length; const hasSelectedStu = studentList.length;
const courseWareIcon = FileVerifyMap[videoType] ? FileTypeIcon[FileVerifyMap[videoType].type] : FileTypeIcon[videoType]; const courseWareIcon = FileVerifyMap[videoType] ? FileTypeIcon[FileVerifyMap[videoType].type] : FileTypeIcon[videoType];
const isDefaultCover = coverUrl === defaultCoverUrl;
return ( return (
<div className="page add-video-course-page"> <div className="page add-offline-course-page">
<Breadcrumbs <Breadcrumbs
navList={pageType === "add" ? "新建图文课" : "编辑图文课"} navList={pageType === "add" ? "新建线下课" : "编辑线下课"}
goBack={this.handleGoBack} goBack={this.handleGoBack}
/> />
...@@ -546,31 +547,40 @@ class AddGraphicsCourse extends React.Component { ...@@ -546,31 +547,40 @@ class AddGraphicsCourse extends React.Component {
</div> </div>
<div className="form"> <div className="form">
<div className="basic-info__wrap">
<div className="title">基本信息</div>
<div className="course-name required"> <div className="course-name required">
<span className="label">课程名称:</span> <span className="label">课程名称:</span>
<Input <Input
value={courseName} value={courseName}
placeholder="请输入图文课的名称(40字以内)" placeholder="请输入线下课的名称(40字以内)"
maxLength={40} maxLength={40}
style={{ width: 240 }} style={{ width: 240 }}
onChange={(e) => { this.handleChangeForm('courseName', e.target.value)}} onChange={(e) => { this.handleChangeForm('courseName', e.target.value)}}
/> />
</div> </div>
<div className="course-cover">
<span className="label">封面图:</span>
<div className="course-cover__wrap">
<div className="cover-url flex mt16">
<div className="label">封面图:</div>
<div className="cover-url__wrap">
<div className="img-content"> <div className="img-content">
{
isDefaultCover && <span className="tag">默认图</span>
}
<img src={coverUrl} /> <img src={coverUrl} />
</div> </div>
<div className="opt-btns"> <div className="opt-btns">
<Button onClick={() => { <Button onClick={() => {
this.setState({ this.setState({
showSelectCoverModal: true showSelectFileModal: true
}); })
}}>{`${(pageType === 'add' && !coverUrl) ? '上传' : '修改'}封面`}</Button> }}>上传图片</Button>
<div className="tips">建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。</div> <span
className={`default-btn ${isDefaultCover ? 'disabled' : ''}`}
onClick={this.handleResetCoverUrl}
>使用默认图</span>
<div className="tips">建议尺寸1280*720px,图片支持jpg、jpeg、png格式。</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -583,19 +593,9 @@ class AddGraphicsCourse extends React.Component { ...@@ -583,19 +593,9 @@ class AddGraphicsCourse extends React.Component {
<Cascader defaultValue={[categoryName]} options={courseCatalogList} displayRender={ label => label.join('-')} fieldNames={fieldNames} onChange={this.catalogChange} style={{ width: 240 }} placeholder="请选择课程分类" suffixIcon={<span className="icon iconfont" style={{fontSize:'12px',color:'#BFBFBF'}}>&#xe835;</span>}/> <Cascader defaultValue={[categoryName]} options={courseCatalogList} displayRender={ label => label.join('-')} fieldNames={fieldNames} onChange={this.catalogChange} style={{ width: 240 }} placeholder="请选择课程分类" suffixIcon={<span className="icon iconfont" style={{fontSize:'12px',color:'#BFBFBF'}}>&#xe835;</span>}/>
} }
</div> </div>
</div>
<div className="intro-info mt16"> <div className="intro-info mt16">
<AddGraphicsIntro
data={{
id,
courseMedia,
introduce,
shelfState,
whetherVisitorsJoin,
loadcourseMedia,
loadintroduce,
}}
onChange={this.handleChangeForm}
/>
</div> </div>
</div> </div>
</div> </div>
...@@ -686,4 +686,4 @@ class AddGraphicsCourse extends React.Component { ...@@ -686,4 +686,4 @@ class AddGraphicsCourse extends React.Component {
} }
} }
export default AddGraphicsCourse; export default AddOfflineCourse;
.add-video-course-page { .add-offline-course-page {
position:relative !important; position:relative !important;
.box{ .box{
margin-bottom:66px !important; margin-bottom:66px !important;
...@@ -28,6 +28,16 @@ ...@@ -28,6 +28,16 @@
.form { .form {
margin-top: 16px; margin-top: 16px;
padding: 0 16px; padding: 0 16px;
.basic-info__wrap {
.title {
font-size: 16px;
color: #333;
font-weight: 500;
line-height: 22px;
margin-bottom: 16px;
margin-left: -16px;
}
}
.label{ .label{
display:inline-block; display:inline-block;
text-align:right; text-align:right;
...@@ -70,40 +80,67 @@ ...@@ -70,40 +80,67 @@
.flex { .flex {
display: flex; display: flex;
} }
.course-cover {
display: flex;
margin-top: 16px;
&__wrap {
position: relative;
.tag {
border-radius: 2px;
background: #D6D6D6;
font-size: 12px;
height: 18px;
width: 52px;
text-align: center;
color: #FFF;
position: absolute;
top: 8px;
left: 8px;
}
}
.course-cover__wrap {
display: flex;
flex-direction: row;
}
.cover-url__wrap {
.img-content { .img-content {
width: 298px; margin-right: 20px;
height: 172px; width: 299px;
height: 169px;
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: contain; object-fit: contain;
border: 1px solid #E8e8e8;
} }
} }
.empty-img {
width: 298px;
height: 172px;
border: 1px dashed #EBEBEB;
border-radius: 4px;
padding: 12px;
color: #999;
padding: 52px 24px;
text-align: center;
}
.opt-btns { .opt-btns {
margin-top: 8px;
display: flex; .default-btn {
align-items: center; margin-left: 16px;
color: #5289FA;
cursor: pointer;
&.disabled {
color: #CCC;
cursor: not-allowed;
}
}
.ant-upload-list {
display: none;
}
}
.tips { .tips {
margin-left: 12px; margin-top: 8px;
color: #999; color: #999;
} }
} }
}
.select-student { .select-student {
align-items: center; align-items: center;
......
...@@ -19,7 +19,7 @@ export default function OfflineCourseOpt() { ...@@ -19,7 +19,7 @@ export default function OfflineCourseOpt() {
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
RCHistory.push('/create-graphics-course?type=add'); RCHistory.push('/create-offline-course?type=add');
}} }}
className="mr12" className="mr12"
>新建线下课</Button> >新建线下课</Button>
......
...@@ -14,20 +14,19 @@ class OfflineCoursePage extends React.Component { ...@@ -14,20 +14,19 @@ class OfflineCoursePage extends React.Component {
query: { query: {
size: 10, size: 10,
current: 1, current: 1,
courseType: 'PICTURE',
storeId:User.getStoreId() storeId:User.getStoreId()
}, },
dataSource: [], // 视频课列表 dataSource: [], // 线下课列表
totalCount: 0, // 视频课数据总条数 totalCount: 0, // 线下课数据总条数
} }
} }
componentWillMount() { componentWillMount() {
// 获取视频课列表 // 获取线下课列表
this.handleFetchScheduleList(); this.handleFetchScheduleList();
} }
// 获取视频课列表 // 获取线下课列表
handleFetchScheduleList = (_query = {}) => { handleFetchScheduleList = (_query = {}) => {
const query = { const query = {
...this.state.query, ...this.state.query,
...@@ -36,7 +35,7 @@ class OfflineCoursePage extends React.Component { ...@@ -36,7 +35,7 @@ class OfflineCoursePage extends React.Component {
// 更新请求参数 // 更新请求参数
this.setState({ query }); this.setState({ query });
Service.Hades('public/hades/mediaCoursePage', query).then((res) => { Service.Hades('public/hades/getOfflineCoursePage', query).then((res) => {
const { result = {} } = res || {}; const { result = {} } = res || {};
const { records = [], total = 0 } = result; const { records = [], total = 0 } = result;
this.setState({ this.setState({
...@@ -44,14 +43,6 @@ class OfflineCoursePage extends React.Component { ...@@ -44,14 +43,6 @@ class OfflineCoursePage extends React.Component {
totalCount: Number(total) totalCount: Number(total)
}); });
}) })
// CourseService.videoSchedulePage(query).then((res) => {
// const { result = {} } = res || {};
// const { records = [], total = 0 } = result;
// this.setState({
// dataSource: records,
// totalCount: Number(total)
// });
// });
} }
render() { render() {
...@@ -69,7 +60,7 @@ class OfflineCoursePage extends React.Component { ...@@ -69,7 +60,7 @@ class OfflineCoursePage extends React.Component {
{/* 操作模块 */} {/* 操作模块 */}
<OfflineCourseOpt /> <OfflineCourseOpt />
{/* 视频课列表模块 */} {/* 线下课列表模块 */}
<OfflineCourseList <OfflineCourseList
query={query} query={query}
dataSource={dataSource} dataSource={dataSource}
......
...@@ -20,6 +20,7 @@ import GraphicsCoursePage from '@/modules/course-manage/graphics-course' ...@@ -20,6 +20,7 @@ import GraphicsCoursePage from '@/modules/course-manage/graphics-course'
import OfflineCoursePage from '@/modules/course-manage/offline-course' import OfflineCoursePage from '@/modules/course-manage/offline-course'
import AddVideoCoursePage from '@/modules/course-manage/video-course/AddVideoCourse' import AddVideoCoursePage from '@/modules/course-manage/video-course/AddVideoCourse'
import AddGraphicsCoursePage from '@/modules/course-manage/graphics-course/AddGraphicsCourse' import AddGraphicsCoursePage from '@/modules/course-manage/graphics-course/AddGraphicsCourse'
import AddOfflineCoursePage from '@/modules/course-manage/offline-course/AddOfflineCourse'
// import DataList from '@/modules/course-manage/DataList/DataList'; // import DataList from '@/modules/course-manage/DataList/DataList';
// import ClassBook from '@/modules/resource-disk'; // import ClassBook from '@/modules/resource-disk';
import ResourceDisk from '@/modules/resource-disk'; import ResourceDisk from '@/modules/resource-disk';
...@@ -118,6 +119,11 @@ const mainRoutes = [ ...@@ -118,6 +119,11 @@ const mainRoutes = [
name: "创建图文课", name: "创建图文课",
}, },
{ {
path: "/create-offline-course",
component: AddOfflineCoursePage,
name: "创建线下课",
},
{
path: "/resource-disk", path: "/resource-disk",
component: ResourceDisk, component: ResourceDisk,
name: "资料云盘", name: "资料云盘",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment