Commit fc15d202 by guomingpang

feat:外部课程相关模块提交

parent 556c0d4e
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-08-05 10:11:57
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-25 10:53:11
* @LastEditTime: 2021-05-27 15:42:08
* @Description: 视频课-搜索模块
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -27,12 +27,12 @@ const DEFAULT_QUERY = {
beginTime: null, // 开始日期
endTime: null, // 结束日期
shelfState: null,
categoryId: null
categoryId: null,
}
const defaultTeacherQuery = {
size: 10,
current: 1,
nickName: null
nickName: null,
}
class VideoCourseFilter extends React.Component {
constructor(props) {
......@@ -42,7 +42,7 @@ class VideoCourseFilter extends React.Component {
teacherQuery: defaultTeacherQuery,
teacherList: [],
expandFilter: false,
categoryList: []
categoryList: [],
}
}
shouldComponentUpdate(nextProps) {
......@@ -63,12 +63,12 @@ class VideoCourseFilter extends React.Component {
source: 2,
tenantId: User.getStoreId(),
userId: User.getStoreUserId(),
count: false
count: false,
}
AidToolService.queryExternalCategoryTree(query).then((res) => {
const { categoryList = [] } = res.result
this.setState({
categoryList: this.renderTreeNodes(categoryList)
categoryList: this.renderTreeNodes(categoryList),
})
})
}
......@@ -97,7 +97,7 @@ class VideoCourseFilter extends React.Component {
const _query = {
...teacherQuery,
current,
size: 10
size: 10,
}
StoreService.getStoreUserBasicPage(_query).then((res) => {
const { result = {} } = res
......@@ -105,7 +105,7 @@ class VideoCourseFilter extends React.Component {
const list = current > 1 ? teacherList.concat(records) : records
this.setState({
hasNext,
teacherList: list
teacherList: list,
})
})
}
......@@ -120,7 +120,7 @@ class VideoCourseFilter extends React.Component {
_teacherQuery.current = _teacherQuery.current + 1
this.setState(
{
teacherQuery: { ..._teacherQuery }
teacherQuery: { ..._teacherQuery },
},
() => {
this.getTeacherList(_teacherQuery.current)
......@@ -136,8 +136,8 @@ class VideoCourseFilter extends React.Component {
...this.state.query,
[field]: value,
current: 1
}
current: 1,
},
},
() => {
if (field === 'courseName') return
......@@ -147,20 +147,21 @@ class VideoCourseFilter extends React.Component {
}
handleChangeDates = (dates) => {
console.log(dates)
const query = _.clone(this.state.query)
if (_.isEmpty(dates)) {
delete query.beginTime
delete query.endTime
} else {
query.beginTime = dates[0].valueOf()
query.endTime = dates[1].valueOf()
query.beginTime = dates[0]?.startOf('day').valueOf()
query.endTime = dates[1]?.endOf('day').valueOf()
}
this.setState(
{
query: {
...query,
current: 1
}
current: 1,
},
},
() => {
this.props.onChange(this.state.query)
......@@ -172,7 +173,7 @@ class VideoCourseFilter extends React.Component {
handleReset = () => {
this.setState(
{
query: DEFAULT_QUERY
query: DEFAULT_QUERY,
},
() => {
this.props.onChange(this.state.query)
......@@ -183,11 +184,11 @@ class VideoCourseFilter extends React.Component {
render() {
const { currentTabKey } = this.props
const {
query: { courseName, beginTime, endTime, operatorId, shelfState },
query: { courseName, beginTime, endTime, operatorId, shelfState, categoryId },
expandFilter,
teacherList,
teacherQuery,
categoryList
categoryList,
} = this.state
return (
......@@ -233,7 +234,7 @@ class VideoCourseFilter extends React.Component {
teacherQuery.nickName = value
this.setState(
{
teacherQuery
teacherQuery,
},
() => {
this.getTeacherList()
......@@ -246,8 +247,8 @@ class VideoCourseFilter extends React.Component {
teacherQuery: {
size: 10,
current: 1,
nickName: null
}
nickName: null,
},
},
() => {
this.getTeacherList()
......@@ -268,7 +269,7 @@ class VideoCourseFilter extends React.Component {
<div className='search-condition__item'>
<span className='shelf-status'>课程分类:</span>
<TreeSelect
// value={}
value={categoryId || null}
style={{ width: 'calc(100% - 75px)' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={categoryList}
......
<<<<<<< HEAD
=======
/*
* @Author: 吴文洁
* @Date: 2020-08-05 10:12:45
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-28 13:32:59
* @Description: 视频课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
>>>>>>> 4399d60 (fix:修复外部课程相关模块bug)
import React from 'react'
import { Table, Modal, message, Tooltip, Switch, Dropdown } from 'antd'
import _ from 'underscore'
import { PageControl } from '@/components'
import { LIVE_SHARE } from '@/domains/course-domain/constants'
......@@ -20,8 +31,18 @@ class VideoCourseList extends React.Component {
studentIds: [],
RelatedPlanModalVisible: false,
selectPlanList: {},
}
}
ShelfLoading: false,
// dataSource: [],
}
}
// static getDerivedStateFromProps(props, state) {
// const { dataSource: propsDataSource } = props,{dataSource:stateDataSource} =state
// const istrue = _.isEqual(propsDataSource, stateDataSource)
// if (!istrue) {
// state.dataSource = propsDataSource
// }
// console.log(istrue, 'istrue')
// }
componentDidMount() {
const videoCourseItem = localStorage.getItem('videoCourseItem')
......@@ -33,8 +54,6 @@ class VideoCourseList extends React.Component {
// 观看数据弹窗
handleShowWatchDataModal = (record) => {
console.log('111')
console.log('record', record)
const watchDataModal = (
<WatchDataModal
type='videoCourseList'
......@@ -52,6 +71,7 @@ class VideoCourseList extends React.Component {
// 请求表头
parseColumns = () => {
const { type } = this.props
const { ShelfLoading } = this.state
const columns = [
{
title: '视频课',
......@@ -88,7 +108,18 @@ class VideoCourseList extends React.Component {
},
},
{
title: '课程分类',
title: (
<span>
<span>课程分类</span>
<If condition={type !== 'internal'}>
<Tooltip title={<div>外部课程的分类由系统提供,不影响企业课程分类。</div>}>
<i className='icon iconfont' style={{ marginLeft: '5px', cursor: 'pointer', color: '#bfbfbf', fontSize: '14px' }}>
&#xe61d;
</i>
</Tooltip>
</If>
</span>
),
key: 'categoryName',
dataIndex: 'categoryName',
width: 200,
......@@ -102,7 +133,7 @@ class VideoCourseList extends React.Component {
</div>
</When>
<Otherwise>
<div className='record__item'>{record.categoryName}</div>
<div className='record__item'>{record.categorySonName}</div>
</Otherwise>
</Choose>
)
......@@ -144,9 +175,31 @@ class VideoCourseList extends React.Component {
</span>
),
width: 120,
dataIndex: 'courseware',
key: 'shelfState',
dataIndex: 'shelfState',
// shouldCellUpdate: (record, prevRecord) => {
// // console.log(record.shelfState, prevRecord.shelfState)
// return true
// },
render: (val, item, index) => {
return <Switch defaultChecked={item.shelfState === 'YES' ? true : false} onChange={() => this.changeShelfState(item)} />
console.log(val, item.shelfState === 'YES', 'aaa')
return (
<Switch
loading={ShelfLoading}
checkedChildren='ON'
unCheckedChildren='OFF'
checked={item.shelfState === 'YES'}
defaultChecked={item.shelfState}
onClick={(checked) => {
console.log('checked', checked)
this.changeShelfState(checked, item, index)
}}
// onChange={() => {
// return false
// this.changeShelfState(item)
// }}
/>
)
},
},
{
......@@ -155,7 +208,7 @@ class VideoCourseList extends React.Component {
key: 'watchUserCount',
dataIndex: 'watchUserCount',
render: (val, item) => {
return <div className='watchUserCount'>{val}</div>
return <div className='watchUserCount'>{val || 0}</div>
},
},
{
......@@ -226,7 +279,7 @@ class VideoCourseList extends React.Component {
<Dropdown overlay={this.renderMoreOperate(record)}>
<span className='more-operate'>
<span className='operate-text'>更多</span>
<span className='iconfont icon' style={{ color: '#5289FA' }}>
<span className='iconfont icon' style={{ color: '#2966FF' }}>
&#xe824;
</span>
</span>
......@@ -278,27 +331,24 @@ class VideoCourseList extends React.Component {
return planStr
}
//改变上架状态
changeShelfState = (item) => {
let _shelfState = item.shelfState
if (_shelfState === 'NO') {
changeShelfState = (checked, item, index) => {
let _shelfState = checked ? 'YES' : 'NO'
if (checked) {
_shelfState = 'YES'
item.shelfState = 'YES'
} else {
_shelfState = 'NO'
item.shelfState = 'NO'
}
const params = {
courseId: item.id,
shelfState: _shelfState,
}
CourseService.changeVideoShelfState(params).then((res) => {
if (res.success) {
CourseService.changeVideoShelfState(params).then(() => {
if (_shelfState === 'YES') {
message.success('已开启展示')
} else {
message.success('已取消展示')
}
}
this.props.changeShelfState(index, _shelfState)
})
}
......
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-08-05 10:08:06
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-25 20:36:46
* @LastEditTime: 2021-05-27 17:32:07
* @Description: 云课堂-视频课入口页面
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -22,11 +22,11 @@ class VideoCourse extends React.Component {
query: {
size: 10,
current: 1,
storeId: User.getStoreId()
storeId: User.getStoreId(),
},
dataSource: [], // 视频课列表
totalCount: 0, // 视频课数据总条数
currentTabKey: 'internal'
currentTabKey: 'internal',
}
}
......@@ -42,7 +42,7 @@ class VideoCourse extends React.Component {
...this.state.query,
..._query,
courseDivision: currentTabKey === 'external' ? 1 : null
courseDivision: currentTabKey === 'external' ? 1 : null,
}
// 更新请求参数
......@@ -54,13 +54,13 @@ class VideoCourse extends React.Component {
if (Number(total) && query.size * (query.current - 1) >= Number(total)) {
this.handleFetchScheduleList({
...query,
current: 1
current: 1,
})
return
}
this.setState({
dataSource: records,
totalCount: Number(total)
totalCount: Number(total),
})
})
}
......@@ -71,14 +71,21 @@ class VideoCourse extends React.Component {
currentTabKey,
query: {
...query,
current: 1
}
current: 1,
},
},
() => {
this.handleFetchScheduleList()
}
)
}
changeShelfState = (index, shelfState) => {
const { dataSource } = this.state
dataSource[index].shelfState = shelfState
this.setState({
dataSource,
})
}
render() {
const { dataSource, totalCount, query, currentTabKey } = this.state
......@@ -99,7 +106,14 @@ class VideoCourse extends React.Component {
<VideoCourseOpt />
</If>
{/* 视频课列表模块 */}
<VideoCourseList type={currentTabKey} query={query} dataSource={dataSource} totalCount={totalCount} onChange={this.handleFetchScheduleList} />
<VideoCourseList
type={currentTabKey}
query={query}
dataSource={dataSource}
totalCount={totalCount}
onChange={this.handleFetchScheduleList}
changeShelfState={this.changeShelfState}
/>
</div>
</div>
)
......
......@@ -2,23 +2,28 @@
* @Description:
* @Author: zangsuyun
* @Date: 2021-03-12 10:43:10
* @LastEditors: zangsuyun
* @LastEditTime: 2021-04-10 16:39:30
<<<<<<< HEAD
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-28 13:33:07
=======
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-27 13:51:42
>>>>>>> 4399d60 (fix:修复外部课程相关模块bug)
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
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 KnowledgeBaseOpt from './components/KnowledgeBaseOpt'
import KnowledgeBaseList from './components/KnowledgeBaseList'
import Classification from './components/Classification'
import KnowledgeAPI from "@/data-source/knowledge/request-api";
import User from "@/common/js/user";
import KnowledgeAPI from '@/data-source/knowledge/request-api'
import User from '@/common/js/user'
export default class KnowledgeBase extends React.Component {
constructor(props) {
super(props);
super(props)
this.state = {
query: {
size: 10,
......@@ -30,82 +35,68 @@ export default class KnowledgeBase extends React.Component {
totalCount: 0, // 知识库数据总条数
categoryId: '0',
updateCategoryFlag: false,
};
}
}
componentWillMount() {
// 获取知识库列表
this.handleFetchScheduleList();
this.handleFetchScheduleList()
// this.getCategoryTree()
}
getSelectedCategoryId = (categoryId) => {
this.setState({
categoryId,
});
this.handleFetchScheduleList({ categoryId,current:1 });
};
})
this.handleFetchScheduleList({ categoryId, current: 1 })
}
// 更新分类树
updateCategoryTree = () => {
this.setState({
updateCategoryFlag: !this.state.updateCategoryFlag,
});
};
})
}
// 获取知识库列表
handleFetchScheduleList = (_query = {},flag = true) => {
handleFetchScheduleList = (_query = {}, flag = true) => {
const query = {
...this.state.query,
..._query,
};
}
// 更新请求参数
this.setState({ query });
this.setState({ query })
flag && KnowledgeAPI.queryPageKnowledgeForManager(query).then((res) => {
flag &&
KnowledgeAPI.queryPageKnowledgeForManager(query).then((res) => {
// KnowledgeAPI.videoSchedulePage(query).then((res) => {
const { result = {} } = res || {};
const { records = [], total = 0 } = result;
const { result = {} } = res || {}
const { records = [], total = 0 } = result
this.setState({
dataSource: records,
totalCount: Number(total),
});
});
};
})
})
}
render() {
const {
dataSource,
totalCount,
query,
categoryId,
updateCategoryFlag,
} = this.state;
const { dataSource, totalCount, query, categoryId, updateCategoryFlag } = this.state
return (
<div className="page">
<div className="content-header">知识库</div>
<div className='page'>
<div className='content-header'>知识库</div>
<div className="box" style={{ display: "flex" }}>
<div className='box' style={{ display: 'flex' }}>
{/* 搜索模块 */}
<div className="left" style={{ width: 245 }}>
<Classification
updateCategoryFlag={updateCategoryFlag}
categoryId={categoryId}
getSelectedCategoryId={this.getSelectedCategoryId}
/>
<div className='left' style={{ width: 245 }}>
<Classification updateCategoryFlag={updateCategoryFlag} categoryId={categoryId} getSelectedCategoryId={this.getSelectedCategoryId} />
</div>
<div
className="liner"
style={{ backgroundColor: "rgb(238, 238, 238)", width: 0.5, margin: "1px 16px 1px 2px" }}
></div>
<div className="right" style={{ width: "calc(100% - 285px)" }}>
<div className='liner' style={{ backgroundColor: 'rgb(238, 238, 238)', width: 0.5, margin: '1px 16px 1px 2px' }}></div>
<div className='right' style={{ width: 'calc(100% - 285px)' }}>
<KnowledgeBaseFilter onChange={this.handleFetchScheduleList} />
{/* 操作模块 */}
{categoryId != 0 && <KnowledgeBaseOpt
onChange={this.handleFetchScheduleList}
updateCategoryTree={this.updateCategoryTree}
categoryId={categoryId}
/>}
{categoryId !== '0' && (
<KnowledgeBaseOpt onChange={this.handleFetchScheduleList} updateCategoryTree={this.updateCategoryTree} categoryId={categoryId} />
)}
{/* 知识库列表模块 */}
<KnowledgeBaseList
......@@ -119,6 +110,6 @@ export default class KnowledgeBase extends React.Component {
</div>
</div>
</div>
);
)
}
}
import React from 'react'
import { withRouter } from 'react-router-dom'
import { Table, Modal, Input, message, Tooltip } from 'antd'
import { Table, Modal, message, Tooltip } from 'antd'
import { PageControl } from '@/components'
import UserLearningDataFilter from './UserLearningDataFilter'
import PlanService from '@/domains/plan-domain/planService'
......@@ -8,8 +8,6 @@ import UserLearnDetailModal from '../modal/UserLearnDetailModal'
import UnbundEmployeeModal from '../modal/UnbundEmployeeModal'
import User from '@/common/js/user'
import './UserLearningData.less'
const userRole = User.getUserRole()
const { Search } = Input
const { confirm } = Modal
const LearnState = {
UN_PLAY: {
......
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