Commit b60095b4 by guomingpang

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

parent dc2446de
......@@ -3,44 +3,44 @@
* @Author: zangsuyun
* @Date: 2021-03-13 09:54:26
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-30 23:52:25
* @LastEditTime: 2021-05-30 23:59:36
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
import React from "react"
import { Row, Modal, Button, message, Radio, Table, Input, Tabs, Tooltip, TreeSelect } from "antd"
import { PageControl } from "@/components"
import TableSelectedData from "@/components/TableSelectedData"
import KnowledgeAPI from "@/data-source/knowledge/request-api"
import AidToolService from "@/domains/aid-tool-domain/AidToolService"
import User from "@/common/js/user"
import "./LiveList.less"
import React from 'react'
import { Row, Modal, Button, message, Radio, Table, Input, Tabs, Tooltip, TreeSelect } from 'antd'
import { PageControl } from '@/components'
import TableSelectedData from '@/components/TableSelectedData'
import KnowledgeAPI from '@/data-source/knowledge/request-api'
import AidToolService from '@/domains/aid-tool-domain/AidToolService'
import User from '@/common/js/user'
import './LiveList.less'
import _ from "underscore"
import dealTimeDuration from "../../course-manage/utils/dealTimeDuration"
import _ from 'underscore'
import dealTimeDuration from '../../course-manage/utils/dealTimeDuration'
const { Search } = Input
const { TabPane } = Tabs
const courseStateShow = {
UN_START: {
code: 1,
title: "待开课",
color: "#FFB129"
title: '待开课',
color: '#FFB129'
},
STARTING: {
code: 2,
title: "上课中",
color: "#238FFF"
title: '上课中',
color: '#238FFF'
},
FINISH: {
code: 3,
title: "已完成",
color: "#3BBDAA"
title: '已完成',
color: '#3BBDAA'
},
EXPIRED: {
code: 4,
title: "未成功开课",
color: "#999"
title: '未成功开课',
color: '#999'
}
}
......@@ -53,14 +53,14 @@ class AddCourse extends React.Component {
liveQuery: {
current: 1,
excludeUsed: true,
courseType: "LIVE",
courseType: 'LIVE',
storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId
},
liveTotalCount: 0,
selectLive: [], //弹窗内已选择的直播课程
videoCourseDivision: "internal",
videoCourseDivision: 'internal',
videoDataSource: {
external: [],
internal: []
......@@ -71,30 +71,30 @@ class AddCourse extends React.Component {
},
videoSearchDefalt: {
external: {
categoryId: "",
courseName: ""
categoryId: '',
courseName: ''
},
internal: {
categoryId: "",
courseName: ""
categoryId: '',
courseName: ''
}
},
videoQuery: {
external: {
categoryId: "",
courseName: "",
categoryId: '',
courseName: '',
current: 1,
courseType: "VOICE",
courseType: 'VOICE',
excludeUsed: true,
storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId
},
internal: {
categoryId: "",
courseName: "",
categoryId: '',
courseName: '',
current: 1,
courseType: "VOICE",
courseType: 'VOICE',
excludeUsed: true,
storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId
......@@ -118,7 +118,7 @@ class AddCourse extends React.Component {
pictureQuery: {
current: 1,
excludeUsed: true,
courseType: "PICTURE",
courseType: 'PICTURE',
storeId: User.getStoreId(),
toRefKnowledgeCategoryId: this.props.categoryId
},
......@@ -142,7 +142,7 @@ class AddCourse extends React.Component {
withCount: false
}
let queryInternal = {
bizType: "QUESTION",
bizType: 'QUESTION',
source: 2,
tenantId: User.getStoreId(),
userId: User.getStoreUserId(),
......@@ -166,7 +166,7 @@ class AddCourse extends React.Component {
let newTreeData = data.map((item) => {
item.title = (
<span>
<span className='icon iconfont' style={{ color: "#FBD140" }}>
<span className='icon iconfont' style={{ color: '#FBD140' }}>
&#xe7f1;&nbsp;
</span>
{item.categoryName}
......@@ -208,7 +208,7 @@ class AddCourse extends React.Component {
const params = {
...videoQuery[videoCourseDivision],
size: videoSize[videoCourseDivision],
courseDivision: videoCourseDivision === "internal" ? "INTERNAL" : "EXTERNAL"
courseDivision: videoCourseDivision === 'internal' ? 'INTERNAL' : 'EXTERNAL'
}
// CourseService.videoSchedulePage(query).then((res) => {
......@@ -300,11 +300,11 @@ class AddCourse extends React.Component {
<i
className='icon iconfont'
style={{
marginLeft: "5px",
cursor: "pointer",
color: "#bfbfbf",
fontSize: "14px",
fontWeight: "400"
marginLeft: '5px',
cursor: 'pointer',
color: '#bfbfbf',
fontSize: '14px',
fontWeight: '400'
}}>
&#xe61d;
</i>
......@@ -312,19 +312,19 @@ class AddCourse extends React.Component {
</span>
),
width: 371,
key: "course",
dataIndex: "courseName",
key: 'course',
dataIndex: 'courseName',
render: (val, record) => {
let hasCover = false
return (
<div className='record__item'>
{record.courseMediaVOS.map((item) => {
if (item.contentType === "COVER") {
if (item.contentType === 'COVER') {
hasCover = true
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>
<Choose>
<When condition={record.courseName.length > 17}>
......@@ -352,30 +352,30 @@ class AddCourse extends React.Component {
}
},
{
title: "上课时间",
title: '上课时间',
width: 110,
key: "couseCatalog",
dataIndex: "couseCatalog",
key: 'couseCatalog',
dataIndex: 'couseCatalog',
render: (val, item) => {
return (
<span className='course-time'>
{formatDate("YYYY-MM-DD", parseInt(item.startTime))} <br></br>
{formatDate("H:i", parseInt(item.startTime))}~{formatDate("H:i", parseInt(item.endTime))}
{formatDate('YYYY-MM-DD', parseInt(item.startTime))} <br></br>
{formatDate('H:i', parseInt(item.startTime))}~{formatDate('H:i', parseInt(item.endTime))}
</span>
)
}
},
{
title: "课程分类",
title: '课程分类',
// width: "10%",
key: "couseCatalog",
dataIndex: "couseCatalog",
key: 'couseCatalog',
dataIndex: 'couseCatalog',
render: (val, record) => {
return (
<div className='categoryName'>
{record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ""}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div>
)
}
......@@ -396,19 +396,19 @@ class AddCourse extends React.Component {
<i
className='icon iconfont'
style={{
marginLeft: "5px",
cursor: "pointer",
color: "#bfbfbf",
fontSize: "14px",
fontWeight: "400"
marginLeft: '5px',
cursor: 'pointer',
color: '#bfbfbf',
fontSize: '14px',
fontWeight: '400'
}}>
&#xe61d;
</i>
</Tooltip>
</span>
),
key: "scheduleName",
dataIndex: "scheduleName",
key: 'scheduleName',
dataIndex: 'scheduleName',
width: 300,
render: (val, record) => {
const { coverUrl, mediaCourseUrl } = record
......@@ -419,9 +419,9 @@ class AddCourse extends React.Component {
className='course-cover'
src={
coverUrl ||
(videoCourseDivision === "internal"
(videoCourseDivision === 'internal'
? `${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=''
/>
......@@ -440,26 +440,26 @@ class AddCourse extends React.Component {
}
},
{
title: "课程时长",
key: "videoDuration",
title: '课程时长',
key: 'videoDuration',
width: 80,
dataIndex: "videoDuration",
dataIndex: 'videoDuration',
render: (text, item) => {
return <span>{text ? dealTimeDuration(text) : "-"}</span>
return <span>{text ? dealTimeDuration(text) : '-'}</span>
}
},
{
title: "课程分类",
key: "categoryName",
dataIndex: "categoryName",
title: '课程分类',
key: 'categoryName',
dataIndex: 'categoryName',
render: (val, record) => {
return (
<Choose>
<When condition={videoCourseDivision === "internal"}>
<When condition={videoCourseDivision === 'internal'}>
<div className='record__item'>
{record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ""}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div>
</When>
<Otherwise>
......@@ -483,26 +483,26 @@ class AddCourse extends React.Component {
<i
className='icon iconfont'
style={{
marginLeft: "5px",
cursor: "pointer",
color: "#bfbfbf",
fontSize: "14px",
fontWeight: "400"
marginLeft: '5px',
cursor: 'pointer',
color: '#bfbfbf',
fontSize: '14px',
fontWeight: '400'
}}>
&#xe61d;
</i>
</Tooltip>
</span>
),
key: "scheduleName",
dataIndex: "scheduleName",
key: 'scheduleName',
dataIndex: 'scheduleName',
width: 371,
render: (val, record) => {
const { coverUrl } = record
return (
<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>
<When condition={record.courseName.length > 25}>
<Tooltip title={record.courseName}>
......@@ -518,14 +518,14 @@ class AddCourse extends React.Component {
}
},
{
title: "课程分类",
key: "categoryName",
dataIndex: "categoryName",
title: '课程分类',
key: 'categoryName',
dataIndex: 'categoryName',
render: (val, record) => {
return (
<div className='record__item'>
{record.categoryOneName}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ""}
{record.categoryTwoName ? `-${record.categoryTwoName}` : ''}
</div>
)
}
......@@ -638,43 +638,43 @@ class AddCourse extends React.Component {
if (selectVideo.external.length) {
batchAddList.push({
categoryId: this.props.categoryId,
refIds: _.pluck(selectVideo.external, "id"),
refIds: _.pluck(selectVideo.external, 'id'),
storeId: User.getStoreId(),
type: "VOICE",
type: 'VOICE',
createId: User.getStoreUserId()
})
}
if (selectVideo.internal.length) {
batchAddList.push({
categoryId: this.props.categoryId,
refIds: _.pluck(selectVideo.internal, "id"),
refIds: _.pluck(selectVideo.internal, 'id'),
storeId: User.getStoreId(),
type: "VOICE",
type: 'VOICE',
createId: User.getStoreUserId()
})
}
if (selectLive.length) {
batchAddList.push({
categoryId: this.props.categoryId,
refIds: _.pluck(selectLive, "liveCourseId"),
refIds: _.pluck(selectLive, 'liveCourseId'),
storeId: User.getStoreId(),
type: "LIVE",
type: 'LIVE',
createId: User.getStoreUserId()
})
}
if (selectPicture.length) {
batchAddList.push({
categoryId: this.props.categoryId,
refIds: _.pluck(selectPicture, "id"),
refIds: _.pluck(selectPicture, 'id'),
storeId: User.getStoreId(),
type: "PICTURE",
type: 'PICTURE',
createId: User.getStoreUserId()
})
}
KnowledgeAPI.addDifTypeKnowledge({ batchAddList }).then(({ success }) => {
if (success) {
message.success("新增成功")
message.success('新增成功')
this.props.onClose()
this.props.onChange()
this.props.updateCategoryTree()
......@@ -739,7 +739,7 @@ class AddCourse extends React.Component {
} = this.state
const LiveSelection = {
selectedRowKeys: _.pluck(selectLive, "liveCourseId"),
selectedRowKeys: _.pluck(selectLive, 'liveCourseId'),
onSelect: this.selectLiveList,
onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = []
......@@ -753,7 +753,7 @@ class AddCourse extends React.Component {
}
const VideoSelection = {
selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], "id"),
selectedRowKeys: _.pluck(selectVideo[videoCourseDivision], 'id'),
onSelect: this.selectVideoList,
onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = []
......@@ -772,7 +772,7 @@ class AddCourse extends React.Component {
}
const PictureSelection = {
selectedRowKeys: _.pluck(selectPicture, "id"),
selectedRowKeys: _.pluck(selectPicture, 'id'),
onSelect: this.selectPictureList,
onSelectAll: (selected, _selectedRows, changeRows) => {
let _list = []
......@@ -793,28 +793,28 @@ class AddCourse extends React.Component {
<div>
<Row type='flex' justify='space-between' align='top'>
<div>
<span style={{ lineHeight: "32px" }}>课程名称:</span>
<span style={{ lineHeight: '32px' }}>课程名称:</span>
<Search
style={{ width: "calc(100% - 75px)" }}
style={{ width: 'calc(100% - 75px)' }}
placeholder='搜索课程名称'
onSearch={(value) => {
this.handleChangLiveFilter("courseName", value)
this.handleChangLiveFilter('courseName', value)
}}
enterButton={<span className='icon iconfont'>&#xe832;</span>}
/>
</div>
<div style={{ width: "50%" }}>
<div style={{ width: '50%' }}>
<span className='shelf-status'>课程分类:</span>
<TreeSelect
treeNodeFilterProp='categoryName'
showSearch
style={{ width: "calc(100% - 75px)" }}
dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
style={{ width: 'calc(100% - 75px)' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={categoryList}
placeholder='请选择课程类型'
allowClear
onChange={(value) => {
this.handleChangLiveFilter("categoryId", value)
this.handleChangLiveFilter('categoryId', value)
}}
/>
</div>
......@@ -841,7 +841,7 @@ class AddCourse extends React.Component {
rowSelection={LiveSelection}
// loading={loading}
dataSource={liveDataSource}
style={{ maxHeight: 359, overflow: "scroll" }}
style={{ maxHeight: 359, overflow: 'scroll' }}
rowKey={(row) => row.liveCourseId}
/>
{liveTotalCount > 0 && (
......@@ -876,32 +876,32 @@ class AddCourse extends React.Component {
<div>
<Row type='flex' justify='space-between' align='top'>
<div>
<span style={{ lineHeight: "32px" }}>课程名称:</span>
<span style={{ lineHeight: '32px' }}>课程名称:</span>
<Search
value={videoSearchDefalt[videoCourseDivision].courseName}
style={{ width: "calc(100% - 75px)" }}
style={{ width: 'calc(100% - 75px)' }}
placeholder='搜索课程名称'
onChange={this.handleChangVideoCourseName}
onSearch={(value) => {
this.handleChangVideoFilter("courseName", value)
this.handleChangVideoFilter('courseName', value)
}}
enterButton={<span className='icon iconfont'>&#xe832;</span>}
/>
</div>
<div style={{ width: "50%" }}>
<div style={{ width: '50%' }}>
<span className='shelf-status'>课程分类:</span>
<TreeSelect
treeNodeFilterProp='categoryName'
showSearch
value={videoQuery[videoCourseDivision].categoryId}
style={{ minWidth: "calc(100% - 75px)" }}
style={{ minWidth: 'calc(100% - 75px)' }}
dropdownMatchSelectWidth={false}
dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
treeData={videoCourseDivision === "internal" ? categoryList : categoryListExternal}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={videoCourseDivision === 'internal' ? categoryList : categoryListExternal}
placeholder='请选择课程类型'
allowClear
onChange={(value) => {
this.handleChangVideoFilter("categoryId", value)
this.handleChangVideoFilter('categoryId', value)
}}
/>
</div>
......@@ -929,7 +929,7 @@ class AddCourse extends React.Component {
pagination={false}
bordered
className='video-list-table'
style={{ maxHeight: 359, overflow: "scroll" }}
style={{ maxHeight: 359, overflow: 'scroll' }}
/>
<div className='box-footer'>
......@@ -940,7 +940,7 @@ class AddCourse extends React.Component {
total={videoTotalCount[videoCourseDivision]}
toPage={(page) => {
const _query = { ...videoQuery[videoCourseDivision], current: page + 1 }
console.log("_query", _query)
console.log('_query', _query)
this.setState(
{
videoQuery: {
......@@ -965,28 +965,28 @@ class AddCourse extends React.Component {
<div>
<Row type='flex' justify='space-between' align='top'>
<div>
<span style={{ lineHeight: "32px" }}>课程名称:</span>
<span style={{ lineHeight: '32px' }}>课程名称:</span>
<Search
style={{ width: "calc(100% - 75px)" }}
style={{ width: 'calc(100% - 75px)' }}
placeholder='搜索课程名称'
onSearch={(value) => {
this.handleChangPictureFilter("courseName", value)
this.handleChangPictureFilter('courseName', value)
}}
enterButton={<span className='icon iconfont'>&#xe832;</span>}
/>
</div>
<div style={{ width: "50%" }}>
<div style={{ width: '50%' }}>
<span className='shelf-status'>课程分类:</span>
<TreeSelect
treeNodeFilterProp='categoryName'
showSearch
style={{ width: "calc(100% - 75px)" }}
dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
style={{ width: 'calc(100% - 75px)' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={categoryList}
placeholder='请选择课程类型'
allowClear
onChange={(value) => {
this.handleChangPictureFilter("categoryId", value)
this.handleChangPictureFilter('categoryId', value)
}}
/>
</div>
......@@ -1013,7 +1013,7 @@ class AddCourse extends React.Component {
rowSelection={PictureSelection}
// loading={loading}
dataSource={pictureDataSource}
style={{ maxHeight: 359, overflow: "scroll" }}
style={{ maxHeight: 359, overflow: 'scroll' }}
rowKey={(row) => row.id}
/>
{pictureTotalCount > 0 && (
......
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