Commit e2c3c866 by guomingpang

fix:修复知识库课程分类搜索bug

parent f9dc5153
...@@ -2,22 +2,22 @@ ...@@ -2,22 +2,22 @@
* @Description: * @Description:
* @Author: zangsuyun * @Author: zangsuyun
* @Date: 2021-03-13 09:54:26 * @Date: 2021-03-13 09:54:26
* @LastEditors: wufan * @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-30 20:38:03 * @LastEditTime: 2021-05-30 23:52:25
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import React from 'react' import React from "react"
import { Row, Modal, Button, message, Radio, Table, Input, Tabs, Tooltip, TreeSelect } from 'antd' import { Row, Modal, Button, message, Radio, Table, Input, Tabs, Tooltip, TreeSelect } from "antd"
import { PageControl } from '@/components' import { PageControl } from "@/components"
import TableSelectedData from '@/components/TableSelectedData' import TableSelectedData from "@/components/TableSelectedData"
import KnowledgeAPI from '@/data-source/knowledge/request-api' import KnowledgeAPI from "@/data-source/knowledge/request-api"
import AidToolService from '@/domains/aid-tool-domain/AidToolService' import AidToolService from "@/domains/aid-tool-domain/AidToolService"
import User from '@/common/js/user' import User from "@/common/js/user"
import './LiveList.less' import "./LiveList.less"
import _ from 'underscore' import _ from "underscore"
import dealTimeDuration from '../../course-manage/utils/dealTimeDuration' import dealTimeDuration from "../../course-manage/utils/dealTimeDuration"
const { Search } = Input const { Search } = Input
const { TabPane } = Tabs const { TabPane } = Tabs
...@@ -25,23 +25,23 @@ const courseStateShow = { ...@@ -25,23 +25,23 @@ 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 AddCourse extends React.Component { class AddCourse extends React.Component {
...@@ -53,64 +53,64 @@ class AddCourse extends React.Component { ...@@ -53,64 +53,64 @@ class AddCourse extends React.Component {
liveQuery: { liveQuery: {
current: 1, current: 1,
excludeUsed: true, excludeUsed: true,
courseType: 'LIVE', courseType: "LIVE",
storeId: User.getStoreId(), storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId, toRefKnowledgeCategoryId: this.props.categoryId
}, },
liveTotalCount: 0, liveTotalCount: 0,
selectLive: [], //弹窗内已选择的直播课程 selectLive: [], //弹窗内已选择的直播课程
videoCourseDivision: 'internal', videoCourseDivision: "internal",
videoDataSource: { videoDataSource: {
external: [], external: [],
internal: [], internal: []
}, },
videoSize: { videoSize: {
external: 10, external: 10,
internal: 10, internal: 10
}, },
videoSearchDefalt: { videoSearchDefalt: {
external: { external: {
categoryId: '', categoryId: "",
courseName: '', courseName: ""
}, },
internal: { internal: {
categoryId: '', categoryId: "",
courseName: '', courseName: ""
}, }
}, },
videoQuery: { videoQuery: {
external: { external: {
categoryId: '', categoryId: "",
courseName: '', courseName: "",
current: 1, current: 1,
courseType: 'VOICE', courseType: "VOICE",
excludeUsed: true, excludeUsed: true,
storeId: User.getStoreId(), storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId, toRefKnowledgeCategoryId: this.props.categoryId
}, },
internal: { internal: {
categoryId: '', categoryId: "",
courseName: '', courseName: "",
current: 1, current: 1,
courseType: 'VOICE', courseType: "VOICE",
excludeUsed: true, excludeUsed: true,
storeId: User.getStoreId(), storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId, toRefKnowledgeCategoryId: this.props.categoryId
}, }
}, },
videoTotalCount: { videoTotalCount: {
external: 0, external: 0,
internal: 0, internal: 0
}, },
selectVideo: { selectVideo: {
external: [], external: [],
internal: [], internal: []
}, //弹窗内已选择的视频课程 }, //弹窗内已选择的视频课程
currentVideoCourseListData: { currentVideoCourseListData: {
external: [], external: [],
internal: [], internal: []
}, //页面中已关联的视频课程 }, //页面中已关联的视频课程
pictureDataSource: [], pictureDataSource: [],
...@@ -118,14 +118,14 @@ class AddCourse extends React.Component { ...@@ -118,14 +118,14 @@ class AddCourse extends React.Component {
pictureQuery: { pictureQuery: {
current: 1, current: 1,
excludeUsed: true, excludeUsed: true,
courseType: 'PICTURE', courseType: "PICTURE",
storeId: User.getStoreId(), storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId, toRefKnowledgeCategoryId: this.props.categoryId
}, },
pictureTotalCount: 0, pictureTotalCount: 0,
selectPicture: [], //弹窗内已选择的图文课程 selectPicture: [], //弹窗内已选择的图文课程
categoryList: [], //内部分类列表 categoryList: [], //内部分类列表
categoryListExternal: [], //外部分类列表 categoryListExternal: [] //外部分类列表
} }
} }
componentDidMount() { componentDidMount() {
...@@ -139,25 +139,25 @@ class AddCourse extends React.Component { ...@@ -139,25 +139,25 @@ class AddCourse extends React.Component {
queryCategoryTree = (categoryName) => { queryCategoryTree = (categoryName) => {
let query = { let query = {
storeId: User.getStoreId(), storeId: User.getStoreId(),
withCount: false, withCount: false
} }
let queryInternal = { let queryInternal = {
bizType: 'QUESTION', bizType: "QUESTION",
source: 2, source: 2,
tenantId: User.getStoreId(), tenantId: User.getStoreId(),
userId: User.getStoreUserId(), userId: User.getStoreUserId(),
count: false, count: false
} }
AidToolService.queryExternalCategoryTree(queryInternal).then((res) => { AidToolService.queryExternalCategoryTree(queryInternal).then((res) => {
const { categoryList = [] } = res.result const { categoryList = [] } = res.result
this.setState({ this.setState({
categoryListExternal: this.renderTreeNodes(categoryList), categoryListExternal: this.renderTreeNodes(categoryList)
}) })
}) })
KnowledgeAPI.getCategoryTree(query).then((res) => { KnowledgeAPI.getCategoryTree(query).then((res) => {
const { categoryList = [] } = res.result const { categoryList = [] } = res.result
this.setState({ this.setState({
categoryList: this.renderTreeNodes(categoryList), categoryList: this.renderTreeNodes(categoryList)
}) })
}) })
} }
...@@ -166,7 +166,7 @@ class AddCourse extends React.Component { ...@@ -166,7 +166,7 @@ class AddCourse extends React.Component {
let newTreeData = data.map((item) => { let newTreeData = data.map((item) => {
item.title = ( item.title = (
<span> <span>
<span className='icon iconfont' style={{ color: '#FBD140' }}> <span className='icon iconfont' style={{ color: "#FBD140" }}>
&#xe7f1;&nbsp; &#xe7f1;&nbsp;
</span> </span>
{item.categoryName} {item.categoryName}
...@@ -187,7 +187,7 @@ class AddCourse extends React.Component { ...@@ -187,7 +187,7 @@ class AddCourse extends React.Component {
const params = { const params = {
...liveQuery, ...liveQuery,
size: liveSize, size: liveSize
} }
// CourseService.getLiveCloudCoursePage(params).then((res) => { // CourseService.getLiveCloudCoursePage(params).then((res) => {
...@@ -196,7 +196,7 @@ class AddCourse extends React.Component { ...@@ -196,7 +196,7 @@ class AddCourse extends React.Component {
const { records = [], total = 0 } = result const { records = [], total = 0 } = result
this.setState({ this.setState({
liveDataSource: records, liveDataSource: records,
liveTotalCount: Number(total), liveTotalCount: Number(total)
}) })
}) })
} }
...@@ -208,7 +208,7 @@ class AddCourse extends React.Component { ...@@ -208,7 +208,7 @@ class AddCourse extends React.Component {
const params = { const params = {
...videoQuery[videoCourseDivision], ...videoQuery[videoCourseDivision],
size: videoSize[videoCourseDivision], size: videoSize[videoCourseDivision],
courseDivision: videoCourseDivision === 'internal' ? 'INTERNAL' : 'EXTERNAL', courseDivision: videoCourseDivision === "internal" ? "INTERNAL" : "EXTERNAL"
} }
// CourseService.videoSchedulePage(query).then((res) => { // CourseService.videoSchedulePage(query).then((res) => {
...@@ -218,12 +218,12 @@ class AddCourse extends React.Component { ...@@ -218,12 +218,12 @@ class AddCourse extends React.Component {
this.setState({ this.setState({
videoDataSource: { videoDataSource: {
...videoDataSource, ...videoDataSource,
[videoCourseDivision]: records, [videoCourseDivision]: records
}, },
videoTotalCount: { videoTotalCount: {
...videoTotalCount, ...videoTotalCount,
[videoCourseDivision]: Number(total), [videoCourseDivision]: Number(total)
}, }
}) })
}) })
} }
...@@ -234,7 +234,7 @@ class AddCourse extends React.Component { ...@@ -234,7 +234,7 @@ class AddCourse extends React.Component {
const params = { const params = {
...pictureQuery, ...pictureQuery,
size: pictureSize, size: pictureSize
} }
// CourseService.pictureSchedulePage(query).then((res) => { // CourseService.pictureSchedulePage(query).then((res) => {
...@@ -243,7 +243,7 @@ class AddCourse extends React.Component { ...@@ -243,7 +243,7 @@ class AddCourse extends React.Component {
const { records = [], total = 0 } = result const { records = [], total = 0 } = result
this.setState({ this.setState({
pictureDataSource: records, pictureDataSource: records,
pictureTotalCount: Number(total), pictureTotalCount: Number(total)
}) })
}) })
} }
...@@ -254,7 +254,7 @@ class AddCourse extends React.Component { ...@@ -254,7 +254,7 @@ class AddCourse extends React.Component {
} }
this.setState( this.setState(
{ {
liveSize: size, liveSize: size
}, },
() => { () => {
this.handleFetchLiveList() this.handleFetchLiveList()
...@@ -268,7 +268,7 @@ class AddCourse extends React.Component { ...@@ -268,7 +268,7 @@ class AddCourse extends React.Component {
} }
this.setState( this.setState(
{ {
videoSize: size, videoSize: size
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList()
...@@ -282,7 +282,7 @@ class AddCourse extends React.Component { ...@@ -282,7 +282,7 @@ class AddCourse extends React.Component {
} }
this.setState( this.setState(
{ {
pictureSize: size, pictureSize: size
}, },
() => { () => {
this.handleFetchPictureList() this.handleFetchPictureList()
...@@ -304,28 +304,27 @@ class AddCourse extends React.Component { ...@@ -304,28 +304,27 @@ class AddCourse extends React.Component {
cursor: "pointer", cursor: "pointer",
color: "#bfbfbf", color: "#bfbfbf",
fontSize: "14px", fontSize: "14px",
fontWeight:"400" fontWeight: "400"
}} }}>
>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
width: 371, width: 371,
key: 'course', key: "course",
dataIndex: 'courseName', dataIndex: "courseName",
render: (val, record) => { render: (val, record) => {
let hasCover = false let hasCover = false
return ( return (
<div className='record__item'> <div className='record__item'>
{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='' />
} }
})} })}
{!hasCover && <img className='course-cover' src={'https://image.xiaomaiketang.com/xm/YNfi45JwFA.png'} alt='' />} {!hasCover && <img className='course-cover' src={"https://image.xiaomaiketang.com/xm/YNfi45JwFA.png"} alt='' />}
<div> <div>
<Choose> <Choose>
<When condition={record.courseName.length > 17}> <When condition={record.courseName.length > 17}>
...@@ -342,7 +341,7 @@ class AddCourse extends React.Component { ...@@ -342,7 +341,7 @@ class AddCourse extends React.Component {
className='course-status' className='course-status'
style={{ style={{
color: courseStateShow[record.courseState].color, color: courseStateShow[record.courseState].color,
border: `1px solid ${courseStateShow[record.courseState].color}`, border: `1px solid ${courseStateShow[record.courseState].color}`
}}> }}>
{courseStateShow[record.courseState].title} {courseStateShow[record.courseState].title}
</span> </span>
...@@ -350,37 +349,37 @@ class AddCourse extends React.Component { ...@@ -350,37 +349,37 @@ class AddCourse extends React.Component {
</div> </div>
</div> </div>
) )
}, }
}, },
{ {
title: '上课时间', title: "上课时间",
width: 110, width: 110,
key: 'couseCatalog', key: "couseCatalog",
dataIndex: 'couseCatalog', dataIndex: "couseCatalog",
render: (val, item) => { render: (val, item) => {
return ( return (
<span className='course-time'> <span className='course-time'>
{formatDate('YYYY-MM-DD', parseInt(item.startTime))} <br></br> {formatDate("YYYY-MM-DD", parseInt(item.startTime))} <br></br>
{formatDate('H:i', parseInt(item.startTime))}~{formatDate('H:i', parseInt(item.endTime))} {formatDate("H:i", parseInt(item.startTime))}~{formatDate("H:i", parseInt(item.endTime))}
</span> </span>
) )
}, }
}, },
{ {
title: '课程分类', title: "课程分类",
// width: "10%", // width: "10%",
key: 'couseCatalog', key: "couseCatalog",
dataIndex: 'couseCatalog', dataIndex: "couseCatalog",
render: (val, record) => { render: (val, record) => {
return ( return (
<div className='categoryName'> <div className='categoryName'>
{record.categoryOneName} {record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''} {record.categoryTwoName ? `-${record.categoryTwoName}` : ""}
</div> </div>
) )
}, }
}, }
] ]
return columns return columns
...@@ -401,16 +400,15 @@ class AddCourse extends React.Component { ...@@ -401,16 +400,15 @@ class AddCourse extends React.Component {
cursor: "pointer", cursor: "pointer",
color: "#bfbfbf", color: "#bfbfbf",
fontSize: "14px", fontSize: "14px",
fontWeight:"400" fontWeight: "400"
}} }}>
>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
key: 'scheduleName', key: "scheduleName",
dataIndex: 'scheduleName', dataIndex: "scheduleName",
width: 300, width: 300,
render: (val, record) => { render: (val, record) => {
const { coverUrl, mediaCourseUrl } = record const { coverUrl, mediaCourseUrl } = record
...@@ -421,9 +419,9 @@ class AddCourse extends React.Component { ...@@ -421,9 +419,9 @@ class AddCourse extends React.Component {
className='course-cover' className='course-cover'
src={ src={
coverUrl || coverUrl ||
(videoCourseDivision === 'internal' (videoCourseDivision === "internal"
? `${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=''
/> />
...@@ -439,29 +437,29 @@ class AddCourse extends React.Component { ...@@ -439,29 +437,29 @@ class AddCourse extends React.Component {
</Choose> </Choose>
</div> </div>
) )
}, }
}, },
{ {
title: '课程时长', title: "课程时长",
key: 'videoDuration', key: "videoDuration",
width: 80, width: 80,
dataIndex: 'videoDuration', dataIndex: "videoDuration",
render: (text, item) => { render: (text, item) => {
return <span>{text ? dealTimeDuration(text) : '-'}</span> return <span>{text ? dealTimeDuration(text) : "-"}</span>
}, }
}, },
{ {
title: '课程分类', title: "课程分类",
key: 'categoryName', key: "categoryName",
dataIndex: 'categoryName', dataIndex: "categoryName",
render: (val, record) => { render: (val, record) => {
return ( return (
<Choose> <Choose>
<When condition={videoCourseDivision === 'internal'}> <When condition={videoCourseDivision === "internal"}>
<div className='record__item'> <div className='record__item'>
{record.categoryOneName} {record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''} {record.categoryTwoName ? `-${record.categoryTwoName}` : ""}
</div> </div>
</When> </When>
<Otherwise> <Otherwise>
...@@ -469,8 +467,8 @@ class AddCourse extends React.Component { ...@@ -469,8 +467,8 @@ class AddCourse extends React.Component {
</Otherwise> </Otherwise>
</Choose> </Choose>
) )
}, }
}, }
] ]
return columns return columns
} }
...@@ -489,23 +487,22 @@ class AddCourse extends React.Component { ...@@ -489,23 +487,22 @@ class AddCourse extends React.Component {
cursor: "pointer", cursor: "pointer",
color: "#bfbfbf", color: "#bfbfbf",
fontSize: "14px", fontSize: "14px",
fontWeight:"400" fontWeight: "400"
}} }}>
>
&#xe61d; &#xe61d;
</i> </i>
</Tooltip> </Tooltip>
</span> </span>
), ),
key: 'scheduleName', key: "scheduleName",
dataIndex: 'scheduleName', dataIndex: "scheduleName",
width: 371, width: 371,
render: (val, record) => { render: (val, record) => {
const { coverUrl } = record const { coverUrl } = record
return ( return (
<div className='record__item'> <div className='record__item'>
{/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */} {/* 上传了封面的话就用上传的封面, 没有的话就取视频的第一帧 */}
<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='' />
<Choose> <Choose>
<When condition={record.courseName.length > 25}> <When condition={record.courseName.length > 25}>
<Tooltip title={record.courseName}> <Tooltip title={record.courseName}>
...@@ -518,21 +515,21 @@ class AddCourse extends React.Component { ...@@ -518,21 +515,21 @@ class AddCourse extends React.Component {
</Choose> </Choose>
</div> </div>
) )
}, }
}, },
{ {
title: '课程分类', title: "课程分类",
key: 'categoryName', key: "categoryName",
dataIndex: 'categoryName', dataIndex: "categoryName",
render: (val, record) => { render: (val, record) => {
return ( return (
<div className='record__item'> <div className='record__item'>
{record.categoryOneName} {record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''} {record.categoryTwoName ? `-${record.categoryTwoName}` : ""}
</div> </div>
) )
}, }
}, }
] ]
return columns return columns
} }
...@@ -563,8 +560,8 @@ class AddCourse extends React.Component { ...@@ -563,8 +560,8 @@ class AddCourse extends React.Component {
this.setState({ this.setState({
selectVideo: { selectVideo: {
...selectVideo, ...selectVideo,
[videoCourseDivision]: _list, [videoCourseDivision]: _list
}, }
}) })
} }
...@@ -592,7 +589,7 @@ class AddCourse extends React.Component { ...@@ -592,7 +589,7 @@ class AddCourse extends React.Component {
this.setState( this.setState(
{ {
videoQuery, videoQuery,
videoSearchDefalt, videoSearchDefalt
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList()
...@@ -604,7 +601,7 @@ class AddCourse extends React.Component { ...@@ -604,7 +601,7 @@ class AddCourse extends React.Component {
const { videoSearchDefalt, videoCourseDivision } = this.state const { videoSearchDefalt, videoCourseDivision } = this.state
videoSearchDefalt[videoCourseDivision].courseName = e.target.value videoSearchDefalt[videoCourseDivision].courseName = e.target.value
this.setState({ this.setState({
videoSearchDefalt, videoSearchDefalt
}) })
} }
...@@ -614,7 +611,7 @@ class AddCourse extends React.Component { ...@@ -614,7 +611,7 @@ class AddCourse extends React.Component {
liveQuery.current = 1 liveQuery.current = 1
this.setState( this.setState(
{ {
liveQuery, liveQuery
}, },
() => { () => {
this.handleFetchLiveList() this.handleFetchLiveList()
...@@ -628,7 +625,7 @@ class AddCourse extends React.Component { ...@@ -628,7 +625,7 @@ class AddCourse extends React.Component {
pictureQuery.current = 1 pictureQuery.current = 1
this.setState( this.setState(
{ {
pictureQuery, pictureQuery
}, },
() => { () => {
this.handleFetchPictureList() this.handleFetchPictureList()
...@@ -641,43 +638,43 @@ class AddCourse extends React.Component { ...@@ -641,43 +638,43 @@ class AddCourse extends React.Component {
if (selectVideo.external.length) { if (selectVideo.external.length) {
batchAddList.push({ batchAddList.push({
categoryId: this.props.categoryId, categoryId: this.props.categoryId,
refIds: _.pluck(selectVideo.external, 'id'), refIds: _.pluck(selectVideo.external, "id"),
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'VOICE', type: "VOICE",
createId: User.getStoreUserId(), createId: User.getStoreUserId()
}) })
} }
if (selectVideo.internal.length) { if (selectVideo.internal.length) {
batchAddList.push({ batchAddList.push({
categoryId: this.props.categoryId, categoryId: this.props.categoryId,
refIds: _.pluck(selectVideo.internal, 'id'), refIds: _.pluck(selectVideo.internal, "id"),
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'VOICE', type: "VOICE",
createId: User.getStoreUserId(), createId: User.getStoreUserId()
}) })
} }
if (selectLive.length) { if (selectLive.length) {
batchAddList.push({ batchAddList.push({
categoryId: this.props.categoryId, categoryId: this.props.categoryId,
refIds: _.pluck(selectLive, 'liveCourseId'), refIds: _.pluck(selectLive, "liveCourseId"),
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'LIVE', type: "LIVE",
createId: User.getStoreUserId(), createId: User.getStoreUserId()
}) })
} }
if (selectPicture.length) { if (selectPicture.length) {
batchAddList.push({ batchAddList.push({
categoryId: this.props.categoryId, categoryId: this.props.categoryId,
refIds: _.pluck(selectPicture, 'id'), refIds: _.pluck(selectPicture, "id"),
storeId: User.getStoreId(), storeId: User.getStoreId(),
type: 'PICTURE', type: "PICTURE",
createId: User.getStoreUserId(), createId: User.getStoreUserId()
}) })
} }
KnowledgeAPI.addDifTypeKnowledge({ batchAddList }).then(({ success }) => { KnowledgeAPI.addDifTypeKnowledge({ batchAddList }).then(({ success }) => {
if (success) { if (success) {
message.success('新增成功') message.success("新增成功")
this.props.onClose() this.props.onClose()
this.props.onChange() this.props.onChange()
this.props.updateCategoryTree() this.props.updateCategoryTree()
...@@ -693,9 +690,9 @@ class AddCourse extends React.Component { ...@@ -693,9 +690,9 @@ class AddCourse extends React.Component {
...videoSearchDefalt, ...videoSearchDefalt,
[e.target.value]: { [e.target.value]: {
courseName: videoQuery[e.target.value].courseName, courseName: videoQuery[e.target.value].courseName,
categoryId: videoQuery[e.target.value].categoryId, categoryId: videoQuery[e.target.value].categoryId
}, }
}, }
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList()
...@@ -738,11 +735,11 @@ class AddCourse extends React.Component { ...@@ -738,11 +735,11 @@ class AddCourse extends React.Component {
selectPicture, selectPicture,
videoSearchDefalt, videoSearchDefalt,
categoryList, categoryList,
categoryListExternal, categoryListExternal
} = this.state } = this.state
const LiveSelection = { const LiveSelection = {
selectedRowKeys: _.pluck(selectLive, 'liveCourseId'), selectedRowKeys: _.pluck(selectLive, "liveCourseId"),
onSelect: this.selectLiveList, onSelect: this.selectLiveList,
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = []
...@@ -752,11 +749,11 @@ class AddCourse extends React.Component { ...@@ -752,11 +749,11 @@ class AddCourse extends React.Component {
_list = _.reject(selectLive, (item) => _.find(changeRows, (data) => data.liveCourseId === item.liveCourseId)) _list = _.reject(selectLive, (item) => _.find(changeRows, (data) => data.liveCourseId === item.liveCourseId))
} }
this.setState({ selectLive: _list }) this.setState({ selectLive: _list })
}, }
} }
const VideoSelection = { const VideoSelection = {
selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], 'id'), selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], "id"),
onSelect: this.selectVideoList, onSelect: this.selectVideoList,
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = []
...@@ -768,14 +765,14 @@ class AddCourse extends React.Component { ...@@ -768,14 +765,14 @@ class AddCourse extends React.Component {
this.setState({ this.setState({
selectVideo: { selectVideo: {
...selectVideo, ...selectVideo,
[videoCourseDivision]: _list, [videoCourseDivision]: _list
}, }
}) })
}, }
} }
const PictureSelection = { const PictureSelection = {
selectedRowKeys: _.pluck(selectPicture, 'id'), selectedRowKeys: _.pluck(selectPicture, "id"),
onSelect: this.selectPictureList, onSelect: this.selectPictureList,
onSelectAll: (selected, _selectedRows, changeRows) => { onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = [] let _list = []
...@@ -785,7 +782,7 @@ class AddCourse extends React.Component { ...@@ -785,7 +782,7 @@ class AddCourse extends React.Component {
_list = _.reject(selectPicture, (item) => _.find(changeRows, (data) => data.id === item.id)) _list = _.reject(selectPicture, (item) => _.find(changeRows, (data) => data.id === item.id))
} }
this.setState({ selectPicture: _list }) this.setState({ selectPicture: _list })
}, }
} }
return ( return (
...@@ -796,28 +793,28 @@ class AddCourse extends React.Component { ...@@ -796,28 +793,28 @@ class AddCourse extends React.Component {
<div> <div>
<Row type='flex' justify='space-between' align='top'> <Row type='flex' justify='space-between' align='top'>
<div> <div>
<span style={{ lineHeight: '32px' }}>课程名称:</span> <span style={{ lineHeight: "32px" }}>课程名称:</span>
<Search <Search
style={{ width: 'calc(100% - 75px)' }} style={{ width: "calc(100% - 75px)" }}
placeholder='搜索课程名称' placeholder='搜索课程名称'
onSearch={(value) => { onSearch={(value) => {
this.handleChangLiveFilter('courseName', value) this.handleChangLiveFilter("courseName", value)
}} }}
enterButton={<span className='icon iconfont'>&#xe832;</span>} enterButton={<span className='icon iconfont'>&#xe832;</span>}
/> />
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: "50%" }}>
<span className='shelf-status'>课程分类:</span> <span className='shelf-status'>课程分类:</span>
<TreeSelect <TreeSelect
treeNodeFilterProp='categoryName' treeNodeFilterProp='categoryName'
showSearch showSearch
style={{ width: 'calc(100% - 75px)' }} style={{ width: "calc(100% - 75px)" }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
treeData={categoryList} treeData={categoryList}
placeholder='请选择课程类型' placeholder='请选择课程类型'
allowClear allowClear
onChange={(value) => { onChange={(value) => {
this.handleChangLiveFilter('categoryId', value) this.handleChangLiveFilter("categoryId", value)
}} }}
/> />
</div> </div>
...@@ -829,10 +826,10 @@ class AddCourse extends React.Component { ...@@ -829,10 +826,10 @@ class AddCourse extends React.Component {
this.setState({ this.setState({
selectVideo: { selectVideo: {
internal: [], internal: [],
external: [], external: []
}, },
selectLive: [], selectLive: [],
selectPicture: [], selectPicture: []
}) })
}} }}
/> />
...@@ -844,7 +841,7 @@ class AddCourse extends React.Component { ...@@ -844,7 +841,7 @@ class AddCourse extends React.Component {
rowSelection={LiveSelection} rowSelection={LiveSelection}
// loading={loading} // loading={loading}
dataSource={liveDataSource} dataSource={liveDataSource}
style={{ maxHeight: 359, overflow: 'scroll' }} style={{ maxHeight: 359, overflow: "scroll" }}
rowKey={(row) => row.liveCourseId} rowKey={(row) => row.liveCourseId}
/> />
{liveTotalCount > 0 && ( {liveTotalCount > 0 && (
...@@ -857,7 +854,7 @@ class AddCourse extends React.Component { ...@@ -857,7 +854,7 @@ class AddCourse extends React.Component {
const _query = { ...liveQuery, current: page + 1 } const _query = { ...liveQuery, current: page + 1 }
this.setState( this.setState(
{ {
liveQuery: _query, liveQuery: _query
}, },
() => { () => {
this.handleFetchLiveList() this.handleFetchLiveList()
...@@ -879,31 +876,32 @@ class AddCourse extends React.Component { ...@@ -879,31 +876,32 @@ class AddCourse extends React.Component {
<div> <div>
<Row type='flex' justify='space-between' align='top'> <Row type='flex' justify='space-between' align='top'>
<div> <div>
<span style={{ lineHeight: '32px' }}>课程名称:</span> <span style={{ lineHeight: "32px" }}>课程名称:</span>
<Search <Search
value={videoSearchDefalt[videoCourseDivision].courseName} value={videoSearchDefalt[videoCourseDivision].courseName}
style={{ width: 'calc(100% - 75px)' }} style={{ width: "calc(100% - 75px)" }}
placeholder='搜索课程名称' placeholder='搜索课程名称'
onChange={this.handleChangVideoCourseName} onChange={this.handleChangVideoCourseName}
onSearch={(value) => { onSearch={(value) => {
this.handleChangVideoFilter('courseName', value) this.handleChangVideoFilter("courseName", value)
}} }}
enterButton={<span className='icon iconfont'>&#xe832;</span>} enterButton={<span className='icon iconfont'>&#xe832;</span>}
/> />
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: "50%" }}>
<span className='shelf-status'>课程分类:</span> <span className='shelf-status'>课程分类:</span>
<TreeSelect <TreeSelect
treeNodeFilterProp='categoryName' treeNodeFilterProp='categoryName'
showSearch showSearch
style={{ minWidth: 'calc(100% - 75px)' }} value={videoQuery[videoCourseDivision].categoryId}
style={{ minWidth: "calc(100% - 75px)" }}
dropdownMatchSelectWidth={false} dropdownMatchSelectWidth={false}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
treeData={videoCourseDivision === 'internal' ? categoryList : categoryListExternal} treeData={videoCourseDivision === "internal" ? categoryList : categoryListExternal}
placeholder='请选择课程类型' placeholder='请选择课程类型'
allowClear allowClear
onChange={(value) => { onChange={(value) => {
this.handleChangVideoFilter('categoryId', value) this.handleChangVideoFilter("categoryId", value)
}} }}
/> />
</div> </div>
...@@ -915,10 +913,10 @@ class AddCourse extends React.Component { ...@@ -915,10 +913,10 @@ class AddCourse extends React.Component {
this.setState({ this.setState({
selectVideo: { selectVideo: {
internal: [], internal: [],
external: [], external: []
}, },
selectLive: [], selectLive: [],
selectPicture: [], selectPicture: []
}) })
}} }}
/> />
...@@ -931,7 +929,7 @@ class AddCourse extends React.Component { ...@@ -931,7 +929,7 @@ class AddCourse extends React.Component {
pagination={false} pagination={false}
bordered bordered
className='video-list-table' className='video-list-table'
style={{ maxHeight: 359, overflow: 'scroll' }} style={{ maxHeight: 359, overflow: "scroll" }}
/> />
<div className='box-footer'> <div className='box-footer'>
...@@ -942,13 +940,13 @@ class AddCourse extends React.Component { ...@@ -942,13 +940,13 @@ class AddCourse extends React.Component {
total={videoTotalCount[videoCourseDivision]} total={videoTotalCount[videoCourseDivision]}
toPage={(page) => { toPage={(page) => {
const _query = { ...videoQuery[videoCourseDivision], current: page + 1 } const _query = { ...videoQuery[videoCourseDivision], current: page + 1 }
console.log('_query', _query) console.log("_query", _query)
this.setState( this.setState(
{ {
videoQuery: { videoQuery: {
...videoQuery, ...videoQuery,
[videoCourseDivision]: _query, [videoCourseDivision]: _query
}, }
}, },
() => { () => {
this.handleFetchVideoList() this.handleFetchVideoList()
...@@ -967,28 +965,28 @@ class AddCourse extends React.Component { ...@@ -967,28 +965,28 @@ class AddCourse extends React.Component {
<div> <div>
<Row type='flex' justify='space-between' align='top'> <Row type='flex' justify='space-between' align='top'>
<div> <div>
<span style={{ lineHeight: '32px' }}>课程名称:</span> <span style={{ lineHeight: "32px" }}>课程名称:</span>
<Search <Search
style={{ width: 'calc(100% - 75px)' }} style={{ width: "calc(100% - 75px)" }}
placeholder='搜索课程名称' placeholder='搜索课程名称'
onSearch={(value) => { onSearch={(value) => {
this.handleChangPictureFilter('courseName', value) this.handleChangPictureFilter("courseName", value)
}} }}
enterButton={<span className='icon iconfont'>&#xe832;</span>} enterButton={<span className='icon iconfont'>&#xe832;</span>}
/> />
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: "50%" }}>
<span className='shelf-status'>课程分类:</span> <span className='shelf-status'>课程分类:</span>
<TreeSelect <TreeSelect
treeNodeFilterProp='categoryName' treeNodeFilterProp='categoryName'
showSearch showSearch
style={{ width: 'calc(100% - 75px)' }} style={{ width: "calc(100% - 75px)" }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
treeData={categoryList} treeData={categoryList}
placeholder='请选择课程类型' placeholder='请选择课程类型'
allowClear allowClear
onChange={(value) => { onChange={(value) => {
this.handleChangPictureFilter('categoryId', value) this.handleChangPictureFilter("categoryId", value)
}} }}
/> />
</div> </div>
...@@ -1000,10 +998,10 @@ class AddCourse extends React.Component { ...@@ -1000,10 +998,10 @@ class AddCourse extends React.Component {
this.setState({ this.setState({
selectVideo: { selectVideo: {
internal: [], internal: [],
external: [], external: []
}, },
selectLive: [], selectLive: [],
selectPicture: [], selectPicture: []
}) })
}} }}
/> />
...@@ -1015,7 +1013,7 @@ class AddCourse extends React.Component { ...@@ -1015,7 +1013,7 @@ class AddCourse extends React.Component {
rowSelection={PictureSelection} rowSelection={PictureSelection}
// loading={loading} // loading={loading}
dataSource={pictureDataSource} dataSource={pictureDataSource}
style={{ maxHeight: 359, overflow: 'scroll' }} style={{ maxHeight: 359, overflow: "scroll" }}
rowKey={(row) => row.id} rowKey={(row) => row.id}
/> />
{pictureTotalCount > 0 && ( {pictureTotalCount > 0 && (
...@@ -1028,7 +1026,7 @@ class AddCourse extends React.Component { ...@@ -1028,7 +1026,7 @@ class AddCourse extends React.Component {
const _query = { ...pictureQuery, current: page + 1 } const _query = { ...pictureQuery, current: page + 1 }
this.setState( this.setState(
{ {
pictureQuery: _query, pictureQuery: _query
}, },
() => { () => {
this.handleFetchPictureList() this.handleFetchPictureList()
......
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