Commit 1402a09b by guomingpang

fix:merge hotfix/hotfix/pangguoming/20210601/plan_list_add_cover to master

parents 5bd610bd e340da37
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Last Modified by: chenshu * @Last Modified by: chenshu
* @Last Modified time: 2020-08-31 14:55:30 * @Last Modified time: 2020-08-31 14:55:30
*/ */
@import "./variables.less"; @import './variables.less';
@active-color: #2966ff; @active-color: #2966ff;
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
} }
.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn { .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
font-weight: 500!important; font-weight: 500 !important;
} }
.ant-tabs-nav .ant-tabs-tab-active { .ant-tabs-nav .ant-tabs-tab-active {
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
//display: none!important; //display: none!important;
&:after { &:after {
content: ""; content: '';
display: inline-block; display: inline-block;
position: absolute; position: absolute;
width: 30px; width: 30px;
...@@ -660,8 +660,8 @@ td.ant-table-column-sort { ...@@ -660,8 +660,8 @@ td.ant-table-column-sort {
background-color: #2966ff !important; background-color: #2966ff !important;
opacity: 0.8 !important; opacity: 0.8 !important;
} }
&:active{ &:active {
background-color:#5C8AFF !important; background-color: #5c8aff !important;
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
left: 0px; left: 0px;
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index:3; z-index: 3;
background-color: #fff; background-color: #fff;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
bottom: 0; bottom: 0;
z-index: 102; z-index: 102;
overflow: auto; overflow: auto;
margin:0 16px; margin: 0 16px;
.box{ .box {
&:first-child{ &:first-child {
margin-bottom: 8px; margin-bottom: 8px;
} }
&:last-child{ &:last-child {
margin-bottom: 16px; margin-bottom: 16px;
} }
} }
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
.content-header { .content-header {
padding: 16px 16px 8px 16px; padding: 16px 16px 8px 16px;
line-height: 30px; line-height: 30px;
font-size:24px; font-size: 24px;
color:#333; color: #333;
font-weight:bold; font-weight: bold;
background: #FFF; background: #fff;
h1 { h1 {
font-weight: normal; font-weight: normal;
display: inline-block; display: inline-block;
......
...@@ -2,56 +2,56 @@ ...@@ -2,56 +2,56 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-05 10:07:47 * @Date: 2020-08-05 10:07:47
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2021-05-30 17:33:09 * @LastEditTime: 2021-05-30 20:35:49
* @Description: 视频课新增/编辑页 * @Description: 视频课新增/编辑页
* @Copyright: 杭州杰竞科技有限公司 版权所有 * @Copyright: 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react' import React from 'react';
import { Button, Input, Radio, message, Modal, Cascader } from 'antd' import { Button, Input, Radio, message, Modal, Cascader } from 'antd';
import { DISK_MAP, FileTypeIcon, FileVerifyMap } from '@/common/constants/academic/lessonEnum' import { DISK_MAP, FileTypeIcon, FileVerifyMap } from '@/common/constants/academic/lessonEnum';
import { ImgCutModalNew } from '@/components' import { ImgCutModalNew } from '@/components';
import ShowTips from '@/components/ShowTips' import ShowTips from '@/components/ShowTips';
import Breadcrumbs from '@/components/Breadcrumbs' import Breadcrumbs from '@/components/Breadcrumbs';
import AddVideoIntro from './components/AddVideoIntro' import AddVideoIntro from './components/AddVideoIntro';
import SelectStudent from '../modal/select-student' import SelectStudent from '../modal/select-student';
import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal' import SelectPrepareFileModal from '../../prepare-lesson/modal/SelectPrepareFileModal';
import PreviewCourseModal from '../modal/PreviewCourseModal' import PreviewCourseModal from '../modal/PreviewCourseModal';
import StoreService from '@/domains/store-domain/storeService' import StoreService from '@/domains/store-domain/storeService';
import CourseService from '@/domains/course-domain/CourseService' import CourseService from '@/domains/course-domain/CourseService';
import Service from '@/common/js/service' import Service from '@/common/js/service';
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 { randomString } from '@/domains/basic-domain/utils' import { randomString } from '@/domains/basic-domain/utils';
import $ from 'jquery' import $ from 'jquery';
// import PhotoClip from 'photoclip'; // import PhotoClip from 'photoclip';
import './AddVideoCourse.less' import './AddVideoCourse.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' };
//添加课程时课程默认的一些值 //添加课程时课程默认的一些值
const defaultShelfState = 'YES' const defaultShelfState = 'YES';
const defaultScheduleMedia = [ const defaultScheduleMedia = [
{ {
contentType: 'INTRO', contentType: 'INTRO',
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
key: EDIT_BOX_KEY key: EDIT_BOX_KEY,
} },
] ];
const whetherVisitorsJoin = 'NO' const whetherVisitorsJoin = 'NO';
let cutFlag = false let cutFlag = false;
class AddVideoCourse extends React.Component { class AddVideoCourse extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props);
const id = getParameterByName('id') const id = getParameterByName('id');
const pageType = getParameterByName('type') const pageType = getParameterByName('type');
this.state = { this.state = {
id, // 视频课ID,编辑的时候从URL上带过来 id, // 视频课ID,编辑的时候从URL上带过来
...@@ -69,8 +69,8 @@ class AddVideoCourse extends React.Component { ...@@ -69,8 +69,8 @@ class AddVideoCourse extends React.Component {
contentType: 'INTRO', contentType: 'INTRO',
mediaType: 'TEXT', mediaType: 'TEXT',
mediaContent: '', mediaContent: '',
key: EDIT_BOX_KEY key: EDIT_BOX_KEY,
} },
], ],
diskList: [], // 机构可见磁盘目录 diskList: [], // 机构可见磁盘目录
selectedFileList: [], // 已经从资料云盘中勾选的文件 selectedFileList: [], // 已经从资料云盘中勾选的文件
...@@ -83,15 +83,15 @@ class AddVideoCourse extends React.Component { ...@@ -83,15 +83,15 @@ class AddVideoCourse extends React.Component {
whetherVisitorsJoin: 'NO', // 是否允许游客加入 whetherVisitorsJoin: 'NO', // 是否允许游客加入
showSelectCoverModal: false, showSelectCoverModal: false,
cutImageBlob: null, cutImageBlob: null,
introduce: '' introduce: '',
} };
} }
componentWillMount() { componentWillMount() {
const { id, pageType } = this.state const { id, pageType } = this.state;
this.getCourseCatalogList() this.getCourseCatalogList();
if (pageType === 'edit') { if (pageType === 'edit') {
this.handleFetchScheudleDetail(id) this.handleFetchScheudleDetail(id);
} }
} }
...@@ -99,70 +99,70 @@ class AddVideoCourse extends React.Component { ...@@ -99,70 +99,70 @@ class AddVideoCourse extends React.Component {
getCourseCatalogList = () => { getCourseCatalogList = () => {
StoreService.getCourseCatalogList({ current: 1, size: 1000 }).then((res) => { StoreService.getCourseCatalogList({ current: 1, size: 1000 }).then((res) => {
this.setState({ this.setState({
courseCatalogList: res.result.records courseCatalogList: res.result.records,
}) });
}) });
} };
catalogChange = (value) => { catalogChange = (value) => {
const changeValueLength = value.length const changeValueLength = value.length;
switch (changeValueLength) { switch (changeValueLength) {
case 1: case 1:
this.setState({ categoryId: value[0] }) this.setState({ categoryId: value[0] });
break break;
case 2: case 2:
this.setState({ categoryId: value[1] }) this.setState({ categoryId: value[1] });
break break;
default: default:
this.setState({ categoryId: null }) this.setState({ categoryId: null });
break break;
}
} }
};
// 获取视频课详情 // 获取视频课详情
handleFetchScheudleDetail = (courseId) => { handleFetchScheudleDetail = (courseId) => {
CourseService.videoScheduleDetail({ CourseService.videoScheduleDetail({
courseId courseId,
}).then((res) => { }).then((res) => {
const { result = {} } = res || {} const { result = {} } = res || {};
const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryOneName, categoryTwoName, categoryId } = result const { courseName, shelfState, whetherVisitorsJoin, courseMediaVOS, categoryOneName, categoryTwoName, categoryId } = result;
let coverId let coverId;
let coverUrl let coverUrl;
let videoType let videoType;
let videoDuration let videoDuration;
let videoName let videoName;
let scheduleMedia = [] let scheduleMedia = [];
let scheduleVideoId let scheduleVideoId;
let scheduleVideoUrl let scheduleVideoUrl;
let hasIntro let hasIntro;
courseMediaVOS.map((item) => { courseMediaVOS.map((item) => {
switch (item.contentType) { switch (item.contentType) {
case 'COVER': case 'COVER':
coverId = item.mediaContent coverId = item.mediaContent;
coverUrl = item.mediaUrl coverUrl = item.mediaUrl;
break break;
case 'SCHEDULE': case 'SCHEDULE':
videoDuration = item.videoDuration videoDuration = item.videoDuration;
videoName = item.mediaName videoName = item.mediaName;
scheduleVideoId = item.mediaContent scheduleVideoId = item.mediaContent;
scheduleVideoUrl = item.mediaUrl scheduleVideoUrl = item.mediaUrl;
videoType = item.mediaType videoType = item.mediaType;
break break;
case 'INTRO': case 'INTRO':
hasIntro = true hasIntro = true;
this.getTextDetail('introduce', item.mediaUrl) this.getTextDetail('introduce', item.mediaUrl);
break break;
default: default:
break break;
} }
return item return item;
}) });
let categoryName let categoryName;
if (categoryTwoName) { if (categoryTwoName) {
categoryName = `${categoryOneName}-${categoryTwoName}` categoryName = `${categoryOneName}-${categoryTwoName}`;
} else { } else {
categoryName = `${categoryOneName}` categoryName = `${categoryOneName}`;
} }
this.setState({ this.setState({
loadintroduce: !hasIntro, loadintroduce: !hasIntro,
...@@ -178,10 +178,10 @@ class AddVideoCourse extends React.Component { ...@@ -178,10 +178,10 @@ class AddVideoCourse extends React.Component {
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
categoryName, categoryName,
categoryId categoryId,
}) });
}) });
} };
getTextDetail = (key, url) => { getTextDetail = (key, url) => {
$.ajax({ $.ajax({
...@@ -190,13 +190,13 @@ class AddVideoCourse extends React.Component { ...@@ -190,13 +190,13 @@ class AddVideoCourse extends React.Component {
url, url,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8', contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
success: (res) => { success: (res) => {
this.setState({ [key]: res, [`load${key}`]: true }) this.setState({ [key]: res, [`load${key}`]: true });
} },
}) });
} };
handleGoBack = () => { handleGoBack = () => {
const { coverId, videoName, videoDuration, courseName, scheduleMedia, scheduleVideoId, categoryId, shelfState, whetherVisitorsJoin } = this.state const { coverId, videoName, videoDuration, courseName, scheduleMedia, scheduleVideoId, categoryId, shelfState, whetherVisitorsJoin } = this.state;
if ( if (
videoName || videoName ||
videoDuration || videoDuration ||
...@@ -216,30 +216,30 @@ class AddVideoCourse extends React.Component { ...@@ -216,30 +216,30 @@ class AddVideoCourse 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: `/video-course` pathname: `/video-course`,
}) });
} },
}) });
} else { } else {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/video-course` pathname: `/video-course`,
}) });
}
} }
};
// 修改表单 // 修改表单
handleChangeForm = (field, value, coverUrl) => { handleChangeForm = (field, value, coverUrl) => {
this.setState({ this.setState({
[field]: value, [field]: value,
coverUrl: coverUrl ? coverUrl : this.state.coverUrl coverUrl: coverUrl ? coverUrl : this.state.coverUrl,
}) });
} };
// 显示选择学员弹窗 // 显示选择学员弹窗
handleShowSelectStuModal = () => { handleShowSelectStuModal = () => {
this.setState({ studentModal: true }) this.setState({ studentModal: true });
const { studentList, selectedStuList } = this.state const { studentList, selectedStuList } = this.state;
const studentModal = ( const studentModal = (
<SelectStudent <SelectStudent
showTabs={true} showTabs={true}
...@@ -249,38 +249,38 @@ class AddVideoCourse extends React.Component { ...@@ -249,38 +249,38 @@ class AddVideoCourse extends React.Component {
studentList={studentList} studentList={studentList}
close={() => { close={() => {
this.setState({ this.setState({
studentModal: null studentModal: null,
}) });
}} }}
/> />
) );
this.setState({ studentModal }) this.setState({ studentModal });
} };
handleSelectStudent = (studentIds) => { handleSelectStudent = (studentIds) => {
let studentList = [] let studentList = [];
_.each(studentIds, (item) => { _.each(studentIds, (item) => {
studentList.push({ studentId: item }) studentList.push({ studentId: item });
}) });
// this.setState({ studentModal: null }); // this.setState({ studentModal: null });
this.setState({ studentList }) this.setState({ studentList });
this.setState({ studentModal: false }) this.setState({ studentModal: false });
} };
// 显示预览弹窗 // 显示预览弹窗
handleShowPreviewModal = () => { handleShowPreviewModal = () => {
const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, videoDuration, introduce } = this.state const { coverUrl, scheduleVideoUrl, courseName, scheduleMedia, videoDuration, introduce } = this.state;
const courseBasinInfo = { const courseBasinInfo = {
coverUrl, coverUrl,
scheduleVideoUrl, scheduleVideoUrl,
courseName, courseName,
videoDuration videoDuration,
} };
const courseIntroInfo = { const courseIntroInfo = {
liveCourseMediaRequests: scheduleMedia, liveCourseMediaRequests: scheduleMedia,
introduce introduce,
} };
const previewCourseModal = ( const previewCourseModal = (
<PreviewCourseModal <PreviewCourseModal
...@@ -289,24 +289,24 @@ class AddVideoCourse extends React.Component { ...@@ -289,24 +289,24 @@ class AddVideoCourse extends React.Component {
courseIntroInfo={courseIntroInfo} courseIntroInfo={courseIntroInfo}
close={() => { close={() => {
this.setState({ this.setState({
previewCourseModal: null previewCourseModal: null,
}) });
}} }}
/> />
) );
this.setState({ previewCourseModal }) this.setState({ previewCourseModal });
} };
// 选择视频 // 选择视频
handleSelectVideo = (file) => { handleSelectVideo = (file) => {
this.setState({ this.setState({
showSelectFileModal: false showSelectFileModal: false,
}) });
const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file const { ossUrl, resourceId, folderName, folderFormat, folderSize } = file;
const videoDom = document.createElement('video') const videoDom = document.createElement('video');
videoDom.src = ossUrl videoDom.src = ossUrl;
videoDom.onloadedmetadata = () => { videoDom.onloadedmetadata = () => {
this.setState({ this.setState({
size: folderSize, size: folderSize,
...@@ -314,14 +314,14 @@ class AddVideoCourse extends React.Component { ...@@ -314,14 +314,14 @@ class AddVideoCourse extends React.Component {
videoType: folderFormat, videoType: folderFormat,
scheduleVideoUrl: ossUrl, scheduleVideoUrl: ossUrl,
scheduleVideoId: resourceId, scheduleVideoId: resourceId,
videoDuration: videoDom.duration videoDuration: videoDom.duration,
}) });
} };
} };
// 保存 // 保存
handleSubmit = () => { handleSubmit = () => {
const { instId, adminId } = window.currentUserInstInfo const { instId, adminId } = window.currentUserInstInfo;
const { const {
id, id,
...@@ -340,8 +340,8 @@ class AddVideoCourse extends React.Component { ...@@ -340,8 +340,8 @@ class AddVideoCourse extends React.Component {
categoryId, categoryId,
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
introduce introduce,
} = this.state } = this.state;
const commonParams = { const commonParams = {
videoName, videoName,
...@@ -355,144 +355,144 @@ class AddVideoCourse extends React.Component { ...@@ -355,144 +355,144 @@ class AddVideoCourse extends React.Component {
storeId: User.getStoreId(), storeId: User.getStoreId(),
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
courseType: 'VOICE' courseType: 'VOICE',
} };
// 校验必填字段:课程名称, 课程视频 // 校验必填字段:课程名称, 课程视频
this.handleValidate(courseName, scheduleVideoId, categoryId, scheduleMedia).then((res) => { this.handleValidate(courseName, scheduleVideoId, categoryId, scheduleMedia).then((res) => {
if (!res) return if (!res) return;
Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => { Upload.uploadTextToOSS(introduce, `${randomString()}.txt`, (introduceId) => {
this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } }) this.submitRemote({ id, pageType, commonParams: { ...commonParams, introduceId } });
}) });
}) });
} };
submitRemote = ({ id, pageType, commonParams }) => { submitRemote = ({ id, pageType, commonParams }) => {
if (pageType === 'add') { if (pageType === 'add') {
Service.Hades('public/hades/createMediaCourse', commonParams).then((res) => { Service.Hades('public/hades/createMediaCourse', commonParams).then((res) => {
if (!res) return if (!res) return;
message.success('新建成功') message.success('新建成功');
window.RCHistory.push({ window.RCHistory.push({
pathname: `/video-course` pathname: `/video-course`,
}) });
}) });
} else { } else {
const editParams = { const editParams = {
courseId: id, courseId: id,
...commonParams ...commonParams,
} };
Service.Hades('public/hades/editMediaCourse', editParams).then((res) => { Service.Hades('public/hades/editMediaCourse', editParams).then((res) => {
if (!res) return if (!res) return;
message.success('保存成功') message.success('保存成功');
window.RCHistory.push({ window.RCHistory.push({
pathname: `/video-course` pathname: `/video-course`,
}) });
}) });
}
} }
};
handleValidate = (courseName, scheduleVideoId, categoryId, scheduleMedia) => { handleValidate = (courseName, scheduleVideoId, categoryId, scheduleMedia) => {
return new Promise((resolve) => { return new Promise((resolve) => {
if (!courseName) { if (!courseName) {
message.warning('请输入课程名称') message.warning('请输入课程名称');
resolve(false) resolve(false);
return false return false;
} }
if (!scheduleVideoId) { if (!scheduleVideoId) {
message.warning('请上传视频') message.warning('请上传视频');
resolve(false) resolve(false);
return false return false;
} }
if (!categoryId) { if (!categoryId) {
message.warning('请选择课程分类') message.warning('请选择课程分类');
resolve(false) resolve(false);
return false return false;
} }
const textMedia = scheduleMedia.filter((item) => item.mediaType === 'TEXT') const textMedia = scheduleMedia.filter((item) => item.mediaType === 'TEXT');
for (let i = 0, len = textMedia.length; i < len; i++) { for (let i = 0, len = textMedia.length; i < len; i++) {
if (textMedia[i].mediaContentLength && textMedia[i].mediaContentLength.length > 1000) { if (textMedia[i].mediaContentLength && textMedia[i].mediaContentLength.length > 1000) {
message.warning(`第${i + 1}个文字简介的字数超过了1000个字`) message.warning(`第${i + 1}个文字简介的字数超过了1000个字`);
resolve(false) resolve(false);
return false return false;
} }
} }
resolve(true) resolve(true);
}) });
} };
handleSelectCover = (file) => { handleSelectCover = (file) => {
this.uploadImage(file) this.uploadImage(file);
} };
//上传图片 //上传图片
uploadImage = (imageFile) => { uploadImage = (imageFile) => {
const { folderName } = imageFile const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf('.')) const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf('.'));
const self = this const self = this;
this.setState( this.setState(
{ {
visible: true visible: true,
}, },
() => { () => {
setTimeout(() => { setTimeout(() => {
const okBtnDom = document.querySelector('#headPicModal') const okBtnDom = document.querySelector('#headPicModal');
const options = { const options = {
size: [500, 282], size: [500, 282],
ok: okBtnDom, ok: okBtnDom,
maxZoom: 3, maxZoom: 3,
style: { style: {
jpgFillColor: 'transparent' jpgFillColor: 'transparent',
}, },
done: function (dataUrl) { done: function (dataUrl) {
clearTimeout(self.timer) clearTimeout(self.timer);
self.timer = setTimeout(() => { self.timer = setTimeout(() => {
if (self.state.rotate != this.rotate() || self.state.scale != this.scale()) { if (self.state.rotate != this.rotate() || self.state.scale != this.scale()) {
const _dataUrl = this.clip() const _dataUrl = this.clip();
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl) const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ self.setState({
cutImageBlob, cutImageBlob,
dataUrl: _dataUrl, dataUrl: _dataUrl,
rotate: this.rotate(), rotate: this.rotate(),
scale: this.scale() scale: this.scale(),
}) });
} }
}, 500) }, 500);
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl) const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ self.setState({
cutImageBlob, cutImageBlob,
dataUrl dataUrl,
}) });
setTimeout(() => { setTimeout(() => {
cutFlag = false cutFlag = false;
}, 2000) }, 2000);
}, },
fail: (failInfo) => { fail: (failInfo) => {
message.error('图片上传失败了,请重新上传') message.error('图片上传失败了,请重新上传');
}, },
loadComplete: function (img) { loadComplete: function (img) {
setTimeout(() => { setTimeout(() => {
const _dataUrl = this.clip() const _dataUrl = this.clip();
self.setState({ self.setState({
dataUrl: _dataUrl, dataUrl: _dataUrl,
hasImgReady: true hasImgReady: true,
}) });
}, 100) }, 100);
} },
} };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`;
if (!this.state.photoclip) { if (!this.state.photoclip) {
const _photoclip = new PhotoClip('#headPicModal', options) const _photoclip = new PhotoClip('#headPicModal', options);
_photoclip.load(imgUrl) _photoclip.load(imgUrl);
this.setState({ this.setState({
photoclip: _photoclip photoclip: _photoclip,
}) });
} else { } else {
this.state.photoclip.clear() this.state.photoclip.clear();
this.state.photoclip.load(imgUrl) this.state.photoclip.load(imgUrl);
} }
}, 200) }, 200);
}
)
} }
);
};
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
...@@ -501,30 +501,30 @@ class AddVideoCourse extends React.Component { ...@@ -501,30 +501,30 @@ class AddVideoCourse extends React.Component {
{ {
coverClicpPath: signInfo.fileUrl, coverClicpPath: signInfo.fileUrl,
coverId: signInfo.resourceId, coverId: signInfo.resourceId,
visible: false visible: false,
}, },
() => this.updateCover() () => this.updateCover()
) );
}) });
} };
updateCover = () => { updateCover = () => {
const { coverClicpPath, coverId } = this.state const { coverClicpPath, coverId } = this.state;
this.setState({ this.setState({
showSelectCoverModal: false, showSelectCoverModal: false,
coverUrl: coverClicpPath, coverUrl: coverClicpPath,
coverId: coverId coverId: coverId,
}) });
} };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(',')[1]) const bytes = window.atob(urlData.split(',')[1]);
const ab = new ArrayBuffer(bytes.length) const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab) const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i) ia[i] = bytes.charCodeAt(i);
}
return new Blob([ab], { type: 'image/png' })
} }
return new Blob([ab], { type: 'image/png' });
};
render() { render() {
const { const {
pageType, pageType,
...@@ -552,13 +552,13 @@ class AddVideoCourse extends React.Component { ...@@ -552,13 +552,13 @@ class AddVideoCourse extends React.Component {
cutImageBlob, cutImageBlob,
introduce, introduce,
loadintroduce, loadintroduce,
id id,
} = this.state } = this.state;
// 已选择的上课学员数量 // 已选择的上课学员数量
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];
return ( return (
<div className='page add-video-course-page'> <div className='page add-video-course-page'>
...@@ -578,7 +578,7 @@ class AddVideoCourse extends React.Component { ...@@ -578,7 +578,7 @@ class AddVideoCourse extends React.Component {
maxLength={40} maxLength={40}
style={{ width: 240 }} style={{ width: 240 }}
onChange={(e) => { onChange={(e) => {
this.handleChangeForm('courseName', e.target.value) this.handleChangeForm('courseName', e.target.value);
}} }}
/> />
</div> </div>
...@@ -601,8 +601,8 @@ class AddVideoCourse extends React.Component { ...@@ -601,8 +601,8 @@ class AddVideoCourse extends React.Component {
<Button <Button
onClick={() => { onClick={() => {
this.setState({ this.setState({
showSelectFileModal: true showSelectFileModal: true,
}) });
}}>{`${pageType === 'add' && !scheduleVideoId ? '选择' : '更换'}视频`}</Button> }}>{`${pageType === 'add' && !scheduleVideoId ? '选择' : '更换'}视频`}</Button>
<span className='tips'>视频数量限制1个,大小不超过2G</span> <span className='tips'>视频数量限制1个,大小不超过2G</span>
...@@ -627,7 +627,7 @@ class AddVideoCourse extends React.Component { ...@@ -627,7 +627,7 @@ class AddVideoCourse extends React.Component {
<div className='opt-btns'> <div className='opt-btns'>
<Button <Button
onClick={() => { onClick={() => {
this.setState({ showSelectCoverModal: true }) this.setState({ showSelectCoverModal: true });
}}>{`${pageType === 'add' && !scheduleVideoId && !coverUrl ? '上传' : '修改'}封面`}</Button> }}>{`${pageType === 'add' && !scheduleVideoId && !coverUrl ? '上传' : '修改'}封面`}</Button>
<div className='tips'>建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。</div> <div className='tips'>建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。</div>
</div> </div>
...@@ -676,7 +676,7 @@ class AddVideoCourse extends React.Component { ...@@ -676,7 +676,7 @@ class AddVideoCourse extends React.Component {
shelfState, shelfState,
whetherVisitorsJoin, whetherVisitorsJoin,
introduce, introduce,
loadintroduce loadintroduce,
}} }}
onChange={this.handleChangeForm} onChange={this.handleChangeForm}
/> />
...@@ -684,7 +684,7 @@ class AddVideoCourse extends React.Component { ...@@ -684,7 +684,7 @@ class AddVideoCourse extends React.Component {
</div> </div>
</div> </div>
<div className="footer shrink-footer"> <div className='footer shrink-footer'>
<Button onClick={this.handleGoBack}>取消</Button> <Button onClick={this.handleGoBack}>取消</Button>
<Button onClick={this.handleShowPreviewModal}>预览</Button> <Button onClick={this.handleShowPreviewModal}>预览</Button>
<Button type='primary' onClick={_.debounce(() => this.handleSubmit(), 3000, true)}> <Button type='primary' onClick={_.debounce(() => this.handleSubmit(), 3000, true)}>
...@@ -700,14 +700,14 @@ class AddVideoCourse extends React.Component { ...@@ -700,14 +700,14 @@ class AddVideoCourse extends React.Component {
accept='video/mp4' accept='video/mp4'
confirm={{ confirm={{
title: '文件过大,无法上传', title: '文件过大,无法上传',
content: '为保障学员的观看体验,上传的视频大小不能超过2G' content: '为保障学员的观看体验,上传的视频大小不能超过2G',
}} }}
tooltip={'格式支持mp4,大小不超过2G'} tooltip={'格式支持mp4,大小不超过2G'}
isOpen={showSelectFileModal} isOpen={showSelectFileModal}
diskList={diskList} diskList={diskList}
addVideo={true} addVideo={true}
onClose={() => { onClose={() => {
this.setState({ showSelectFileModal: false }) this.setState({ showSelectFileModal: false });
}} }}
onSelect={this.handleSelectVideo} onSelect={this.handleSelectVideo}
/> />
...@@ -722,7 +722,7 @@ class AddVideoCourse extends React.Component { ...@@ -722,7 +722,7 @@ class AddVideoCourse extends React.Component {
tooltip='支持文件类型:jpg、jpeg、png' tooltip='支持文件类型:jpg、jpeg、png'
isOpen={showSelectCoverModal} isOpen={showSelectCoverModal}
onClose={() => { onClose={() => {
this.setState({ showSelectCoverModal: false }) this.setState({ showSelectCoverModal: false });
}} }}
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
...@@ -734,14 +734,14 @@ class AddVideoCourse extends React.Component { ...@@ -734,14 +734,14 @@ class AddVideoCourse extends React.Component {
maskClosable={false} maskClosable={false}
closeIcon={<span className='icon iconfont modal-close-icon'>&#xe6ef;</span>} closeIcon={<span className='icon iconfont modal-close-icon'>&#xe6ef;</span>}
onCancel={() => { onCancel={() => {
this.setState({ visible: false }) this.setState({ visible: false });
}} }}
zIndex={10001} zIndex={10001}
footer={[ footer={[
<Button <Button
key='back' key='back'
onClick={() => { onClick={() => {
this.setState({ visible: false }) this.setState({ visible: false });
}}> }}>
重新上传 重新上传
</Button>, </Button>,
...@@ -751,13 +751,13 @@ class AddVideoCourse extends React.Component { ...@@ -751,13 +751,13 @@ class AddVideoCourse extends React.Component {
disabled={!hasImgReady} disabled={!hasImgReady}
onClick={() => { onClick={() => {
if (!cutFlag) { if (!cutFlag) {
cutFlag = true cutFlag = true;
this.refs.hiddenBtn.click() this.refs.hiddenBtn.click();
} }
this.getSignature(cutImageBlob) this.getSignature(cutImageBlob);
}}> }}>
确定 确定
</Button> </Button>,
]}> ]}>
<div className='clip-box'> <div className='clip-box'>
<div <div
...@@ -766,7 +766,7 @@ class AddVideoCourse extends React.Component { ...@@ -766,7 +766,7 @@ class AddVideoCourse extends React.Component {
style={{ style={{
width: '500px', width: '500px',
height: '430px', height: '430px',
marginBottom: 0 marginBottom: 0,
}}></div> }}></div>
<div id='clipBtn' style={{ display: 'none' }} ref='hiddenBtn'></div> <div id='clipBtn' style={{ display: 'none' }} ref='hiddenBtn'></div>
<div className='preview-img'> <div className='preview-img'>
...@@ -784,8 +784,8 @@ class AddVideoCourse extends React.Component { ...@@ -784,8 +784,8 @@ class AddVideoCourse extends React.Component {
</Modal> </Modal>
{this.state.previewCourseModal} {this.state.previewCourseModal}
</div> </div>
) );
} }
} }
export default AddVideoCourse export default AddVideoCourse;
...@@ -450,7 +450,7 @@ class VideoCourseList extends React.Component { ...@@ -450,7 +450,7 @@ class VideoCourseList extends React.Component {
}, },
() => { () => {
this.props.onChange(); this.props.onChange();
}, }
); );
}; };
render() { render() {
......
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
background: #fff; background: #fff;
width: ~'calc(50% - 8px)'; width: ~'calc(50% - 8px)';
padding: 16px; padding: 16px;
overflow: hidden;
.study-title { .study-title {
font-size: 14px; font-size: 14px;
color: #333; color: #333;
......
...@@ -2,207 +2,207 @@ ...@@ -2,207 +2,207 @@
* @Description: * @Description:
* @Author: zangsuyun * @Author: zangsuyun
* @Date: 2021-03-12 14:49:40 * @Date: 2021-03-12 14:49:40
* @LastEditors: fusanqiasng * @LastEditors: wufan
* @LastEditTime: 2021-05-30 18:36:45 * @LastEditTime: 2021-05-30 20:37:42
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from "react" import React from 'react';
import { Table, Modal, message, Tooltip, Switch, Dropdown, Button } from "antd" import { Table, Modal, message, Tooltip, Switch, Dropdown, Button } from 'antd';
import { Route, withRouter } from "react-router-dom" import { Route, withRouter } from 'react-router-dom';
import { PageControl } from "@/components" import { PageControl } from '@/components';
import { LIVE_SHARE_MAP } from "@/common/constants/academic/cloudClass" import { LIVE_SHARE_MAP } from '@/common/constants/academic/cloudClass';
import { appId, shareUrl, LIVE_SHARE } from "@/domains/course-domain/constants" import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants';
import ScanFileModal from "../../resource-disk/modal/ScanFileModal" import ScanFileModal from '../../resource-disk/modal/ScanFileModal';
import WatchData from "./WatchData" import WatchData from './WatchData';
import KnowledgeAPI from "@/data-source/knowledge/request-api" import KnowledgeAPI from '@/data-source/knowledge/request-api';
import ENUM from "../ENUM.js" import ENUM from '../ENUM.js';
import "./KnowledgeBaseList.less" import './KnowledgeBaseList.less';
const DEFAULT_SIZE_UNIT = 1000 * 1000 // 将B转换成M const DEFAULT_SIZE_UNIT = 1000 * 1000; // 将B转换成M
const { confirm } = Modal const { confirm } = Modal;
const ENV = process.env.DEPLOY_ENV || "dev" const ENV = process.env.DEPLOY_ENV || 'dev';
class KnowledgeBaseList extends React.Component { class KnowledgeBaseList extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props);
this.state = { this.state = {
id: "", id: '',
scanFileModal: null scanFileModal: null,
} };
} }
handleAdminName = (adminArray) => { handleAdminName = (adminArray) => {
let adminStr = "" let adminStr = '';
adminArray.map((item, index) => { adminArray.map((item, index) => {
if (index < adminArray.length - 1) { if (index < adminArray.length - 1) {
adminStr = adminStr + item.adminName + "、" adminStr = adminStr + item.adminName + '、';
} else { } else {
adminStr = adminStr + item.adminName adminStr = adminStr + item.adminName;
}
})
return adminStr
} }
});
return adminStr;
};
handleUp = (index, record) => { handleUp = (index, record) => {
if (index === 0 && this.props.query.current === 1) { if (index === 0 && this.props.query.current === 1) {
return return;
} }
const params = { const params = {
direction: "UP", direction: 'UP',
id: record.id, id: record.id,
storeId: record.storeId storeId: record.storeId,
} };
KnowledgeAPI.moveKnowledge(params).then((res) => { KnowledgeAPI.moveKnowledge(params).then((res) => {
if (res.success) { if (res.success) {
message.success("更新成功") message.success('更新成功');
this.props.onChange() this.props.onChange();
}
})
} }
});
};
handleDown = (record, index) => { handleDown = (record, index) => {
const { query, totalCount } = this.props const { query, totalCount } = this.props;
const { current, size } = query const { current, size } = query;
if (totalCount === size * (current - 1) + index + 1) { if (totalCount === size * (current - 1) + index + 1) {
return return;
} }
const params = { const params = {
direction: "DOWN", direction: 'DOWN',
id: record.id, id: record.id,
storeId: record.storeId storeId: record.storeId,
} };
KnowledgeAPI.moveKnowledge(params).then((res) => { KnowledgeAPI.moveKnowledge(params).then((res) => {
if (res.success) { if (res.success) {
message.success("更新成功") message.success('更新成功');
this.props.onChange() this.props.onChange();
}
})
} }
});
};
getBlob = (url) => { getBlob = (url) => {
return new Promise((resolve) => { return new Promise((resolve) => {
const xhr = new XMLHttpRequest() const xhr = new XMLHttpRequest();
xhr.open("GET", url, true) xhr.open('GET', url, true);
xhr.responseType = "blob" xhr.responseType = 'blob';
xhr.onload = () => { xhr.onload = () => {
if (xhr.status === 200) { if (xhr.status === 200) {
resolve(xhr.response) resolve(xhr.response);
}
}
xhr.send()
})
} }
};
xhr.send();
});
};
saveAs = (blob, filename) => { saveAs = (blob, filename) => {
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename) navigator.msSaveBlob(blob, filename);
} else { } else {
const link = document.createElement("a") const link = document.createElement('a');
const body = document.querySelector("body") const body = document.querySelector('body');
// 创建对象url // 创建对象url
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob);
link.download = filename link.download = filename;
body.appendChild(link) body.appendChild(link);
link.click() link.click();
body.removeChild(link) body.removeChild(link);
// 通过调用 URL.createObjectURL() 创建的 URL 对象 // 通过调用 URL.createObjectURL() 创建的 URL 对象
window.URL.revokeObjectURL(link.href) window.URL.revokeObjectURL(link.href);
}
} }
};
// 下载文件 // 下载文件
handleDownload = (folder) => { handleDownload = (folder) => {
this.getBlob(folder.ossUrl).then((blob) => { this.getBlob(folder.ossUrl).then((blob) => {
this.saveAs(blob, folder.folderName) this.saveAs(blob, folder.folderName);
}) });
} };
// 预览文件 // 预览文件
handleScanFile = (folder) => { handleScanFile = (folder) => {
console.log(folder) console.log(folder);
const { folderFormat, folderSize, ossUrl } = folder const { folderFormat, folderSize, ossUrl } = folder;
switch (folderFormat) { switch (folderFormat) {
case "PDF": case 'PDF':
window.open(ossUrl, "_blank") window.open(ossUrl, '_blank');
break break;
case "WORD": case 'WORD':
case "DOCX": case 'DOCX':
case "DOC": case 'DOC':
case "EXCEL": case 'EXCEL':
case "PPT": case 'PPT':
case "PPTX": case 'PPTX':
case "PDF": case 'PDF':
if ( if (
((folderFormat === "PPT" || folderFormat === "PPTX" || folderFormat === "DOCX" || folderFormat === "WORD" || folderFormat === "DOC") && ((folderFormat === 'PPT' || folderFormat === 'PPTX' || folderFormat === 'DOCX' || folderFormat === 'WORD' || folderFormat === 'DOC') &&
folderSize > 10 * DEFAULT_SIZE_UNIT) || folderSize > 10 * DEFAULT_SIZE_UNIT) ||
(folderFormat === "EXCEL" && folderSize > 5 * DEFAULT_SIZE_UNIT) (folderFormat === 'EXCEL' && folderSize > 5 * DEFAULT_SIZE_UNIT)
) { ) {
Modal.confirm({ Modal.confirm({
title: "抱歉,不能在线预览", title: '抱歉,不能在线预览',
content: "由于文件较大,不支持在线预览,请下载后再查看", content: '由于文件较大,不支持在线预览,请下载后再查看',
// icon: <Icon type="question-circle" theme="filled" style={{ color: '#FF8534' }}></Icon>, // icon: <Icon type="question-circle" theme="filled" style={{ color: '#FF8534' }}></Icon>,
cancelText: "取消", cancelText: '取消',
okText: "下载", okText: '下载',
onOk: () => { onOk: () => {
this.handleDownload(folder) this.handleDownload(folder);
} },
}) });
break break;
} }
const prefixUrl = "https://view.officeapps.live.com/op/view.aspx?src=" const prefixUrl = 'https://view.officeapps.live.com/op/view.aspx?src=';
const scanUrl = `${prefixUrl}${encodeURIComponent(ossUrl)}` const scanUrl = `${prefixUrl}${encodeURIComponent(ossUrl)}`;
window.open(scanUrl, "_blank") window.open(scanUrl, '_blank');
break break;
default: default:
const scanFileModal = ( const scanFileModal = (
<ScanFileModal <ScanFileModal
fileType={folderFormat} fileType={folderFormat}
item={folder} item={folder}
close={() => { close={() => {
this.setState({ scanFileModal: null }) this.setState({ scanFileModal: null });
}} }}
/> />
) );
this.setState({ scanFileModal }) this.setState({ scanFileModal });
break break;
}
} }
};
// 请求表头 // 请求表头
parseColumns = () => { parseColumns = () => {
const { query, totalCount } = this.props const { query, totalCount } = this.props;
const { current, size } = query const { current, size } = query;
const columns = [ const columns = [
{ {
title: "课程名称", title: '课程名称',
key: "name", key: 'name',
dataIndex: "name", dataIndex: 'name',
width: 391, width: 391,
fixed: "left", fixed: 'left',
render: (val, record) => { render: (val, record) => {
const { coverUrl, mediaCourseUrl, courseDivision } = record.source const { coverUrl, mediaCourseUrl, courseDivision } = record.source;
let hasCover = false let hasCover = false;
const type = record.type const type = record.type;
return ( return (
<div> <div>
{type === "LIVE" && ( {type === 'LIVE' && (
<div className='record__item'> <div className='record__item'>
{record.source && {record.source &&
record.source.courseMediaVOS.map((item, index) => { record.source.courseMediaVOS.map((item, index) => {
if (item.contentType === "COVER") { if (item.contentType === 'COVER') {
hasCover = true hasCover = true;
return <img className='course-cover' key={index} src={item.mediaUrl} /> return <img className='course-cover' key={index} src={item.mediaUrl} />;
} }
})} })}
{!hasCover && <img className='course-cover' src={"https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png"} />} {!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/Yip2YtFDwH.png'} />}
<div> <div>
{val.length > 17 ? ( {val.length > 17 ? (
<Tooltip title={val}> <Tooltip title={val}>
...@@ -213,13 +213,13 @@ class KnowledgeBaseList extends React.Component { ...@@ -213,13 +213,13 @@ class KnowledgeBaseList extends React.Component {
)} )}
<div> <div>
<span className='course-time'> <span className='course-time'>
{formatDate("YYYY-MM-DD H:i", parseInt(record.source.startTime))}~{formatDate("H:i", parseInt(record.source.endTime))} {formatDate('YYYY-MM-DD H:i', parseInt(record.source.startTime))}~{formatDate('H:i', parseInt(record.source.endTime))}
</span> </span>
<span <span
className='course-status' className='course-status'
style={{ style={{
color: ENUM.courseStateShow[record.source.courseState].color, color: ENUM.courseStateShow[record.source.courseState].color,
border: `1px solid ${ENUM.courseStateShow[record.source.courseState].color}` border: `1px solid ${ENUM.courseStateShow[record.source.courseState].color}`,
}}> }}>
{ENUM.courseStateShow[record.source.courseState].title} {ENUM.courseStateShow[record.source.courseState].title}
</span> </span>
...@@ -228,10 +228,10 @@ class KnowledgeBaseList extends React.Component { ...@@ -228,10 +228,10 @@ class KnowledgeBaseList extends React.Component {
<i <i
className='icon iconfont' className='icon iconfont'
style={{ style={{
marginLeft: "5px", marginLeft: '5px',
cursor: "pointer", cursor: 'pointer',
color: "#FF4F4F", color: '#FF4F4F',
fontSize: "14px" fontSize: '14px',
}}> }}>
&#xe61d; &#xe61d;
</i> </i>
...@@ -257,9 +257,9 @@ class KnowledgeBaseList extends React.Component { ...@@ -257,9 +257,9 @@ class KnowledgeBaseList extends React.Component {
{record.source.admins.map((item, index) => { {record.source.admins.map((item, index) => {
return ( return (
<span> <span>
{item.adminName} {index < record.source.admins.length - 1 && <span></span>}{" "} {item.adminName} {index < record.source.admins.length - 1 && <span></span>}{' '}
</span> </span>
) );
})} })}
</span> </span>
</Tooltip> </Tooltip>
...@@ -269,9 +269,9 @@ class KnowledgeBaseList extends React.Component { ...@@ -269,9 +269,9 @@ class KnowledgeBaseList extends React.Component {
{record.source.admins.map((item, index) => { {record.source.admins.map((item, index) => {
return ( return (
<span key={index}> <span key={index}>
{item.adminName} {index < record.source.admins.length - 1 && <span></span>}{" "} {item.adminName} {index < record.source.admins.length - 1 && <span></span>}{' '}
</span> </span>
) );
})} })}
</span> </span>
)} )}
...@@ -282,7 +282,7 @@ class KnowledgeBaseList extends React.Component { ...@@ -282,7 +282,7 @@ class KnowledgeBaseList extends React.Component {
</div> </div>
)} )}
{type === "VOICE" && ( {type === 'VOICE' && (
<div className='record__item'> <div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
<img <img
...@@ -290,9 +290,9 @@ class KnowledgeBaseList extends React.Component { ...@@ -290,9 +290,9 @@ class KnowledgeBaseList extends React.Component {
src={ src={
coverUrl coverUrl
? coverUrl ? coverUrl
: courseDivision !== "EXTERNAL" : courseDivision !== 'EXTERNAL'
? `${mediaCourseUrl}?x-oss-process=video/snapshot,t_0,m_fast` ? `${mediaCourseUrl}?x-oss-process=video/snapshot,t_0,m_fast`
: "https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png" : 'https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png'
} }
alt='' alt=''
/> />
...@@ -306,9 +306,9 @@ class KnowledgeBaseList extends React.Component { ...@@ -306,9 +306,9 @@ class KnowledgeBaseList extends React.Component {
</div> </div>
)} )}
{type === "PICTURE" && ( {type === 'PICTURE' && (
<div className='record__item'> <div className='record__item'>
<img className='course-cover' src={coverUrl || "https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png"} /> <img className='course-cover' src={coverUrl || 'https://image.xiaomaiketang.com/xm/wFnpZtp2yB.png'} />
{val.length > 25 ? ( {val.length > 25 ? (
<Tooltip title={val}> <Tooltip title={val}>
<div className='course-name clamp'>{val}</div> <div className='course-name clamp'>{val}</div>
...@@ -319,11 +319,11 @@ class KnowledgeBaseList extends React.Component { ...@@ -319,11 +319,11 @@ class KnowledgeBaseList extends React.Component {
</div> </div>
)} )}
{type === "FOLDER" && ( {type === 'FOLDER' && (
<div <div
className='record__item' className='record__item'
onClick={() => { onClick={() => {
this.handleScanFile(record.source) this.handleScanFile(record.source);
}}> }}>
<div className={`folder-type ${record.source && record.source.folderFormat}`} /> <div className={`folder-type ${record.source && record.source.folderFormat}`} />
{val.length > 25 ? ( {val.length > 25 ? (
...@@ -336,24 +336,24 @@ class KnowledgeBaseList extends React.Component { ...@@ -336,24 +336,24 @@ class KnowledgeBaseList extends React.Component {
</div> </div>
)} )}
</div> </div>
) );
} },
}, },
{ {
title: "课程类型", title: '课程类型',
key: "type", key: 'type',
dataIndex: "type", dataIndex: 'type',
align: "center", align: 'center',
// width: 100, // width: 100,
render: (val, record) => { render: (val, record) => {
return <div className=''>{val ? ENUM.CourseTypeEnum[val] : "-"}</div> return <div className=''>{val ? ENUM.CourseTypeEnum[val] : '-'}</div>;
} },
}, },
{ {
title: "创建人", title: '创建人',
key: "createName", key: 'createName',
dataIndex: "createName", dataIndex: 'createName',
align: "center", align: 'center',
render: (val) => { render: (val) => {
return ( return (
<div> <div>
...@@ -363,37 +363,37 @@ class KnowledgeBaseList extends React.Component { ...@@ -363,37 +363,37 @@ class KnowledgeBaseList extends React.Component {
</Tooltip> </Tooltip>
)} )}
</div> </div>
) );
} },
}, },
{ {
title: "观看学员数", title: '观看学员数',
key: "watchUserCount", key: 'watchUserCount',
dataIndex: "watchUserCount", dataIndex: 'watchUserCount',
align: "right", align: 'right',
render: (val, item) => { render: (val, item) => {
return val ? ( return val ? (
<div className='operate' style={{ display: "block" }} onClick={() => this.handleLinkToClassData(item)}> <div className='operate' style={{ display: 'block' }} onClick={() => this.handleLinkToClassData(item)}>
<span className='operate__item'>{val}</span> <span className='operate__item'>{val}</span>
</div> </div>
) : ( ) : (
0 0
) );
} },
}, },
{ {
title: "", title: '',
width: 48 width: 48,
}, },
{ {
title: "操作", title: '操作',
key: "operate", key: 'operate',
dataIndex: "operate", dataIndex: 'operate',
width: 160, width: 160,
fixed: "right", fixed: 'right',
render: (val, record, index) => { render: (val, record, index) => {
console.log(this.props.categoryId) console.log(this.props.categoryId);
return this.props.categoryId === "0" ? ( return this.props.categoryId === '0' ? (
<div className='operate'> <div className='operate'>
<div className='operate__item' onClick={() => this.handleDelete(record)}> <div className='operate__item' onClick={() => this.handleDelete(record)}>
移出 移出
...@@ -401,12 +401,12 @@ class KnowledgeBaseList extends React.Component { ...@@ -401,12 +401,12 @@ class KnowledgeBaseList extends React.Component {
</div> </div>
) : ( ) : (
<div className='operate'> <div className='operate'>
<div className={index === 0 && current === 1 ? "operate__item disable" : "operate__item"} onClick={() => this.handleUp(index, record)}> <div className={index === 0 && current === 1 ? 'operate__item disable' : 'operate__item'} onClick={() => this.handleUp(index, record)}>
上移 上移
</div> </div>
<span className='operate__item split'> | </span> <span className='operate__item split'> | </span>
<div <div
className={totalCount === size * (current - 1) + index + 1 ? "operate__item disable" : "operate__item"} className={totalCount === size * (current - 1) + index + 1 ? 'operate__item disable' : 'operate__item'}
onClick={() => this.handleDown(record, index)}> onClick={() => this.handleDown(record, index)}>
下移 下移
</div> </div>
...@@ -415,66 +415,66 @@ class KnowledgeBaseList extends React.Component { ...@@ -415,66 +415,66 @@ class KnowledgeBaseList extends React.Component {
移出 移出
</div> </div>
</div> </div>
) );
} },
} },
] ];
return columns return columns;
} };
handleDelete = (record) => { handleDelete = (record) => {
return confirm({ return confirm({
title: "移出知识", title: '移出知识',
content: "确定将分类中此知识移出吗?", content: '确定将分类中此知识移出吗?',
icon: <span className='icon iconfont default-confirm-icon'>&#xe839; </span>, icon: <span className='icon iconfont default-confirm-icon'>&#xe839; </span>,
okText: "删除", okText: '删除',
okType: "danger", okType: 'danger',
cancelText: "取消", cancelText: '取消',
width: 440, width: 440,
height: 188, height: 188,
onOk: () => { onOk: () => {
this.deleteConfirm(record) this.deleteConfirm(record);
} },
}) });
} };
// 前往上课数据页面 // 前往上课数据页面
handleLinkToClassData = (item) => { handleLinkToClassData = (item) => {
const { match } = this.props const { match } = this.props;
console.log(item) console.log(item);
localStorage.setItem("WatchData_CourseName", item.name) localStorage.setItem('WatchData_CourseName', item.name);
window.RCHistory.push({ window.RCHistory.push({
// pathname: `${match.url}/course-data?type=${item.courseType}&id=${item.liveCourseId}`, // pathname: `${match.url}/course-data?type=${item.courseType}&id=${item.liveCourseId}`,
pathname: `${match.url}/course-data?type=${item.type}&id=${item.id}` pathname: `${match.url}/course-data?type=${item.type}&id=${item.id}`,
}) });
} };
deleteConfirm = (item) => { deleteConfirm = (item) => {
const params = { const params = {
id: item.id, id: item.id,
storeId: item.storeId storeId: item.storeId,
} };
KnowledgeAPI.delKnowledge(params).then((res) => { KnowledgeAPI.delKnowledge(params).then((res) => {
if (res.success) { if (res.success) {
message.success("移出成功") message.success('移出成功');
this.props.onChange() this.props.onChange();
this.props.updateCategoryTree() this.props.updateCategoryTree();
}
})
} }
});
};
onShowSizeChange = (current, size) => { onShowSizeChange = (current, size) => {
if (current == size) { if (current == size) {
return return;
}
let _query = this.props.query
_query.size = size
this.props.onChange(_query)
} }
let _query = this.props.query;
_query.size = size;
this.props.onChange(_query);
};
render() { render() {
const { dataSource = [], totalCount, query, match } = this.props const { dataSource = [], totalCount, query, match } = this.props;
const { current, size } = query const { current, size } = query;
return ( return (
<div className='knowledge-base-list'> <div className='knowledge-base-list'>
<Table <Table
...@@ -495,8 +495,8 @@ class KnowledgeBaseList extends React.Component { ...@@ -495,8 +495,8 @@ class KnowledgeBaseList extends React.Component {
pageSize={size} pageSize={size}
total={totalCount} total={totalCount}
toPage={(page) => { toPage={(page) => {
const _query = { ...query, current: page + 1 } const _query = { ...query, current: page + 1 };
this.props.onChange(_query) this.props.onChange(_query);
}} }}
onShowSizeChange={this.onShowSizeChange} onShowSizeChange={this.onShowSizeChange}
/> />
...@@ -507,8 +507,8 @@ class KnowledgeBaseList extends React.Component { ...@@ -507,8 +507,8 @@ class KnowledgeBaseList extends React.Component {
{this.state.scanFileModal} {this.state.scanFileModal}
</div> </div>
) );
} }
} }
export default withRouter(KnowledgeBaseList) export default withRouter(KnowledgeBaseList);
import React from 'react';
import React from 'react' import KnowledgeBaseFilter from './components/KnowledgeBaseFilter';
import KnowledgeBaseOpt from './components/KnowledgeBaseOpt';
import KnowledgeBaseList from './components/KnowledgeBaseList';
import Classification from './components/Classification';
import KnowledgeBaseFilter from './components/KnowledgeBaseFilter' import KnowledgeAPI from '@/data-source/knowledge/request-api';
import KnowledgeBaseOpt from './components/KnowledgeBaseOpt' import User from '@/common/js/user';
import KnowledgeBaseList from './components/KnowledgeBaseList'
import Classification from './components/Classification'
import KnowledgeAPI from '@/data-source/knowledge/request-api'
import User from '@/common/js/user'
export default class KnowledgeBase extends React.Component { export default class KnowledgeBase extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props);
this.state = { this.state = {
query: { query: {
size: 10, size: 10,
...@@ -23,51 +22,51 @@ export default class KnowledgeBase extends React.Component { ...@@ -23,51 +22,51 @@ export default class KnowledgeBase extends React.Component {
totalCount: 0, // 知识库数据总条数 totalCount: 0, // 知识库数据总条数
categoryId: '0', categoryId: '0',
updateCategoryFlag: false, updateCategoryFlag: false,
} };
} }
componentWillMount() { componentWillMount() {
// 获取知识库列表 // 获取知识库列表
this.handleFetchScheduleList() this.handleFetchScheduleList();
// this.getCategoryTree() // this.getCategoryTree()
} }
getSelectedCategoryId = (categoryId) => { getSelectedCategoryId = (categoryId) => {
this.setState({ this.setState({
categoryId, categoryId,
}) });
this.handleFetchScheduleList({ categoryId, current: 1 }) this.handleFetchScheduleList({ categoryId, current: 1 });
} };
// 更新分类树 // 更新分类树
updateCategoryTree = () => { updateCategoryTree = () => {
this.setState({ this.setState({
updateCategoryFlag: !this.state.updateCategoryFlag, updateCategoryFlag: !this.state.updateCategoryFlag,
}) });
} };
// 获取知识库列表 // 获取知识库列表
handleFetchScheduleList = (_query = {}, flag = true) => { handleFetchScheduleList = (_query = {}, flag = true) => {
const query = { const query = {
...this.state.query, ...this.state.query,
..._query, ..._query,
} };
// 更新请求参数 // 更新请求参数
this.setState({ query }) this.setState({ query });
flag && flag &&
KnowledgeAPI.queryPageKnowledgeForManager(query).then((res) => { KnowledgeAPI.queryPageKnowledgeForManager(query).then((res) => {
// KnowledgeAPI.videoSchedulePage(query).then((res) => { // KnowledgeAPI.videoSchedulePage(query).then((res) => {
const { result = {} } = res || {} const { result = {} } = res || {};
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
dataSource: records, dataSource: records,
totalCount: Number(total), totalCount: Number(total),
}) });
}) });
} };
render() { render() {
const { dataSource, totalCount, query, categoryId, updateCategoryFlag } = this.state const { dataSource, totalCount, query, categoryId, updateCategoryFlag } = this.state;
return ( return (
<div className='page'> <div className='page'>
<div className='content-header'>知识库</div> <div className='content-header'>知识库</div>
...@@ -77,11 +76,8 @@ export default class KnowledgeBase extends React.Component { ...@@ -77,11 +76,8 @@ export default class KnowledgeBase extends React.Component {
<div className='left' style={{ width: 245 }}> <div className='left' style={{ width: 245 }}>
<Classification updateCategoryFlag={updateCategoryFlag} categoryId={categoryId} getSelectedCategoryId={this.getSelectedCategoryId} /> <Classification updateCategoryFlag={updateCategoryFlag} categoryId={categoryId} getSelectedCategoryId={this.getSelectedCategoryId} />
</div> </div>
<div <div className='liner' style={{ backgroundColor: 'rgb(238, 238, 238)', width: 0.5, margin: '1px 16px 1px 2px' }}></div>
className="liner" <div className='right' style={{ width: 'calc(100% - 265px)' }}>
style={{ backgroundColor: "rgb(238, 238, 238)", width: 0.5, margin: "1px 16px 1px 2px" }}
></div>
<div className="right" style={{ width: "calc(100% - 265px)" }}>
<KnowledgeBaseFilter onChange={this.handleFetchScheduleList} /> <KnowledgeBaseFilter onChange={this.handleFetchScheduleList} />
{/* 操作模块 */} {/* 操作模块 */}
...@@ -101,6 +97,6 @@ export default class KnowledgeBase extends React.Component { ...@@ -101,6 +97,6 @@ export default class KnowledgeBase extends React.Component {
</div> </div>
</div> </div>
</div> </div>
) );
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: zangsuyun * @Author: zangsuyun
* @Date: 2021-03-13 09:54:26 * @Date: 2021-03-13 09:54:26
* @LastEditors: fusanqiasng * @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-31 18:23:28 * @LastEditTime: 2021-06-01 10:26:46
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -258,7 +258,7 @@ class AddCourse extends React.Component { ...@@ -258,7 +258,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchLiveList(); this.handleFetchLiveList();
}, }
); );
}; };
...@@ -272,7 +272,7 @@ class AddCourse extends React.Component { ...@@ -272,7 +272,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchVideoList(); this.handleFetchVideoList();
}, }
); );
}; };
...@@ -286,7 +286,7 @@ class AddCourse extends React.Component { ...@@ -286,7 +286,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchPictureList(); this.handleFetchPictureList();
}, }
); );
}; };
...@@ -593,7 +593,7 @@ class AddCourse extends React.Component { ...@@ -593,7 +593,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchVideoList(); this.handleFetchVideoList();
}, }
); );
}; };
...@@ -615,7 +615,7 @@ class AddCourse extends React.Component { ...@@ -615,7 +615,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchLiveList(); this.handleFetchLiveList();
}, }
); );
}; };
...@@ -629,7 +629,7 @@ class AddCourse extends React.Component { ...@@ -629,7 +629,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchPictureList(); this.handleFetchPictureList();
}, }
); );
}; };
handAddCourse = () => { handAddCourse = () => {
...@@ -696,7 +696,7 @@ class AddCourse extends React.Component { ...@@ -696,7 +696,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchVideoList(); this.handleFetchVideoList();
}, }
); );
}; };
...@@ -858,7 +858,7 @@ class AddCourse extends React.Component { ...@@ -858,7 +858,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchLiveList(); this.handleFetchLiveList();
}, }
); );
}} }}
onShowSizeChange={this.onShowLiveSizeChange} onShowSizeChange={this.onShowLiveSizeChange}
...@@ -893,6 +893,7 @@ class AddCourse extends React.Component { ...@@ -893,6 +893,7 @@ class AddCourse extends React.Component {
<TreeSelect <TreeSelect
treeNodeFilterProp='categoryName' treeNodeFilterProp='categoryName'
showSearch showSearch
value={videoQuery[videoCourseDivision].categoryId || null}
style={{ minWidth: 'calc(100% - 75px)' }} style={{ minWidth: 'calc(100% - 75px)' }}
value={videoQuery[videoCourseDivision].categoryId || null} value={videoQuery[videoCourseDivision].categoryId || null}
dropdownMatchSelectWidth={false} dropdownMatchSelectWidth={false}
...@@ -950,7 +951,7 @@ class AddCourse extends React.Component { ...@@ -950,7 +951,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchVideoList(); this.handleFetchVideoList();
}, }
); );
}} }}
onShowSizeChange={this.onShowVideoSizeChange} onShowSizeChange={this.onShowVideoSizeChange}
...@@ -1030,7 +1031,7 @@ class AddCourse extends React.Component { ...@@ -1030,7 +1031,7 @@ class AddCourse extends React.Component {
}, },
() => { () => {
this.handleFetchPictureList(); this.handleFetchPictureList();
}, }
); );
}} }}
onShowSizeChange={this.onShowPictureSizeChange} onShowSizeChange={this.onShowPictureSizeChange}
......
...@@ -71,13 +71,13 @@ ...@@ -71,13 +71,13 @@
} }
.courseware { .courseware {
font-size: 14px; font-size: 14px;
color: #2966FF; color: #2966ff;
line-height: 20px; line-height: 20px;
text-align: right; text-align: right;
cursor: pointer; cursor: pointer;
} }
.quota-icon { .quota-icon {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
} }
.operate { .operate {
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
.operate__item { .operate__item {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
&.split { &.split {
margin: 0 8px; margin: 0 8px;
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
} }
} }
.operate-text { .operate-text {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
} }
.course-start-end { .course-start-end {
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
.add-course-modal { .add-course-modal {
.ant-tabs-nav .ant-tabs-tab-active { .ant-tabs-nav .ant-tabs-tab-active {
// border: 1px solid #2966FF; // border: 1px solid #2966FF;
color: #2966FF; color: #2966ff;
} }
.ant-modal-content tr > td { .ant-modal-content tr > td {
padding: 12px 8px !important; padding: 12px 8px !important;
......
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:13:39 * @Date: 2021-02-20 16:13:39
* @LastEditors: wufan * @LastEditors: wufan
<<<<<<< HEAD
* @LastEditTime: 2021-05-30 17:40:39 * @LastEditTime: 2021-05-30 17:40:39
=======
* @LastEditTime: 2021-05-30 20:39:16
>>>>>>> hotfix/pangguoming/20210601/plan_list_add_cover
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
......
/* /*
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:45:51 * @Date: 2021-02-20 16:45:51
* @LastEditors: wufan * @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-13 16:36:26 * @LastEditTime: 2021-06-01 15:20:33
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react'; import React from 'react';
import { Button,Input,Switch,Radio,Row,Col,Modal,message,Tooltip} from 'antd'; import { Button, Input, Switch, Radio, Row, Col, Modal, message, Tooltip } from 'antd';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import SelectOperatorModal from '../modal/SelectOperatorModal'; import SelectOperatorModal from '../modal/SelectOperatorModal';
import { ImgCutModalNew } from '@/components';
import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal'; import SelectPrepareFileModal from '@/modules/prepare-lesson/modal/SelectPrepareFileModal';
import Upload from '@/core/upload'; import Upload from '@/core/upload';
// import PhotoClip from 'photoclip' // import PhotoClip from 'photoclip'
import './BasicInfo.less'; import './BasicInfo.less';
const { TextArea } = Input; const { TextArea } = Input;
const defaultCover = 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'; const defaultCover = 'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png';
let cutFlag = false; let cutFlag = false;
let timer = null class BasicInfo extends React.Component {
class BasicInfo extends React.Component{
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
operatorModalVisible: false, operatorModalVisible: false,
showSelectFileModal:false, showSelectFileModal: false,
cutImageBlob: null cutImageBlob: null,
}; };
} }
handleShowSelectOperatorModal = () => {
handleShowSelectOperatorModal = () =>{
this.setState({ this.setState({
operatorModalVisible:true operatorModalVisible: true,
}) });
} };
handleCloseSelectOperatorMOdal = ()=>{ handleCloseSelectOperatorMOdal = () => {
this.setState({ this.setState({
operatorModalVisible:false operatorModalVisible: false,
}) });
} };
handleConfirmSelectOperator = (selectOperatorList)=> { handleConfirmSelectOperator = (selectOperatorList) => {
if(selectOperatorList.length === 0){ if (selectOperatorList.length === 0) {
message.warning('请选择运营师') message.warning('请选择运营师');
return; return;
} }
this.props.onChange('selectOperatorList',selectOperatorList); this.props.onChange('selectOperatorList', selectOperatorList);
this.setState({ this.setState({
operatorModalVisible:false operatorModalVisible: false,
}) });
} };
enableStateChange = ()=> { enableStateChange = () => {
if(this.props.data.enableState==="NO"){ if (this.props.data.enableState === 'NO') {
this.props.onChange('enableState','YES') this.props.onChange('enableState', 'YES');
}else{ } else {
this.props.onChange('enableState','NO') this.props.onChange('enableState', 'NO');
}
} }
};
// 使用默认封面图 // 使用默认封面图
handleResetCoverUrl = ()=> { handleResetCoverUrl = () => {
const { data: { coverUrl } } = this.props; const {
data: { coverUrl },
} = this.props;
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover;
// 如果已经是默认图的话,不做任何任何处理 // 如果已经是默认图的话,不做任何任何处理
if (isDefaultCover) return; if (isDefaultCover) return;
message.success('已替换为默认图'); message.success('已替换为默认图');
this.props.onChange('coverUrl',defaultCover); this.props.onChange('coverUrl', defaultCover);
setTimeout(()=>{ setTimeout(() => {
this.props.onChange('coverId', null); this.props.onChange('coverId', null);
},1000) }, 1000);
} };
handleSelectCover = (file)=> { handleSelectCover = (file) => {
this.uploadImage(file); this.uploadImage(file);
} };
//上传图片 //上传图片
uploadImage = (imageFile) => { uploadImage = (imageFile) => {
const { folderName } = imageFile;
const fileName = window.random_string(16) + folderName.slice(folderName.lastIndexOf("."));
const self = this; const self = this;
this.setState( this.setState(
{ {
...@@ -87,57 +83,55 @@ class BasicInfo extends React.Component{ ...@@ -87,57 +83,55 @@ class BasicInfo extends React.Component{
}, },
() => { () => {
setTimeout(() => { setTimeout(() => {
const okBtnDom = document.querySelector("#headPicModal"); const okBtnDom = document.querySelector('#headPicModal');
const options = { const options = {
size: [500, 282], size: [500, 282],
ok: okBtnDom, ok: okBtnDom,
maxZoom: 3, maxZoom: 3,
style: { style: {
jpgFillColor: "transparent", jpgFillColor: 'transparent',
}, },
done: function (dataUrl) { done: function (dataUrl) {
clearTimeout(self.timer); clearTimeout(self.timer);
self.timer = setTimeout(() => { self.timer = setTimeout(() => {
if ((self.state.rotate != this.rotate()) || (self.state.scale != this.scale())) { if (self.state.rotate !== this.rotate() || self.state.scale !== this.scale()) {
console.log(this.scale(), 'scale') console.log(this.scale(), 'scale');
const _dataUrl = this.clip() const _dataUrl = this.clip();
const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl); const cutImageBlob = self.convertBase64UrlToBlob(_dataUrl);
self.setState({ self.setState({
cutImageBlob, cutImageBlob,
dataUrl: _dataUrl, dataUrl: _dataUrl,
rotate: this.rotate(), rotate: this.rotate(),
scale: this.scale() scale: this.scale(),
}) });
} }
}, 500);
}, 500)
const cutImageBlob = self.convertBase64UrlToBlob(dataUrl); const cutImageBlob = self.convertBase64UrlToBlob(dataUrl);
self.setState({ self.setState({
cutImageBlob, cutImageBlob,
dataUrl dataUrl,
}) });
setTimeout(() => { setTimeout(() => {
cutFlag = false; cutFlag = false;
}, 2000); }, 2000);
}, },
fail: (failInfo) => { fail: (failInfo) => {
message.error("图片上传失败了,请重新上传"); message.error('图片上传失败了,请重新上传');
}, },
loadComplete: function (img) { loadComplete: function (img) {
setTimeout(() => { setTimeout(() => {
const _dataUrl = this.clip() const _dataUrl = this.clip();
self.setState({ self.setState({
dataUrl: _dataUrl, dataUrl: _dataUrl,
hasImgReady: true hasImgReady: true,
}) });
}, 100) }, 100);
}, },
}; };
const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}` const imgUrl = `${imageFile.ossUrl}?${new Date().getTime()}`;
if (!this.state.photoclip) { if (!this.state.photoclip) {
const _photoclip = new PhotoClip("#headPicModal", options); const _photoclip = new PhotoClip('#headPicModal', options);
_photoclip.load(imgUrl); _photoclip.load(imgUrl);
this.setState({ this.setState({
photoclip: _photoclip, photoclip: _photoclip,
...@@ -146,7 +140,6 @@ class BasicInfo extends React.Component{ ...@@ -146,7 +140,6 @@ class BasicInfo extends React.Component{
this.state.photoclip.clear(); this.state.photoclip.clear();
this.state.photoclip.load(imgUrl); this.state.photoclip.load(imgUrl);
} }
}, 200); }, 200);
} }
); );
...@@ -154,251 +147,283 @@ class BasicInfo extends React.Component{ ...@@ -154,251 +147,283 @@ class BasicInfo extends React.Component{
//获取resourceId //获取resourceId
getSignature = (blob, fileName) => { getSignature = (blob, fileName) => {
Upload.uploadBlobToOSS(blob, 'cover' + (new Date()).valueOf(),null,'signInfo').then((signInfo) => { Upload.uploadBlobToOSS(blob, 'cover' + new Date().valueOf(), null, 'signInfo').then((signInfo) => {
this.setState({ this.setState(
coverClicpPath:signInfo.fileUrl, {
coverId:signInfo.resourceId, coverClicpPath: signInfo.fileUrl,
visible: false coverId: signInfo.resourceId,
},()=>this.updateCover()) visible: false,
},
() => this.updateCover()
);
}); });
}; };
updateCover = () =>{ updateCover = () => {
const {coverClicpPath,coverId} = this.state const { coverClicpPath, coverId } = this.state;
this.setState({ this.setState({
showSelectFileModal: false showSelectFileModal: false,
}) });
this.props.onChange('coverUrl', coverClicpPath); this.props.onChange('coverUrl', coverClicpPath);
setTimeout(()=>{ setTimeout(() => {
this.props.onChange('coverId', coverId); this.props.onChange('coverId', coverId);
},1000) }, 1000);
} };
// base64转换成blob // base64转换成blob
convertBase64UrlToBlob = (urlData) => { convertBase64UrlToBlob = (urlData) => {
const bytes = window.atob(urlData.split(",")[1]); const bytes = window.atob(urlData.split(',')[1]);
const ab = new ArrayBuffer(bytes.length); const ab = new ArrayBuffer(bytes.length);
const ia = new Uint8Array(ab); const ia = new Uint8Array(ab);
for (let i = 0; i < bytes.length; i++) { for (let i = 0; i < bytes.length; i++) {
ia[i] = bytes.charCodeAt(i); ia[i] = bytes.charCodeAt(i);
} }
return new Blob([ab], { type: "image/png" }); return new Blob([ab], { type: 'image/png' });
}; };
limitNumber = value => { limitNumber = (value) => {
if (typeof value === 'string') { if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/^(0+)|[^\d]/g, '') : '' return !isNaN(Number(value)) ? value.replace(/^(0+)|[^\d]/g, '') : '';
} else if (typeof value === 'number') { } else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/^(0+)|[^\d]/g, '') : '' return !isNaN(value) ? String(value).replace(/^(0+)|[^\d]/g, '') : '';
} else { } else {
return '' return '';
}
} }
percentCompleteBlur = (e,field) =>{ };
percentCompleteBlur = (e, field) => {
let _percentCompleteLive; let _percentCompleteLive;
const { value } = e.target; const { value } = e.target;
if(value > 100){ if (value > 100) {
_percentCompleteLive = 100; _percentCompleteLive = 100;
}else{ } else {
if(value < 0){ if (value < 0) {
_percentCompleteLive = 0; _percentCompleteLive = 0;
}else{ } else {
_percentCompleteLive = value; _percentCompleteLive = value;
} }
} }
this.props.onChange(field,_percentCompleteLive) this.props.onChange(field, _percentCompleteLive);
} };
render(){ render() {
const { operatorModalVisible ,showSelectFileModal,visible,hasImgReady,cutImageBlob} = this.state; const { operatorModalVisible, showSelectFileModal, visible, hasImgReady, cutImageBlob } = this.state;
const { data} = this.props; const { data } = this.props;
const { planName,coverUrl,instro,enableState,operateType,selectOperatorList,percentCompleteLive,percentCompleteVideo,percentCompletePicture} = data; const { planName, coverUrl, instro, enableState, operateType, selectOperatorList, percentCompleteLive, percentCompleteVideo, percentCompletePicture } =
data;
// 当前是否使用的是默认图片 // 当前是否使用的是默认图片
const isDefaultCover = coverUrl === defaultCover; const isDefaultCover = coverUrl === defaultCover;
return ( return (
<div className="plan-basic-info"> <div className='plan-basic-info'>
<div className="plan-name"> <div className='plan-name'>
<span className="label"><span className="require">*</span>培训计划名称:</span> <span className='label'>
<span className='require'>*</span>培训计划名称:
</span>
<Input <Input
value={planName} value={planName}
placeholder="请输入培训计划名称(20字以内)" placeholder='请输入培训计划名称(20字以内)'
maxLength={20} maxLength={20}
style={{ width: 240 }} style={{ width: 240 }}
onChange={(e)=>this.props.onChange('planName', e.target.value)} onChange={(e) => this.props.onChange('planName', e.target.value)}
/> />
</div> </div>
<div className="cover"> <div className='cover'>
<span className="label">封面图:</span> <span className='label'>封面图:</span>
<div className="cover__wrap"> <div className='cover__wrap'>
<div className="img-content"> <div className='img-content'>
{ isDefaultCover && {isDefaultCover && <span className='tag'>默认图</span>}
<span className="tag">默认图</span> <img src={coverUrl} width='690' alt='' />
}
<img src={coverUrl} width="690"/>
</div> </div>
<div className="opt-btns"> <div className='opt-btns'>
<Button onClick={() => { <Button
onClick={() => {
this.setState({ this.setState({
showSelectFileModal:true showSelectFileModal: true,
}) });
}}>上传图片</Button> }}>
<span 上传图片
className={`default-btn ${isDefaultCover ? 'disabled' : ''}`} </Button>
onClick={this.handleResetCoverUrl} <span className={`default-btn ${isDefaultCover ? 'disabled' : ''}`} onClick={this.handleResetCoverUrl}>
>使用默认图</span> 使用默认图
<div className="tips">建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。</div> </span>
<div className='tips'>建议尺寸1280*720px或16:9。封面图最大5M,支持jpg、jpeg和png。</div>
</div> </div>
</div> </div>
</div> </div>
<div className="introduction"> <div className='introduction'>
<span className="label">简介:</span> <span className='label'>简介:</span>
<TextArea <TextArea
placeholder="请输入培训计划简介" placeholder='请输入培训计划简介'
maxLength={200} maxLength={200}
style={{ width: '552px',height:'110px'}} style={{ width: '552px', height: '110px' }}
className="instro-textarea" className='instro-textarea'
value={instro} value={instro}
onChange={(e)=>this.props.onChange('instro', e.target.value)} onChange={(e) => this.props.onChange('instro', e.target.value)}
/> />
</div> </div>
<div className="wether-use"> <div className='wether-use'>
<span className="label">是否启用:</span> <span className='label'>是否启用:</span>
<div className="content"> <div className='content'>
<div> <div>
<Switch checked={enableState==="YES"? true:false} onChange={()=> {this.enableStateChange()}}/> <Switch
checked={enableState === 'YES' ? true : false}
onChange={() => {
this.enableStateChange();
}}
/>
</div> </div>
<div> <div>
<div className="instro-text"> <div className='instro-text'>
<div>开启:此培训计划可以分享给学员进行学习</div> <div>开启:此培训计划可以分享给学员进行学习</div>
<div>关闭:此培训计划暂不可分享给学员进行学习,后续可开启</div> <div>关闭:此培训计划暂不可分享给学员进行学习,后续可开启</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className="view-range" > <div className='view-range'>
<span className="label"> <span className='label'>
<span className="require">*</span> <span className='require'>*</span>
可见范围 可见范围
<Tooltip <Tooltip title='学院管理员、管理员默认都可见'>
title="学院管理员、管理员默认都可见"> <span className='iconfont'>&#xe61d;</span>
<span className="iconfont">&#xe61d;</span> </Tooltip>
</Tooltip></span>
<div className="content"> </span>
<Radio.Group value={operateType} onChange={(e) => { this.props.onChange('operateType', e.target.value) }}> <div className='content'>
<Radio.Group
value={operateType}
onChange={(e) => {
this.props.onChange('operateType', e.target.value);
}}>
<Row style={{ marginBottom: '5px' }}> <Row style={{ marginBottom: '5px' }}>
<Col span={24}> <Col span={24}>
<Radio value="All_Operate"> <Radio value='All_Operate'>
所有运营师 所有运营师
<span className="playback__text">后续新增的运营师都有权限可见</span> <span className='playback__text'>后续新增的运营师都有权限可见</span>
</Radio> </Radio>
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col span={24}> <Col span={24}>
<Radio value="Assign_Operate"> <Radio value='Assign_Operate'>
指定运营师 指定运营师
<span className="playback__text">仅被选择的运营师有权限可见</span> <span className='playback__text'>仅被选择的运营师有权限可见</span>
</Radio> </Radio>
</Col> </Col>
</Row> </Row>
</Radio.Group> </Radio.Group>
{operateType==="Assign_Operate" && {operateType === 'Assign_Operate' && (
<div className="choose-business"> <div className='choose-business'>
<Button onClick={()=>{this.handleShowSelectOperatorModal()}}>选择运营师</Button> <Button
<span>已选择<span>{selectOperatorList.length}</span>名运营师</span> onClick={() => {
this.handleShowSelectOperatorModal();
}}>
选择运营师
</Button>
<span>
已选择<span>{selectOperatorList.length}</span>名运营师
</span>
</div> </div>
} )}
</div> </div>
</div> </div>
<div className="done-standard"> <div className='done-standard'>
<span className="label standard-label"><span className="require">*</span>完成标准:</span> <span className='label standard-label'>
<span className='require'>*</span>完成标准:
</span>
<div> <div>
<div className="live-standard-info"> <div className='live-standard-info'>
<span className="icon iconfont">&#xe865;</span> <span className='icon iconfont'>&#xe865;</span>
<span className="instro">直播课单个课程,学员学习进度达到 <span className='instro'>
直播课单个课程,学员学习进度达到
<Input <Input
width="40" width='40'
value={percentCompleteLive} value={percentCompleteLive}
onChange={(e) => { this.props.onChange('percentCompleteLive', e.target.value.replace(/\D/g,'')) }} onChange={(e) => {
onBlur={(e)=>this.percentCompleteBlur(e,'percentCompleteLive')} this.props.onChange('percentCompleteLive', e.target.value.replace(/\D/g, ''));
className="input-box" }}
/>%,即视为"已完成"学习 onBlur={(e) => this.percentCompleteBlur(e, 'percentCompleteLive')}
className='input-box'
/>
%,即视为"已完成"学习
</span> </span>
</div> </div>
<div className="live-standard-info"> <div className='live-standard-info'>
<span className="icon iconfont">&#xe864;</span> <span className='icon iconfont'>&#xe864;</span>
<span className="instro">视频课单个课程,学员学习进度达到 <span className='instro'>
视频课单个课程,学员学习进度达到
<Input <Input
width="40" width='40'
value={percentCompleteVideo} value={percentCompleteVideo}
onChange={(e) => { this.props.onChange('percentCompleteVideo', e.target.value.replace(/\D/g,'')) }} onChange={(e) => {
onBlur={(e)=>this.percentCompleteBlur(e,'percentCompleteVideo')} this.props.onChange('percentCompleteVideo', e.target.value.replace(/\D/g, ''));
className="input-box" }}
onBlur={(e) => this.percentCompleteBlur(e, 'percentCompleteVideo')}
className='input-box'
/> />
%,即视为"已完成"学习 %,即视为"已完成"学习
</span> </span>
</div> </div>
<div className="live-standard-info"> <div className='live-standard-info'>
<span className="icon iconfont">&#xe601;</span> <span className='icon iconfont'>&#xe601;</span>
<span className="instro">图文课单个课程,学员学习进度达到 <span className='instro'>
图文课单个课程,学员学习进度达到
<Input <Input
width="40" width='40'
value={percentCompletePicture} value={percentCompletePicture}
onChange={(e) => { this.props.onChange('percentCompletePicture', e.target.value.replace(/\D/g,'')) }} onChange={(e) => {
onBlur={(e)=>this.percentCompleteBlur(e,'percentCompletePicture')} this.props.onChange('percentCompletePicture', e.target.value.replace(/\D/g, ''));
className="input-box" }}
onBlur={(e) => this.percentCompleteBlur(e, 'percentCompletePicture')}
className='input-box'
/> />
%,即视为"已完成"学习 %,即视为"已完成"学习
</span> </span>
</div> </div>
</div> </div>
</div> </div>
{ operatorModalVisible && {operatorModalVisible && (
<SelectOperatorModal <SelectOperatorModal
visible={operatorModalVisible} visible={operatorModalVisible}
onClose={this.handleCloseSelectOperatorMOdal} onClose={this.handleCloseSelectOperatorMOdal}
selectOperatorList={selectOperatorList} selectOperatorList={selectOperatorList}
onSelect={this.handleConfirmSelectOperator} onSelect={this.handleConfirmSelectOperator}
/> />
} )}
{showSelectFileModal && {showSelectFileModal && (
<SelectPrepareFileModal <SelectPrepareFileModal
key="basic" key='basic'
operateType="select" operateType='select'
multiple={false} multiple={false}
accept="image/jpeg,image/png,image/jpg" accept='image/jpeg,image/png,image/jpg'
selectTypeList={['JPG', 'JPEG', 'PNG']} selectTypeList={['JPG', 'JPEG', 'PNG']}
tooltip='支持文件类型:jpg、jpeg、png' tooltip='支持文件类型:jpg、jpeg、png'
isOpen={showSelectFileModal} isOpen={showSelectFileModal}
onClose={() => { onClose={() => {
this.setState({ this.setState({
showSelectFileModal:false showSelectFileModal: false,
}) });
}} }}
onSelect={this.handleSelectCover} onSelect={this.handleSelectCover}
/> />
} )}
<Modal <Modal
title="设置图片" title='设置图片'
width={1080} width={1080}
visible={visible} visible={visible}
maskClosable={false} maskClosable={false}
closeIcon={<span className="icon iconfont modal-close-icon">&#xe6ef;</span>} closeIcon={<span className='icon iconfont modal-close-icon'>&#xe6ef;</span>}
onCancel={() => { onCancel={() => {
this.setState({ visible: false }); this.setState({ visible: false });
}} }}
zIndex={10001} zIndex={10001}
footer={[ footer={[
<Button <Button
key="back" key='back'
onClick={() => { onClick={() => {
this.setState({ visible: false }); this.setState({ visible: false });
}} }}>
>
重新上传 重新上传
</Button>, </Button>,
<Button <Button
key="submit" key='submit'
type="primary" type='primary'
disabled={!hasImgReady} disabled={!hasImgReady}
onClick={() => { onClick={() => {
if (!cutFlag) { if (!cutFlag) {
...@@ -406,32 +431,29 @@ class BasicInfo extends React.Component{ ...@@ -406,32 +431,29 @@ class BasicInfo extends React.Component{
this.refs.hiddenBtn.click(); this.refs.hiddenBtn.click();
} }
this.getSignature(cutImageBlob); this.getSignature(cutImageBlob);
}} }}>
>
确定 确定
</Button>, </Button>,
]} ]}>
> <div className='clip-box'>
<div className="clip-box">
<div <div
id="headPicModal" id='headPicModal'
ref="headPicModal" ref='headPicModal'
style={{ style={{
width: "500px", width: '500px',
height: "430px", height: '430px',
marginBottom: 0, marginBottom: 0,
}} }}></div>
></div> <div id='clipBtn' style={{ display: 'none' }} ref='hiddenBtn'></div>
<div id="clipBtn" style={{ display: "none" }} ref="hiddenBtn"></div> <div className='preview-img'>
<div className="preview-img"> <div className='title'>效果预览</div>
<div className="title">效果预览</div> <div id='preview-url-box' style={{ width: 500, height: 282 }}>
<div id="preview-url-box" style={{width:500,height:282}}> <img src={this.state.dataUrl} style={{ width: '100%' }} alt='' />
<img src={this.state.dataUrl} style={{ width: '100%' }} alt="" />
</div> </div>
<div className="tip-box"> <div className='tip-box'>
<div className="tip">温馨提示</div> <div className='tip'>温馨提示</div>
<div className="tip">①预览效果图时可能存在延迟,单击左侧图片刷新即可</div> <div className='tip'>①预览效果图时可能存在延迟,单击左侧图片刷新即可</div>
<div className="tip">②设置图片时双击可旋转图片,滚动可放大或缩小图片</div> <div className='tip'>②设置图片时双击可旋转图片,滚动可放大或缩小图片</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -440,4 +462,4 @@ class BasicInfo extends React.Component{ ...@@ -440,4 +462,4 @@ class BasicInfo extends React.Component{
); );
} }
} }
export default withRouter(BasicInfo) export default withRouter(BasicInfo);
...@@ -134,6 +134,7 @@ class EmployeeShareData extends React.Component { ...@@ -134,6 +134,7 @@ class EmployeeShareData extends React.Component {
) )
} }
}, },
//产品暂时性隐藏
// { // {
// title: '手机号', // title: '手机号',
// key: 'storeUserPhone', // key: 'storeUserPhone',
......
/* /*
* @Author: zhangleyuan * @Author: zhangleyuan
* @Date: 2021-02-20 16:46:46 * @Date: 2021-02-20 16:46:46
* @LastEditors: wufan * @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-14 18:12:50 * @LastEditTime: 2021-06-01 11:45:34
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React, { useState, useRef, useEffect } from 'react'; import React, { useState } from 'react';
import { Table, Modal, message , Tooltip,Switch,Dropdown} from 'antd'; import { Table, Modal, message, Tooltip, Switch, Dropdown } from 'antd';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { PageControl } from "@/components"; import { PageControl } from '@/components';
import PlanService from "@/domains/plan-domain/planService"; import PlanService from '@/domains/plan-domain/planService';
import SharePlanModal from '../modal/SharePlanModal'; import SharePlanModal from '../modal/SharePlanModal';
import {LIVE_SHARE} from '@/domains/course-domain/constants'; import { LIVE_SHARE } from '@/domains/course-domain/constants';
import User from '@/common/js/user'; import User from '@/common/js/user';
import './PlanList.less'; import './PlanList.less';
const { confirm } = Modal; const { confirm } = Modal;
const userRole = User.getUserRole();
function PlanList(props) { function PlanList(props) {
const [sharePlanModal, setSharePlanModal] = useState(null); const [sharePlanModal, setSharePlanModal] = useState(null);
function parseColumns(){ function parseColumns() {
const columns = [ const columns = [
{ {
title: '培训计划', title: '培训计划',
key: 'planName', key: 'planName',
dataIndex: 'planName', dataIndex: 'planName',
width:'18%', width: '18%',
render: (val, record) => { render: (val, record) => {
return ( return (
<div className="plan-name"> <div className='plan_name_item'>
{val} <img className='plan-cover' src={record.coverUrl || 'https://image.xiaomaiketang.com/xm/rEAetaTEh3.png'} alt='' />
<Choose>
<When condition={record.planName.length > 25}>
<Tooltip title={record.planName}>
<div className='plan-name'>{val}</div>
</Tooltip>
</When>
<Otherwise>
<div className='plan-name'>{val}</div>
</Otherwise>
</Choose>
</div> </div>
) );
} },
}, },
{ {
title: '课程总数量', title: '课程总数量',
...@@ -43,21 +53,21 @@ function PlanList(props) { ...@@ -43,21 +53,21 @@ function PlanList(props) {
dataIndex: 'courseNum', dataIndex: 'courseNum',
width: 110, width: 110,
render: (val, record) => { render: (val, record) => {
return ( return <div className='course-number'>{val}</div>;
<div className="course-number"> },
{val}
</div>
)
}
}, },
{ {
title: '当前状态', title: '当前状态',
width: '10%', width: '10%',
dataIndex: "status", dataIndex: 'status',
render: (val, item, index) => { render: (val, item, index) => {
return ( return (
<Switch checked={item.enableState==="NO"?false:true} onChange={()=>changeEnableState(item)} disabled={(User.getUserRole() === "CloudManager" || User.getUserRole() === "StoreManager")?false:true}/> <Switch
) checked={item.enableState === 'NO' ? false : true}
onChange={() => changeEnableState(item)}
disabled={User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager' ? false : true}
/>
);
}, },
}, },
{ {
...@@ -66,46 +76,38 @@ function PlanList(props) { ...@@ -66,46 +76,38 @@ function PlanList(props) {
dataIndex: 'createName', dataIndex: 'createName',
width: '10%', width: '10%',
render: (val) => { render: (val) => {
return ( return <div className='create-name'>{val}</div>;
<div className="create-name"> },
{val}
</div>
)
}
}, },
{ {
title: '创建时间', title: '创建时间',
width: "12.5%", width: '12.5%',
key: 'created', key: 'created',
dataIndex: 'created', dataIndex: 'created',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return formatDate('YYYY-MM-DD H:i', val) return window.formatDate('YYYY-MM-DD H:i', val);
} },
}, },
{ {
title: '更新时间', title: '更新时间',
width: "10%", width: '10%',
key: 'updated', key: 'updated',
dataIndex: 'updated', dataIndex: 'updated',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return formatDate('YYYY-MM-DD H:i', val) return window.formatDate('YYYY-MM-DD H:i', val);
} },
}, },
{ {
title: '参培人数', title: '参培人数',
width:76, width: 76,
key: 'cultureCustomerNum', key: 'cultureCustomerNum',
dataIndex: 'cultureCustomerNum', dataIndex: 'cultureCustomerNum',
sorter: true, sorter: true,
render: (val) => { render: (val) => {
return ( return <div className='join-number'>{val}</div>;
<div className="join-number"> },
{val}
</div>
)
}
}, },
{ {
title: '操作', title: '操作',
...@@ -115,201 +117,221 @@ function PlanList(props) { ...@@ -115,201 +117,221 @@ function PlanList(props) {
width: 176, width: 176,
render: (val, record) => { render: (val, record) => {
return ( return (
<div className="operate"> <div className='operate'>
<div className="operate__item" onClick={()=>toLearningDataPage(record)}>学习数据</div> <div className='operate__item' onClick={() => toLearningDataPage(record)}>
{record.enableState==="YES" && 学习数据
</div>
{record.enableState === 'YES' && (
<> <>
<span className="operate__item split"> | </span> <span className='operate__item split'> | </span>
<div className="operate__item" onClick={() => {handleShowShareModal(record); }}>分享</div> <div
className='operate__item'
onClick={() => {
handleShowShareModal(record);
}}>
分享
</div>
</> </>
} )}
{(User.getUserRole() === "CloudManager" || User.getUserRole() === "StoreManager") && {(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') && (
<> <>
<span className="operate__item split"> | </span> <span className='operate__item split'> | </span>
<Dropdown overlay={renderMoreOperate(record)}> <Dropdown overlay={renderMoreOperate(record)}>
<span className="more-operate"> <span className='more-operate'>
<span className="operate-text">更多</span> <span className='operate-text'>更多</span>
<span <span className='iconfont icon' style={{ color: '#2966FF' }}>
className="iconfont icon"
style={{ color: "#2966FF" }}
>
&#xe824; &#xe824;
</span> </span>
</span> </span>
</Dropdown> </Dropdown>
</> </>
} )}
</div> </div>
) );
} },
} },
]; ];
return columns; return columns;
} }
function renderMoreOperate(item){ function renderMoreOperate(item) {
return ( return (
<div className="live-course-more-menu"> <div className='live-course-more-menu'>
<div className='operate__item' onClick={() => toEditPlanPage(item)}>
<div className="operate__item" 编辑
onClick={()=>toEditPlanPage(item)}
>编辑</div>
<div
className="operate__item" onClick={()=>handleDelete(item)}
>删除</div>
</div> </div>
) <div className='operate__item' onClick={() => handleDelete(item)}>
删除
</div>
</div>
);
} }
function handleChangeTable(pagination, filters, sorter){ function handleChangeTable(pagination, filters, sorter) {
const { columnKey, order } = sorter; const { columnKey, order } = sorter;
const { query } = props; const { query } = props;
let _columnKey; let _columnKey;
let _order; let _order;
// 按创建时间升序排序 // 按创建时间升序排序
if (columnKey === 'created' && order === 'ascend') {_columnKey="CREATED"; _order = 'SORT_ASC'; } if (columnKey === 'created' && order === 'ascend') {
_columnKey = 'CREATED';
_order = 'SORT_ASC';
}
// 按创建时间降序排序 // 按创建时间降序排序
if (columnKey === 'created' && order === 'descend') { _columnKey="CREATED"; _order = 'SORT_DESC';} if (columnKey === 'created' && order === 'descend') {
_columnKey = 'CREATED';
_order = 'SORT_DESC';
}
// 按更新时间升序排序 // 按更新时间升序排序
if (columnKey === 'updated' && order === 'ascend') { _columnKey="UPDATED"; _order = 'SORT_ASC'; } if (columnKey === 'updated' && order === 'ascend') {
_columnKey = 'UPDATED';
_order = 'SORT_ASC';
}
// 按更新时间降序排序 // 按更新时间降序排序
if (columnKey === 'updated' && order === 'descend') { _columnKey="UPDATED"; _order = 'SORT_DESC'; } if (columnKey === 'updated' && order === 'descend') {
_columnKey = 'UPDATED';
_order = 'SORT_DESC';
}
// 按更新时间升序排序 // 按更新时间升序排序
if (columnKey === 'cultureCustomerNum' && order === 'ascend') { _columnKey="CUSTOMER_NUM"; _order = 'SORT_ASC'; } if (columnKey === 'cultureCustomerNum' && order === 'ascend') {
_columnKey = 'CUSTOMER_NUM';
_order = 'SORT_ASC';
}
// 按更新时间降序排序 // 按更新时间降序排序
if (columnKey === 'cultureCustomerNum' && order === 'descend') { _columnKey="CUSTOMER_NUM"; _order = 'SORT_DESC'; } if (columnKey === 'cultureCustomerNum' && order === 'descend') {
_columnKey = 'CUSTOMER_NUM';
_order = 'SORT_DESC';
}
const _query = { const _query = {
...query, ...query,
sortMap:{} sortMap: {},
}; };
_query.sortMap[_columnKey]=_order; _query.sortMap[_columnKey] = _order;
props.onChange(_query); props.onChange(_query);
} }
// 显示分享弹窗 // 显示分享弹窗
function handleShowShareModal(item) { function handleShowShareModal(item) {
const htmlUrl = `${LIVE_SHARE}training_plan_detail/${item.planId}?id=${User.getStoreId()}&storeUserId=${User.getStoreUserId()}`; const htmlUrl = `${LIVE_SHARE}training_plan_detail/${item.planId}?id=${User.getStoreId()}&storeUserId=${User.getStoreUserId()}`;
const longUrl = htmlUrl const longUrl = htmlUrl;
const shareData = { ...item, longUrl }; const shareData = { ...item, longUrl };
const sharePlanModal = ( const sharePlanModal = (
<SharePlanModal <SharePlanModal
data={shareData} data={shareData}
type="liveClass" type='liveClass'
close={() => { close={() => {
setSharePlanModal(null) setSharePlanModal(null);
}} }}
/> />
) );
setSharePlanModal(sharePlanModal) setSharePlanModal(sharePlanModal);
} }
//改变上架状态 //改变上架状态
function changeEnableState(item){ function changeEnableState(item) {
let _enableState = item.enableState let _enableState = item.enableState;
if(_enableState==='NO'){ if (_enableState === 'NO') {
_enableState = "YES"; _enableState = 'YES';
item.enableState = "YES" item.enableState = 'YES';
}else{ } else {
_enableState = "NO" _enableState = 'NO';
item.enableState = "NO" item.enableState = 'NO';
}
const params={
"planId": item.planId,
"enableState":_enableState
} }
PlanService.updateStateTrainingPlan(params).then((res)=>{ const params = {
if(res.success){ planId: item.planId,
if(_enableState === "YES"){ enableState: _enableState,
message.success("已启用此计划"); };
}else{ PlanService.updateStateTrainingPlan(params).then((res) => {
message.success("已禁用此计划"); if (res.success) {
if (_enableState === 'YES') {
message.success('已启用此计划');
} else {
message.success('已禁用此计划');
} }
props.onChange(); props.onChange();
} }
}) });
} }
function toEditPlanPage(item){ function toEditPlanPage(item) {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/create-plan?type=edit&id=${item.planId}`, pathname: `/create-plan?type=edit&id=${item.planId}`,
}) });
} }
function toLearningDataPage(item){ function toLearningDataPage(item) {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/learning-data?id=${item.planId}`, pathname: `/learning-data?id=${item.planId}`,
}) });
} }
function handleDelete(record){ function handleDelete(record) {
return confirm({ return confirm({
title: '你确定要删除吗?', title: '你确定要删除吗?',
content: '删除后,此培训计划的学员将无法继续学习,所有学习数据将同步删除不可恢复', content: '删除后,此培训计划的学员将无法继续学习,所有学习数据将同步删除不可恢复',
icon: <span className="icon iconfont default-confirm-icon">&#xe839; </span>, icon: <span className='icon iconfont default-confirm-icon'>&#xe839; </span>,
okText: '删除', okText: '删除',
okType: 'danger', okType: 'danger',
cancelText: '取消', cancelText: '取消',
width:440, width: 440,
height:188, height: 188,
onOk: () => { onOk: () => {
if(record.enableState === "YES"){ if (record.enableState === 'YES') {
Modal.warning({ Modal.warning({
title: '无法删除', title: '无法删除',
content: '培训计划启用中,无法直接删除', content: '培训计划启用中,无法直接删除',
}); });
}else{ } else {
deleteConfirm(record); deleteConfirm(record);
} }
},
} });
})
}
function deleteConfirm(item){
const params={
"planId": item.planId,
} }
PlanService.deleteTrainingPlan(params).then((res)=>{ function deleteConfirm(item) {
if(res.success){ const params = {
message.success("删除成功"); planId: item.planId,
};
PlanService.deleteTrainingPlan(params).then((res) => {
if (res.success) {
message.success('删除成功');
props.onChange(); props.onChange();
} }
}) });
} }
function onShowSizeChange(current, size){ function onShowSizeChange(current, size) {
if (current === size) { if (current === size) {
return return;
} }
let _query = props.query let _query = props.query;
_query.size = size; _query.size = size;
props.onChange(_query) props.onChange(_query);
} }
return ( return (
<div className="plan-list"> <div className='plan-list'>
<Table <Table
rowKey={record => record.id} rowKey={(record) => record.id}
showSorterTooltip={false} showSorterTooltip={false}
dataSource={props.planListData} dataSource={props.planListData}
columns={ parseColumns() } columns={parseColumns()}
pagination={false} pagination={false}
onChange={handleChangeTable} onChange={handleChangeTable}
bordered bordered
size="middle" size='middle'
scroll={{ x: 1400}} scroll={{ x: 1400 }}
className="plan-list-table" className='plan-list-table'
/> />
<div className="box-footer"> <div className='box-footer'>
<PageControl <PageControl
current={props.query.current - 1} current={props.query.current - 1}
pageSize={props.query.size} pageSize={props.query.size}
total={props.totalCount} total={props.totalCount}
toPage={(page) => { toPage={(page) => {
const _query = {...props.query, current: page + 1}; const _query = { ...props.query, current: page + 1 };
props.onChange(_query) props.onChange(_query);
}} }}
onShowSizeChange={onShowSizeChange} onShowSizeChange={onShowSizeChange}
/> />
</div> </div>
{sharePlanModal } {sharePlanModal}
</div> </div>
) );
} }
export default withRouter(PlanList); export default withRouter(PlanList);
\ No newline at end of file
.plan-list{ .plan-list {
margin-top:12px; margin-top: 12px;
.course-number{ .course-number {
text-align:right; text-align: right;
margin-right:45px; margin-right: 45px;
}
.plan-list-table {
thead.ant-table-thead {
tr {
th {
padding: 10px 12px;
}
}
} }
.plan-list-table{
tbody { tbody {
tr{ tr {
&:nth-child(even){ td.ant-table-cell {
background: transparent !important; padding: 16px 12px;
td{ color: #333;
background:#FFF !important; }
&:nth-child(even) {
background: transparent;
td {
background: #fff;
} }
} }
&:nth-child(odd){ &:nth-child(odd) {
background: #FAFAFA !important; background: #fafafa;
td{ td {
background: #FAFAFA !important; background: #fafafa;
} }
} }
&:hover{ &:hover {
td{ td {
background:#F3f6fa !important; background: #f3f6fa;
} }
} }
} }
} }
} }
.plan-name{ .plan_name_item {
text-overflow: -o-ellipsis-lastline; display: flex;
align-items: center;
.plan-cover {
width: 106px;
height: 60px;
border-radius: 2px;
margin-right: 8px;
}
.plan-name {
width: 188px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
height: 40px;
}
} }
.operate-text { .operate-text {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
} }
.operate { .operate {
display: flex; display: flex;
&__item { &__item {
color: #2966FF; color: #2966ff;
cursor: pointer; cursor: pointer;
&.split { &.split {
margin: 0 8px; margin: 0 8px;
color: #BFBFBF; color: #bfbfbf;
} }
} }
} }
.join-number{ .join-number {
text-align:right; text-align: right;
margin-right:12px; margin-right: 12px;
} }
.more-operate{ .more-operate {
line-height:20px; line-height: 20px;
} }
} }
import React from "react" import React from 'react';
import _ from "underscore" import _ from 'underscore';
import { Table, Radio, Tabs, Modal, Input, message, Button, Tooltip } from "antd" import { Table, Radio, Tabs, Modal, Input, message, Button, Tooltip } from 'antd';
import { PageControl } from "@/components" import { PageControl } from '@/components';
import CourseService from "@/domains/course-domain/CourseService" import CourseService from '@/domains/course-domain/CourseService';
import User from "@/common/js/user" import User from '@/common/js/user';
import Service from "@/common/js/service" import Service from '@/common/js/service';
import dealTimeDuration from "../../course-manage/utils/dealTimeDuration" import dealTimeDuration from '../../course-manage/utils/dealTimeDuration';
import "./relatedCourseModal.less" import './relatedCourseModal.less';
const { Search } = Input const { Search } = Input;
const { TabPane } = Tabs const { TabPane } = Tabs;
const courseStateShow = { const courseStateShow = {
UN_START: { UN_START: {
code: 1, code: 1,
title: "待开课", title: '待开课',
color: "#FFB129" color: '#FFB129',
}, },
STARTING: { STARTING: {
code: 2, code: 2,
title: "上课中", title: '上课中',
color: "#238FFF" color: '#238FFF',
}, },
FINISH: { FINISH: {
code: 3, code: 3,
title: "已完成", title: '已完成',
color: "#3BBDAA" color: '#3BBDAA',
}, },
EXPIRED: { EXPIRED: {
code: 4, code: 4,
title: "未成功开课", title: '未成功开课',
color: "#999" color: '#999',
} },
} };
class SelectOperatorModal extends React.Component { class SelectOperatorModal extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props);
this.state = { this.state = {
liveDataSource: [], liveDataSource: [],
liveSize: 10, liveSize: 10,
liveQuery: { liveQuery: {
current: 1 current: 1,
}, },
liveTotalCount: 0, liveTotalCount: 0,
selectLive: [], //弹窗内已选择的直播课程 selectLive: [], //弹窗内已选择的直播课程
currentCourseListData: [], currentCourseListData: [],
currentLiveCourseListData: [], //页面中已关联的直播课程 currentLiveCourseListData: [], //页面中已关联的直播课程
videoCourseDivision: "internal", videoCourseDivision: 'internal',
videoDataSource: { videoDataSource: {
external: [], external: [],
internal: [] internal: [],
}, },
videoSize: { videoSize: {
external: 10, external: 10,
internal: 10 internal: 10,
}, },
videoSearchName: { videoSearchName: {
external: "", external: '',
internal: "" internal: '',
}, },
videoSearchDefalt: "", videoSearchDefalt: '',
videoQuery: { videoQuery: {
external: { external: {
current: 1 current: 1,
}, },
internal: { internal: {
current: 1 current: 1,
} },
}, },
videoTotalCount: { videoTotalCount: {
external: 0, external: 0,
internal: 0 internal: 0,
}, },
selectVideo: { selectVideo: {
external: [], external: [],
internal: [] internal: [],
}, //弹窗内已选择的视频课程 }, //弹窗内已选择的视频课程
currentVideoCourseListData: { currentVideoCourseListData: {
external: [], external: [],
internal: [] internal: [],
}, //页面中已关联的视频课程 }, //页面中已关联的视频课程
pictureDataSource: [], pictureDataSource: [],
pictureSize: 10, pictureSize: 10,
pictureQuery: { pictureQuery: {
current: 1 current: 1,
}, },
pictureTotalCount: 0, pictureTotalCount: 0,
selectPicture: [], //弹窗内已选择的视频课程 selectPicture: [], //弹窗内已选择的视频课程
currentPictureCourseListData: [], //页面中已关联的视频课程 currentPictureCourseListData: [], //页面中已关联的视频课程
activeKey: "video", activeKey: 'video',
currentTaskCourseData: this.props.data[this.props.selectedTaskIndex].courseList || [] currentTaskCourseData: this.props.data[this.props.selectedTaskIndex].courseList || [],
} };
} }
componentDidMount() { componentDidMount() {
this.handleFetchLiveDataList() this.handleFetchLiveDataList();
this.handleFetchVideoDataList() this.handleFetchVideoDataList();
this.handleFetchPictureDataList() this.handleFetchPictureDataList();
} }
// 获取直播课列表 // 获取直播课列表
handleFetchLiveDataList = () => { handleFetchLiveDataList = () => {
const { liveQuery, liveSize } = this.state const { liveQuery, liveSize } = this.state;
const _data = [...this.props.data] const _data = [...this.props.data];
let currentLiveCourseListData = [] let currentLiveCourseListData = [];
_data.map((item) => { _data.map((item) => {
item.courseList.map((childItem, childIndex) => { item.courseList.map((childItem, childIndex) => {
if (childItem.courseType === "LIVE") { if (childItem.courseType === 'LIVE') {
currentLiveCourseListData.push(childItem.courseId) currentLiveCourseListData.push(childItem.courseId);
} }
return childItem return childItem;
}) });
return item return item;
}) });
const params = { const params = {
...liveQuery, ...liveQuery,
size: liveSize, size: liveSize,
excludeCourseIdList: currentLiveCourseListData excludeCourseIdList: currentLiveCourseListData,
} };
CourseService.getLiveCloudCourseBasePage(params).then((res) => { CourseService.getLiveCloudCourseBasePage(params).then((res) => {
const { result = {} } = res const { result = {} } = res;
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
liveDataSource: records, liveDataSource: records,
liveTotalCount: Number(total), liveTotalCount: Number(total),
currentLiveCourseListData currentLiveCourseListData,
}) });
}) });
} };
// 获取视频课列表 // 获取视频课列表
handleFetchVideoDataList = () => { handleFetchVideoDataList = () => {
const { videoQuery, videoSize, videoDataSource, videoTotalCount, videoCourseDivision } = this.state const { videoQuery, videoSize, videoDataSource, videoTotalCount, videoCourseDivision } = this.state;
const _data = [...this.props.data] const _data = [...this.props.data];
let currentVideoCourseListData = [] let currentVideoCourseListData = [];
_data.map((item, index) => { _data.map((item, index) => {
item.courseList.map((childItem, childIndex) => { item.courseList.map((childItem, childIndex) => {
if (childItem.courseType === "VOICE") { if (childItem.courseType === 'VOICE') {
currentVideoCourseListData.push(childItem.courseId) currentVideoCourseListData.push(childItem.courseId);
} }
return childItem return childItem;
}) });
return item return item;
}) });
const params = { const params = {
...videoQuery[videoCourseDivision], ...videoQuery[videoCourseDivision],
size: videoSize[videoCourseDivision], size: videoSize[videoCourseDivision],
courseDivision: videoCourseDivision === "internal" ? "INTERNAL" : "EXTERNAL", courseDivision: videoCourseDivision === 'internal' ? 'INTERNAL' : 'EXTERNAL',
excludeCourseIdList: currentVideoCourseListData excludeCourseIdList: currentVideoCourseListData,
} };
CourseService.videoScheduleBasePage(params).then((res) => { CourseService.videoScheduleBasePage(params).then((res) => {
const { result = {} } = res const { result = {} } = res;
console.log("result", result) console.log('result', result);
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
videoDataSource: { videoDataSource: {
...videoDataSource, ...videoDataSource,
[videoCourseDivision]: records [videoCourseDivision]: records,
}, },
videoTotalCount: { videoTotalCount: {
...videoTotalCount, ...videoTotalCount,
[videoCourseDivision]: Number(total) [videoCourseDivision]: Number(total),
}, },
currentVideoCourseListData currentVideoCourseListData,
}) });
}) });
} };
// 获取图文课列表 // 获取图文课列表
handleFetchPictureDataList = () => { handleFetchPictureDataList = () => {
const { pictureQuery, pictureSize } = this.state const { pictureQuery, pictureSize } = this.state;
const _data = [...this.props.data] const _data = [...this.props.data];
let currentPictureCourseListData = [] let currentPictureCourseListData = [];
_data.map((item, index) => { _data.map((item, index) => {
item.courseList.map((childItem, childIndex) => { item.courseList.map((childItem, childIndex) => {
if (childItem.courseType === "PICTURE") { if (childItem.courseType === 'PICTURE') {
currentPictureCourseListData.push(childItem.courseId) currentPictureCourseListData.push(childItem.courseId);
} }
return childItem return childItem;
}) });
return item return item;
}) });
const params = { const params = {
...pictureQuery, ...pictureQuery,
size: pictureSize, size: pictureSize,
courseType: "PICTURE", courseType: 'PICTURE',
storeId: User.getStoreId(), storeId: User.getStoreId(),
excludeCourseIdList: currentPictureCourseListData excludeCourseIdList: currentPictureCourseListData,
} };
Service.Hades("public/hades/mediaCoursePage", params).then((res) => { Service.Hades('public/hades/mediaCoursePage', params).then((res) => {
const { result = {} } = res const { result = {} } = res;
const { records = [], total = 0 } = result const { records = [], total = 0 } = result;
this.setState({ this.setState({
pictureDataSource: records, pictureDataSource: records,
pictureTotalCount: Number(total), pictureTotalCount: Number(total),
currentPictureCourseListData currentPictureCourseListData,
}) });
}) });
} };
handleChangVideoCourseName = (value) => { handleChangVideoCourseName = (value) => {
const { videoQuery, videoCourseDivision, videoSearchName } = this.state const { videoQuery, videoCourseDivision, videoSearchName } = this.state;
videoQuery[videoCourseDivision].courseName = value videoQuery[videoCourseDivision].courseName = value;
videoQuery[videoCourseDivision].current = 1 videoQuery[videoCourseDivision].current = 1;
this.setState({ this.setState({
...videoQuery, ...videoQuery,
videoSearchDefalt: value, videoSearchDefalt: value,
videoSearchName: { videoSearchName: {
...videoSearchName, ...videoSearchName,
[videoCourseDivision]: value [videoCourseDivision]: value,
} },
}) });
} };
handleChangLiveCourseName = (value) => { handleChangLiveCourseName = (value) => {
const { liveQuery } = this.state const { liveQuery } = this.state;
liveQuery.courseName = value liveQuery.courseName = value;
liveQuery.current = 1 liveQuery.current = 1;
this.setState({ this.setState({
liveQuery liveQuery,
}) });
} };
handleChangPictureCourseName = (value) => { handleChangPictureCourseName = (value) => {
const { pictureQuery } = this.state const { pictureQuery } = this.state;
pictureQuery.courseName = value pictureQuery.courseName = value;
pictureQuery.current = 1 pictureQuery.current = 1;
this.setState({ this.setState({
pictureQuery pictureQuery,
}) });
} };
onShowLiveSizeChange = (current, size) => { onShowLiveSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return return;
} }
this.setState( this.setState(
{ {
liveSize: size liveSize: size,
}, },
() => { () => {
this.handleFetchLiveDataList() this.handleFetchLiveDataList();
}
)
} }
);
};
onShowVideoSizeChange = (current, size) => { onShowVideoSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return return;
} }
this.setState( this.setState(
{ {
videoSize: size videoSize: size,
}, },
() => { () => {
this.handleFetchLiveDataList() this.handleFetchLiveDataList();
}
)
} }
);
};
onShowPictureSizeChange = (current, size) => { onShowPictureSizeChange = (current, size) => {
if (current === size) { if (current === size) {
return return;
} }
this.setState( this.setState(
{ {
pictureSize: size pictureSize: size,
}, },
() => { () => {
this.handleFetchPictureDataList() this.handleFetchPictureDataList();
}
)
} }
);
};
// 请求表头 // 请求表头
parseLiveColumns = () => { parseLiveColumns = () => {
...@@ -291,28 +291,28 @@ class SelectOperatorModal extends React.Component { ...@@ -291,28 +291,28 @@ class SelectOperatorModal extends React.Component {
<span> <span>
<span>课程信息</span> <span>课程信息</span>
<Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'> <Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'>
<i className='icon iconfont' style={{ marginLeft: "5px", cursor: "pointer", color: "#bfbfbf", fontSize: "14px", fontWeight: "400" }}> <i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: '400' }}>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
key: "course", key: 'course',
dataIndex: "course", dataIndex: 'course',
width: "40%", width: '40%',
render: (val, record) => { render: (val, record) => {
let hasCover = false let hasCover = false;
return ( return (
<div className='course-info'> <div className='course-info'>
{record.courseMediaVOS.map((item) => { {record.courseMediaVOS.map((item) => {
if (item.contentType === "COVER") { if (item.contentType === 'COVER') {
hasCover = true hasCover = true;
return <img className='course-cover' src={item.mediaUrl} alt='' /> return <img className='course-cover' src={item.mediaUrl} alt='' />;
} }
return null return null;
})} })}
<If condition={!hasCover}> <If condition={!hasCover}>
<img className='course-cover' src={"https://image.xiaomaiketang.com/xm/YNfi45JwFA.png"} alt='' /> <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'} alt='' />
</If> </If>
<div> <div>
...@@ -324,35 +324,35 @@ class SelectOperatorModal extends React.Component { ...@@ -324,35 +324,35 @@ class SelectOperatorModal extends React.Component {
</span> </span>
</div> </div>
</div> </div>
) );
} },
}, },
{ {
title: "上课时间", title: '上课时间',
key: "courseTime", key: 'courseTime',
dataIndex: "courseTime", dataIndex: 'courseTime',
width: "40%", width: '40%',
render: (val, record) => { render: (val, record) => {
return ( return (
<div> <div>
<div>{formatDate("YYYY-MM-DD", record.startTime)}</div> <div>{formatDate('YYYY-MM-DD', record.startTime)}</div>
<div> <div>
{formatDate("H:i", record.startTime)}~{formatDate("H:i", record.endTime)} {formatDate('H:i', record.startTime)}~{formatDate('H:i', record.endTime)}
</div> </div>
</div> </div>
) );
} },
}, },
{ {
title: "学院展示", title: '学院展示',
key: "shelfState", key: 'shelfState',
dataIndex: "shelfState", dataIndex: 'shelfState',
width: "20%", width: '20%',
render: (val, record) => { render: (val, record) => {
return ( return (
<span> <span>
<Choose> <Choose>
<When condition={record.shelfState === "YES"}> <When condition={record.shelfState === 'YES'}>
<span>开启</span> <span>开启</span>
</When> </When>
<Otherwise> <Otherwise>
...@@ -360,33 +360,46 @@ class SelectOperatorModal extends React.Component { ...@@ -360,33 +360,46 @@ class SelectOperatorModal extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
</span> </span>
) );
} },
} },
] ];
return columns return columns;
} };
// 请求表头 // 请求表头
parseVideoColumns = () => { parseVideoColumns = () => {
const { videoCourseDivision } = this.state const { videoCourseDivision } = this.state;
const columns = [ const columns = [
{ {
title: ( title: (
<span> <span>
<span>课程信息</span> <span>课程信息</span>
<Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'> <Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'>
<i className='icon iconfont' style={{ marginLeft: "5px", cursor: "pointer", color: "#bfbfbf", fontSize: "14px", fontWeight: "400" }}> <i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: '400' }}>
&#xe61d;
</i>
</Tooltip>
</span>
),
key: 'course',
dataIndex: 'course',
width: '40%',
title: (
<span>
<span>课程信息</span>
<Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: '400' }}>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
key: "course", key: 'course',
dataIndex: "course", dataIndex: 'course',
width: "40%", width: '60%',
render: (val, record) => { render: (val, record) => {
const { coverUrl, scheduleVideoUrl } = record const { coverUrl, scheduleVideoUrl } = record;
return ( return (
<div className='course-info'> <div className='course-info'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
...@@ -394,48 +407,48 @@ class SelectOperatorModal extends React.Component { ...@@ -394,48 +407,48 @@ class SelectOperatorModal extends React.Component {
className='course-cover' className='course-cover'
src={ src={
coverUrl || coverUrl ||
(videoCourseDivision === "internal" (videoCourseDivision === 'internal'
? `${scheduleVideoUrl}?x-oss-process=video/snapshot,t_0,m_fast` ? `${scheduleVideoUrl}?x-oss-process=video/snapshot,t_0,m_fast`
: "https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png") : 'https://image.xiaomaiketang.com/xm/mt3ZQRxGKB.png')
} }
alt='' alt=''
/> />
<div className='course-name'>{record.courseName}</div> <div className='course-name'>{record.courseName}</div>
</div> </div>
) );
} },
}, },
{ {
title: "课程时长", title: '课程时长',
key: "courseTime", key: 'courseTime',
dataIndex: "courseTime", dataIndex: 'courseTime',
width: "20%", width: '20%',
render: (val, record) => { render: (val, record) => {
return <span className='course-status'>{dealTimeDuration(record.videoDuration)}</span> return <span className='course-status'>{dealTimeDuration(record.videoDuration)}</span>;
} },
}, },
{ {
title: "学院展示", title: '学院展示',
key: "shelfState", key: 'shelfState',
dataIndex: "shelfState", dataIndex: 'shelfState',
width: "20%", width: '20%',
render: (val, record) => { render: (val, record) => {
return ( return (
<Choose> <Choose>
<When condition={record.shelfState === "YES"}> <When condition={record.shelfState === 'YES'}>
<span>开启</span> <span>开启</span>
</When> </When>
<Otherwise> <Otherwise>
<span>关闭</span> <span>关闭</span>
</Otherwise> </Otherwise>
</Choose> </Choose>
) );
} },
} },
] ];
return columns return columns;
} };
// 请求表头 // 请求表头
parsePictureColumns = () => { parsePictureColumns = () => {
...@@ -445,201 +458,201 @@ class SelectOperatorModal extends React.Component { ...@@ -445,201 +458,201 @@ class SelectOperatorModal extends React.Component {
<span> <span>
<span>课程信息</span> <span>课程信息</span>
<Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'> <Tooltip title='仅显示未关联课程,已关联课程不支持重复选择'>
<i className='icon iconfont' style={{ marginLeft: "5px", cursor: "pointer", color: "#bfbfbf", fontSize: "14px", fontWeight: "400" }}> <i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px', fontWeight: '400' }}>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
key: "course", key: 'course',
dataIndex: "course", dataIndex: 'course',
width: "55%", width: '55%',
render: (val, record) => { render: (val, record) => {
const { coverUrl } = record const { coverUrl } = record;
return ( return (
<div className='course-info'> <div className='course-info'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
<img className='course-cover' src={coverUrl || "https://image.xiaomaiketang.com/xm/YNfi45JwFA.png"} alt='' /> <img className='course-cover' src={coverUrl || 'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'} alt='' />
<div className='course-name'>{record.courseName}</div> <div className='course-name'>{record.courseName}</div>
</div> </div>
) );
} },
}, },
{ {
title: "更新时间", title: '更新时间',
key: "updated", key: 'updated',
dataIndex: "updated", dataIndex: 'updated',
width: "25%", width: '25%',
render: (val, record) => { render: (val, record) => {
return <span className='course-status'>{formatDate("YYYY-MM-DD", record.updated)}</span> return <span className='course-status'>{formatDate('YYYY-MM-DD', record.updated)}</span>;
} },
}, },
{ {
title: "学院展示", title: '学院展示',
key: "shelfState", key: 'shelfState',
dataIndex: "shelfState", dataIndex: 'shelfState',
width: "20%", width: '20%',
render: (val, record) => { render: (val, record) => {
return <span>{record.shelfState === "YES" ? "开启" : "关闭"}</span> return <span>{record.shelfState === 'YES' ? '开启' : '关闭'}</span>;
} },
} },
] ];
return columns return columns;
} };
selectLiveList = (record, selected) => { selectLiveList = (record, selected) => {
const { selectVideo, currentTaskCourseData, selectLive, selectPicture } = this.state const { selectVideo, currentTaskCourseData, selectLive, selectPicture } = this.state;
let _list = [] let _list = [];
if (selected || !_.find(selectLive, (item) => item.liveCourseId === record.liveCourseId)) { if (selected || !_.find(selectLive, (item) => item.liveCourseId === record.liveCourseId)) {
_list = _.uniq(selectLive.concat([record]), false, (item) => item.liveCourseId) _list = _.uniq(selectLive.concat([record]), false, (item) => item.liveCourseId);
} else { } else {
_list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId) _list = _.reject(selectLive, (item) => item.liveCourseId === record.liveCourseId);
} }
if (_list.length + currentTaskCourseData.length + selectVideo.length + selectPicture.length > 20) { if (_list.length + currentTaskCourseData.length + selectVideo.length + selectPicture.length > 20) {
message.warning("无法继续选择,一个任务最多关联20个课程") message.warning('无法继续选择,一个任务最多关联20个课程');
return return;
}
this.setState({ selectLive: _list })
} }
this.setState({ selectLive: _list });
};
selectVideoList = (record, selected) => { selectVideoList = (record, selected) => {
const { selectVideo, currentTaskCourseData, selectLive, selectPicture, videoCourseDivision } = this.state const { selectVideo, currentTaskCourseData, selectLive, selectPicture, videoCourseDivision } = this.state;
let { [videoCourseDivision]: selectList } = selectVideo let { [videoCourseDivision]: selectList } = selectVideo;
let _list = [] let _list = [];
if (selected || !_.find(selectList, (item) => item.id === record.id)) { if (selected || !_.find(selectList, (item) => item.id === record.id)) {
_list = _.uniq(selectList.concat([record]), false, (item) => item.id) _list = _.uniq(selectList.concat([record]), false, (item) => item.id);
} else { } else {
_list = _.reject(selectList, (item) => item.id === record.id) _list = _.reject(selectList, (item) => item.id === record.id);
} }
if (_list.length + currentTaskCourseData.length + selectLive.length + selectPicture.length > 20) { if (_list.length + currentTaskCourseData.length + selectLive.length + selectPicture.length > 20) {
message.warning("无法继续选择,一个任务最多关联20个课程") message.warning('无法继续选择,一个任务最多关联20个课程');
return return;
} }
this.setState({ this.setState({
selectVideo: { selectVideo: {
...selectVideo, ...selectVideo,
[videoCourseDivision]: _list [videoCourseDivision]: _list,
} },
}) });
} };
selectPictureList = (record, selected) => { selectPictureList = (record, selected) => {
const { selectVideo, currentTaskCourseData, selectLive, selectPicture } = this.state const { selectVideo, currentTaskCourseData, selectLive, selectPicture } = this.state;
let _list = [] let _list = [];
if (selected || !_.find(selectPicture, (item) => item.id === record.id)) { if (selected || !_.find(selectPicture, (item) => item.id === record.id)) {
_list = _.uniq(selectPicture.concat([record]), false, (item) => item.id) _list = _.uniq(selectPicture.concat([record]), false, (item) => item.id);
} else { } else {
_list = _.reject(selectPicture, (item) => item.id === record.id) _list = _.reject(selectPicture, (item) => item.id === record.id);
} }
if (_list.length + currentTaskCourseData.length + selectLive.length + selectVideo.length > 20) { if (_list.length + currentTaskCourseData.length + selectLive.length + selectVideo.length > 20) {
message.warning("无法继续选择,一个任务最多关联20个课程") message.warning('无法继续选择,一个任务最多关联20个课程');
return return;
}
this.setState({ selectPicture: _list })
} }
this.setState({ selectPicture: _list });
};
clearSelectCourse = () => { clearSelectCourse = () => {
this.setState({ this.setState({
selectLive: [], selectLive: [],
selectVideo: { selectVideo: {
internal: [], internal: [],
external: [] external: [],
}, },
selectPicture: [] selectPicture: [],
}) });
} };
handleSelectVideo = (selectVideo) => { handleSelectVideo = (selectVideo) => {
return selectVideo.map((item) => { return selectVideo.map((item) => {
let _item = {} let _item = {};
_item.courseId = item.id _item.courseId = item.id;
_item.courseType = "VOICE" _item.courseType = 'VOICE';
_item.courseName = item.courseName _item.courseName = item.courseName;
return _item return _item;
}) });
} };
handleSelectLive = (selectLive) => { handleSelectLive = (selectLive) => {
return selectLive.map((item, index) => { return selectLive.map((item, index) => {
let _item = {} let _item = {};
_item.courseId = item.liveCourseId _item.courseId = item.liveCourseId;
_item.courseType = "LIVE" _item.courseType = 'LIVE';
_item.courseName = item.courseName _item.courseName = item.courseName;
_item.courseState = item.courseState _item.courseState = item.courseState;
return _item return _item;
}) });
} };
videoCourseDivisionChange = (e) => { videoCourseDivisionChange = (e) => {
const { videoSearchName } = this.state const { videoSearchName } = this.state;
this.setState( this.setState(
{ {
videoCourseDivision: e.target.value, videoCourseDivision: e.target.value,
videoSearchDefalt: videoSearchName[e.target.value] videoSearchDefalt: videoSearchName[e.target.value],
}, },
() => { () => {
this.handleFetchVideoDataList() this.handleFetchVideoDataList();
}
)
} }
);
};
handleSelectPicture = (selectPicture) => { handleSelectPicture = (selectPicture) => {
return selectPicture.map((item, index) => { return selectPicture.map((item, index) => {
let _item = {} let _item = {};
_item.courseId = item.id _item.courseId = item.id;
_item.courseType = "PICTURE" _item.courseType = 'PICTURE';
_item.courseName = item.courseName _item.courseName = item.courseName;
return _item return _item;
}) });
} };
renderFooter = () => { renderFooter = () => {
const { activeKey } = this.state const { activeKey } = this.state;
let href = "" let href = '';
switch (activeKey) { switch (activeKey) {
case "live": case 'live':
href = ( href = (
<a <a
target='_blank' target='_blank'
rel='noopener noreferrer' rel='noopener noreferrer'
className='link-create-course' className='link-create-course'
href={window.location.origin + window.location.pathname + "#/create-live-course?type=add"} href={window.location.origin + window.location.pathname + '#/create-live-course?type=add'}
onClick={this.props.onClose}> onClick={this.props.onClose}>
没有找到需要的直播课?<span>去创建</span> 没有找到需要的直播课?<span>去创建</span>
</a> </a>
) );
break break;
case "video": case 'video':
href = ( href = (
<a <a
target='_blank' target='_blank'
rel='noopener noreferrer' rel='noopener noreferrer'
className='link-create-course' className='link-create-course'
href={window.location.origin + window.location.pathname + "#/create-video-course?type=add"} href={window.location.origin + window.location.pathname + '#/create-video-course?type=add'}
onClick={this.props.onClose}> onClick={this.props.onClose}>
没有找到需要的视频课?<span>去创建</span> 没有找到需要的视频课?<span>去创建</span>
</a> </a>
) );
break break;
case "picture": case 'picture':
href = ( href = (
<a <a
target='_blank' target='_blank'
rel='noopener noreferrer' rel='noopener noreferrer'
className='link-create-course' className='link-create-course'
href={window.location.origin + window.location.pathname + "#/create-graphics-course?type=add"} href={window.location.origin + window.location.pathname + '#/create-graphics-course?type=add'}
onClick={this.props.onClose}> onClick={this.props.onClose}>
没有找到需要的图文课?<span>去创建</span> 没有找到需要的图文课?<span>去创建</span>
</a> </a>
) );
break break;
default: default:
break break;
}
return href
} }
return href;
};
render() { render() {
const { visible } = this.props const { visible } = this.props;
const { const {
liveDataSource, liveDataSource,
liveSize, liveSize,
...@@ -659,8 +672,8 @@ class SelectOperatorModal extends React.Component { ...@@ -659,8 +672,8 @@ class SelectOperatorModal extends React.Component {
pictureQuery, pictureQuery,
pictureTotalCount, pictureTotalCount,
videoCourseDivision videoCourseDivision,
} = this.state } = this.state;
return ( return (
<Modal <Modal
title='关联课程' title='关联课程'
...@@ -676,7 +689,7 @@ class SelectOperatorModal extends React.Component { ...@@ -676,7 +689,7 @@ class SelectOperatorModal extends React.Component {
this.renderFooter(), this.renderFooter(),
<Button <Button
onClick={() => { onClick={() => {
this.props.onClose() this.props.onClose();
}}> }}>
取消 取消
</Button>, </Button>,
...@@ -687,18 +700,18 @@ class SelectOperatorModal extends React.Component { ...@@ -687,18 +700,18 @@ class SelectOperatorModal extends React.Component {
...this.handleSelectVideo(selectVideo.internal), ...this.handleSelectVideo(selectVideo.internal),
...this.handleSelectVideo(selectVideo.external), ...this.handleSelectVideo(selectVideo.external),
...this.handleSelectLive(selectLive), ...this.handleSelectLive(selectLive),
...this.handleSelectPicture(selectPicture) ...this.handleSelectPicture(selectPicture),
]) ])
}> }>
确定 确定
</Button> </Button>,
]}> ]}>
<div> <div>
<Tabs <Tabs
type='line' type='line'
defaultActiveKey='live' defaultActiveKey='live'
onChange={(activeKey) => { onChange={(activeKey) => {
this.setState({ activeKey: activeKey }) this.setState({ activeKey: activeKey });
}}> }}>
<TabPane tab='直播课' key='live'> <TabPane tab='直播课' key='live'>
<div className='search-container'> <div className='search-container'>
...@@ -707,10 +720,10 @@ class SelectOperatorModal extends React.Component { ...@@ -707,10 +720,10 @@ class SelectOperatorModal extends React.Component {
placeholder='搜索课程名称' placeholder='搜索课程名称'
style={{ width: 200 }} style={{ width: 200 }}
onChange={(e) => { onChange={(e) => {
this.handleChangLiveCourseName(e.target.value) this.handleChangLiveCourseName(e.target.value);
}} }}
onSearch={() => { onSearch={() => {
this.handleFetchLiveDataList() this.handleFetchLiveDataList();
}} }}
/> />
</div> </div>
...@@ -741,25 +754,25 @@ class SelectOperatorModal extends React.Component { ...@@ -741,25 +754,25 @@ class SelectOperatorModal extends React.Component {
pagination={false} pagination={false}
bordered bordered
rowSelection={{ rowSelection={{
type: "checkbox", type: 'checkbox',
selectedRowKeys: _.pluck(selectLive, "liveCourseId"), selectedRowKeys: _.pluck(selectLive, 'liveCourseId'),
onSelect: (record, selected) => { onSelect: (record, selected) => {
this.selectLiveList(record, selected) this.selectLiveList(record, selected);
}, },
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = [];
if (selected) { if (selected) {
_list = _.uniq(selectLive.concat(changeRows), false, (item) => item.liveCourseId) _list = _.uniq(selectLive.concat(changeRows), false, (item) => item.liveCourseId);
} else { } else {
_list = _.reject(selectLive, (item) => _.find(changeRows, (data) => data.liveCourseId === item.liveCourseId)) _list = _.reject(selectLive, (item) => _.find(changeRows, (data) => data.liveCourseId === item.liveCourseId));
} }
if (_list.length + currentTaskCourseData.length + selectVideo.length + selectPicture.length > 20) { if (_list.length + currentTaskCourseData.length + selectVideo.length + selectPicture.length > 20) {
message.warning("无法继续选择,一个任务最多关联20个课程") message.warning('无法继续选择,一个任务最多关联20个课程');
const extraLength = _list.length + currentTaskCourseData.length + selectVideo.length + selectPicture.length - 20 const extraLength = _list.length + currentTaskCourseData.length + selectVideo.length + selectPicture.length - 20;
_list.splice(_list.length - extraLength, extraLength) _list.splice(_list.length - extraLength, extraLength);
}
this.setState({ selectLive: _list })
} }
this.setState({ selectLive: _list });
},
}} }}
/> />
{liveDataSource.length > 0 && ( {liveDataSource.length > 0 && (
...@@ -770,15 +783,15 @@ class SelectOperatorModal extends React.Component { ...@@ -770,15 +783,15 @@ class SelectOperatorModal extends React.Component {
size='small' size='small'
total={liveTotalCount} total={liveTotalCount}
toPage={(page) => { toPage={(page) => {
const _query = { ...liveQuery, current: page + 1 } const _query = { ...liveQuery, current: page + 1 };
this.setState( this.setState(
{ {
liveQuery: _query liveQuery: _query,
}, },
() => { () => {
this.handleFetchLiveDataList() this.handleFetchLiveDataList();
} }
) );
}} }}
onShowSizeChange={this.onShowLiveSizeChange} onShowSizeChange={this.onShowLiveSizeChange}
/> />
...@@ -799,10 +812,10 @@ class SelectOperatorModal extends React.Component { ...@@ -799,10 +812,10 @@ class SelectOperatorModal extends React.Component {
placeholder='搜索课程名称' placeholder='搜索课程名称'
style={{ width: 200 }} style={{ width: 200 }}
onChange={(e) => { onChange={(e) => {
this.handleChangVideoCourseName(e.target.value) this.handleChangVideoCourseName(e.target.value);
}} }}
onSearch={() => { onSearch={() => {
this.handleFetchVideoDataList() this.handleFetchVideoDataList();
}} }}
/> />
</div> </div>
...@@ -832,30 +845,30 @@ class SelectOperatorModal extends React.Component { ...@@ -832,30 +845,30 @@ class SelectOperatorModal extends React.Component {
pagination={false} pagination={false}
bordered bordered
rowSelection={{ rowSelection={{
type: "checkbox", type: 'checkbox',
selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], "id"), selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], 'id'),
onSelect: (record, selected) => { onSelect: (record, selected) => {
this.selectVideoList(record, selected) this.selectVideoList(record, selected);
}, },
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = [];
if (selected) { if (selected) {
_list = _.uniq(selectVideo[videoCourseDivision].concat(changeRows), false, (item) => item.id) _list = _.uniq(selectVideo[videoCourseDivision].concat(changeRows), false, (item) => item.id);
} else { } else {
_list = _.reject(selectVideo[videoCourseDivision], (item) => _.find(changeRows, (data) => data.id === item.id)) _list = _.reject(selectVideo[videoCourseDivision], (item) => _.find(changeRows, (data) => data.id === item.id));
} }
if (_list.length + currentTaskCourseData.length + selectLive.length + selectPicture.length > 20) { if (_list.length + currentTaskCourseData.length + selectLive.length + selectPicture.length > 20) {
message.warning("无法继续选择,一个任务最多关联20个课程") message.warning('无法继续选择,一个任务最多关联20个课程');
const extraLength = _list.length + currentTaskCourseData.length + selectLive.length + selectPicture.length - 20 const extraLength = _list.length + currentTaskCourseData.length + selectLive.length + selectPicture.length - 20;
_list.splice(_list.length - extraLength, extraLength) _list.splice(_list.length - extraLength, extraLength);
} }
this.setState({ this.setState({
selectVideo: { selectVideo: {
...selectVideo, ...selectVideo,
[videoCourseDivision]: _list [videoCourseDivision]: _list,
} },
}) });
} },
}} }}
/> />
{videoDataSource[videoCourseDivision].length > 0 && ( {videoDataSource[videoCourseDivision].length > 0 && (
...@@ -866,19 +879,19 @@ class SelectOperatorModal extends React.Component { ...@@ -866,19 +879,19 @@ class SelectOperatorModal extends React.Component {
size='small' size='small'
total={videoTotalCount[videoCourseDivision]} total={videoTotalCount[videoCourseDivision]}
toPage={(page) => { toPage={(page) => {
const _query = { ...videoQuery[videoCourseDivision], current: page + 1 } const _query = { ...videoQuery[videoCourseDivision], current: page + 1 };
this.setState( this.setState(
{ {
videoQuery: { videoQuery: {
...videoQuery, ...videoQuery,
[videoCourseDivision]: _query [videoCourseDivision]: _query,
} },
}, },
() => { () => {
this.handleFetchVideoDataList() this.handleFetchVideoDataList();
} }
) );
}} }}
onShowSizeChange={this.onShowVideoSizeChange} onShowSizeChange={this.onShowVideoSizeChange}
/> />
...@@ -893,10 +906,10 @@ class SelectOperatorModal extends React.Component { ...@@ -893,10 +906,10 @@ class SelectOperatorModal extends React.Component {
placeholder='搜索课程名称' placeholder='搜索课程名称'
style={{ width: 200 }} style={{ width: 200 }}
onChange={(e) => { onChange={(e) => {
this.handleChangPictureCourseName(e.target.value) this.handleChangPictureCourseName(e.target.value);
}} }}
onSearch={() => { onSearch={() => {
this.handleFetchPictureDataList() this.handleFetchPictureDataList();
}} }}
/> />
</div> </div>
...@@ -927,25 +940,25 @@ class SelectOperatorModal extends React.Component { ...@@ -927,25 +940,25 @@ class SelectOperatorModal extends React.Component {
pagination={false} pagination={false}
bordered bordered
rowSelection={{ rowSelection={{
type: "checkbox", type: 'checkbox',
selectedRowKeys: _.pluck(selectPicture, "id"), selectedRowKeys: _.pluck(selectPicture, 'id'),
onSelect: (record, selected) => { onSelect: (record, selected) => {
this.selectPictureList(record, selected) this.selectPictureList(record, selected);
}, },
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = [];
if (selected) { if (selected) {
_list = _.uniq(selectPicture.concat(changeRows), false, (item) => item.id) _list = _.uniq(selectPicture.concat(changeRows), false, (item) => item.id);
} else { } else {
_list = _.reject(selectPicture, (item) => _.find(changeRows, (data) => data.id === item.id)) _list = _.reject(selectPicture, (item) => _.find(changeRows, (data) => data.id === item.id));
} }
if (_list.length + currentTaskCourseData.length + selectVideo.length + selectLive.length > 20) { if (_list.length + currentTaskCourseData.length + selectVideo.length + selectLive.length > 20) {
message.warning("无法继续选择,一个任务最多关联20个课程") message.warning('无法继续选择,一个任务最多关联20个课程');
const extraLength = _list.length + currentTaskCourseData.length + selectVideo.length + selectLive.length - 20 const extraLength = _list.length + currentTaskCourseData.length + selectVideo.length + selectLive.length - 20;
_list.splice(_list.length - extraLength, extraLength) _list.splice(_list.length - extraLength, extraLength);
}
this.setState({ selectPicture: _list })
} }
this.setState({ selectPicture: _list });
},
}} }}
/> />
{pictureDataSource.length > 0 && ( {pictureDataSource.length > 0 && (
...@@ -956,15 +969,15 @@ class SelectOperatorModal extends React.Component { ...@@ -956,15 +969,15 @@ class SelectOperatorModal extends React.Component {
size='small' size='small'
total={pictureTotalCount} total={pictureTotalCount}
toPage={(page) => { toPage={(page) => {
const _query = { ...pictureQuery, current: page + 1 } const _query = { ...pictureQuery, current: page + 1 };
this.setState( this.setState(
{ {
pictureQuery: _query pictureQuery: _query,
}, },
() => { () => {
this.handleFetchPictureDataList() this.handleFetchPictureDataList();
} }
) );
}} }}
onShowSizeChange={this.onShowPictureSizeChange} onShowSizeChange={this.onShowPictureSizeChange}
/> />
...@@ -975,8 +988,8 @@ class SelectOperatorModal extends React.Component { ...@@ -975,8 +988,8 @@ class SelectOperatorModal extends React.Component {
</Tabs> </Tabs>
</div> </div>
</Modal> </Modal>
) );
} }
} }
export default SelectOperatorModal export default SelectOperatorModal;
...@@ -12,7 +12,47 @@ ...@@ -12,7 +12,47 @@
text-align: left; text-align: left;
display: inline-block; display: inline-block;
span { span {
color: #5289fa; color: #2966ff;
}
}
.search-container {
margin-bottom: 16px;
}
.select-area {
margin-bottom: 12px;
display: flex;
justify-content: space-between;
.select-box {
display: inline-box;
width: 186px;
background: #e9efff;
border-radius: 4px;
padding: 6px 16px;
margin-right: 8px;
display: flex;
justify-content: space-between;
.tip-icon {
color: #2966ff;
font-size: 14px;
margin-right: 4px;
}
.select-num {
color: #666666;
font-size: 14px;
}
.clear-btn {
text-align: right;
color: #2966ff;
font-size: 14px;
}
}
.related-box {
padding: 6px 16px;
background: #e9efff;
border-radius: 4px;
flex: 1;
color: #666666;
font-size: 14px;
} }
} }
.search-container { .search-container {
......
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
color: #999999; color: #999999;
line-height: 20px; line-height: 20px;
} }
.rwm {
.rwm{
position: relative; position: relative;
width: 210px; width: 210px;
height: 210px; height: 210px;
...@@ -19,29 +18,28 @@ ...@@ -19,29 +18,28 @@
margin-top: 24px; margin-top: 24px;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
border-radius: 2px; border-radius: 2px;
padding:15px; padding: 15px;
.error{ .error {
position: absolute; position: absolute;
width: 200px; width: 200px;
height: 200px; height: 200px;
background: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.95);
display: flex; display: flex;
align-items:center; align-items: center;
justify-content:center; justify-content: center;
left:5px; left: 5px;
top:5px; top: 5px;
div{ div {
margin: 0 10px; margin: 0 10px;
font-size: 14px; font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
line-height: 20px; line-height: 20px;
} }
.ope{ .ope {
cursor: pointer; cursor: pointer;
color:rgba(82, 137, 250, 1); color: rgba(82, 137, 250, 1);
} }
} }
} }
......
...@@ -129,6 +129,7 @@ function ExaminationManager(props: any) { ...@@ -129,6 +129,7 @@ function ExaminationManager(props: any) {
{ {
title: "创建时间", title: "创建时间",
dataIndex: "examCreateTime", dataIndex: "examCreateTime",
align:fixStr.right,
sorter: true, sorter: true,
sortOrder: field === "examCreateTime" ? order : sortStatus.type, sortOrder: field === "examCreateTime" ? order : sortStatus.type,
render: (text: any, record: any) => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>, render: (text: any, record: any) => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>,
......
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