Commit 9ce8980e by wufan

feat:接入上课数据接口

parent 51ae25de
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-12-12 11:57:10 * @Date: 2020-12-12 11:57:10
* @LastEditors: zhangleyuan * @LastEditors: wufan
* @LastEditTime: 2020-12-15 12:55:55 * @LastEditTime: 2020-12-15 14:26:47
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -11,7 +11,7 @@ import Service from "@/common/js/service"; ...@@ -11,7 +11,7 @@ import Service from "@/common/js/service";
export function fetchLecturerData(params: object) { export function fetchLecturerData(params: object) {
return Service.Hades("public/courseCloud/queryTeacherVisitData", params); return Service.Hades("public/courseCloud/queryTeacherVisitData", params);
} }
export function fetchUserData(params: object) { export function fetchUserData(params: object) {
return Service.Hades("public/courseCloud/queryStudentVisitData", params); return Service.Hades("public/courseCloud/queryStudentVisitData", params);
...@@ -24,3 +24,14 @@ export function createLiveCloudCourse(params: object) { ...@@ -24,3 +24,14 @@ export function createLiveCloudCourse(params: object) {
export function getLiveCloudCoursePage(params: object) { export function getLiveCloudCoursePage(params: object) {
return Service.Hades("public/courseCloud/getLiveCloudCoursePage", params); return Service.Hades("public/courseCloud/getLiveCloudCoursePage", params);
} }
export function exportStudentCourseData(params: object) {
return Service.Hades("public/courseCloud/exportCourseCloudVisitorAsync", params);
}
export function exportPlayBackCourseData(params: object) {
return Service.Hades("public/courseCloud/exportCourseCloudPlayBackSync", params);
}
export function fetchPlaybackList(params: object) {
return Service.Hades("public/courseCloud/getUserReplayRecordPage", params);
}
\ No newline at end of file
/* /*
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan * @LastEditors: wufan
* @LastEditTime: 2020-12-15 12:56:16 * @LastEditTime: 2020-12-15 14:27:36
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { fetchLecturerData, fetchUserData,createLiveCloudCourse,getLiveCloudCoursePage} from '@/data-source/course/request-api'; import { fetchLecturerData, fetchUserData, exportStudentCourseData, createLiveCloudCourse, getLiveCloudCoursePage, exportPlayBackCourseData, fetchPlaybackList } from '@/data-source/course/request-api';
export default class courseService { export default class courseService {
// 获取讲师上课数据 // 获取讲师上课数据
...@@ -24,4 +24,20 @@ export default class courseService { ...@@ -24,4 +24,20 @@ export default class courseService {
static getLiveCloudCoursePage(params: any) { static getLiveCloudCoursePage(params: any) {
return getLiveCloudCoursePage(params); return getLiveCloudCoursePage(params);
} }
// 导出学生上课数据
static exportStudentCourseData(params: any) {
return exportStudentCourseData(params);
}
// 导出回放数据
static exportPlayBackCourseData(params: any) {
return exportPlayBackCourseData(params);
}
// 获取回放数据
static fetchPlaybackList(params: any) {
return fetchPlaybackList(params);
}
} }
\ No newline at end of file
...@@ -2,89 +2,52 @@ import React from "react"; ...@@ -2,89 +2,52 @@ import React from "react";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import { import {
Table, Table,
Tooltip,
Popover, Popover,
Select,
message, message,
Modal,
Button, Button,
Popconfirm,
Spin, Spin,
Checkbox,
} from "antd"; } from "antd";
import dealTimeDuration from "../utils/dealTimeDuration"; import dealTimeDuration from "../utils/dealTimeDuration";
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import Bus from "@/core/bus";
import CourseService from "@/domains/course-domain/CourseService"; import CourseService from "@/domains/course-domain/CourseService";
import User from '@/common/js/user';
import "./DataList.less"; import "./DataList.less";
class DataList extends React.Component { class DataList extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const courseId = getParameterByName("id"); // 课程ID const courseId = getParameterByName("id"); // 课程ID
const type = getParameterByName("type"); // 来源: 大班直播 large 互动班课 interactive const type = getParameterByName("type"); // 来源: 大班直播 large 互动班课 interactive
const instId = window.currentUserInstInfo.instId || LS.get("instId"); // 机构ID
console.log("course-data");
this.state = { this.state = {
courseId,
type, type,
instId,
teacherData: [], // 老师上课数据 teacherData: [], // 老师上课数据
studentData: [], // 学员上课数据 studentData: [], // 学员上课数据
courseInfo: {}, // 课程信息
liveSignState: "",
nameOrPhone: "", // 搜索学员姓名/手机号
current: 1, current: 1,
size: 10, // 添加扣课时学员弹窗回填所需 当前接口返回全部列表 size: 10, // 添加扣课时学员弹窗回填所需 当前接口返回全部列表
total: 0, total: 0,
loading: false, loading: true,
liveCourseId: courseId, liveCourseId: courseId,
phone storeId: User.getStoreId()
}; };
} }
componentDidMount() { componentDidMount() {
// this.fetchCourseInfo(); this.fetchLecturerData();
// this.fetchLecturerData(); this.fetchUserData();
// this.fetchUserData();
} }
// 获取课程信息
fetchCourseInfo() {
// axios
// .Apollo('public/businessLive/getCourseDetail', {
// liveCourseId: this.state.courseId,
// })
// .then((res) => {
// const { result = {} } = res;
// const courseInfo = result;
// this.setState({
// courseInfo,
// });
// });
}
// 获取学员上课数据 // 获取学员上课数据
fetchUserData = (current = 1) => { fetchUserData = (current = 1) => {
this.setState({ loading: true }); this.setState({ loading: true });
const { courseId, size, nameOrPhone, liveSignState } = this.state; const { liveCourseId, size } = this.state;
const params = { const params = {
liveCourseId: courseId, liveCourseId,
current, current,
size, size,
nameOrPhone,
liveSignState,
}; };
if (!params.liveSignState) { CourseService.fetchUserData(params).then((res) => {
delete params.liveSignState;
}
CourseService.getEmployeeList(_query).then((res) => {
if (res.result) { if (res.result) {
const { records = [], current, size, total } = res.result; const { records = [], current, size, total } = res.result;
records.forEach((item) => {
item.edit = false;
item.courseBag = [];
});
this.setState({ this.setState({
studentData: records, studentData: records,
current, current,
...@@ -94,51 +57,17 @@ class DataList extends React.Component { ...@@ -94,51 +57,17 @@ class DataList extends React.Component {
}); });
} }
}); });
// window.axios
// .Apollo("public/businessLive/queryStudentVisitData", params)
// .then((res) => {
// if (res.result) {
// const { records = [], current, size, total } = res.result;
// records.forEach(item => {
// item.edit = false;
// item.courseBag = [];
// });
// this.setState({
// studentData: records,
// current,
// size,
// total,
// loading: false,
// }
// );
// }
// });
}; };
// 获取老师上课数据 // 获取老师上课数据
fetchLecturerData = () => { fetchLecturerData = () => {
CourseService.getEmployeeList(_query).then((res) => { const { liveCourseId } = this.state;
CourseService.fetchLecturerData({ liveCourseId }).then((res) => {
if (res.result) { if (res.result) {
const teacherData = [res.result]; this.setState({
this.setState( teacherData: res.result,
{ });
teacherData,
}
);
} }
}); });
// window.axios
// .Apollo('public/businessLive/queryTeacherVisitData', { liveCourseId: this.state.courseId })
// .then((res) => {
// if (res.result) {
// const teacherData = [res.result];
// this.setState(
// {
// teacherData,
// }
// );
// }
// });
}; };
// 进入直播次数列表 // 进入直播次数列表
...@@ -191,36 +120,8 @@ class DataList extends React.Component { ...@@ -191,36 +120,8 @@ class DataList extends React.Component {
title: "手机号", title: "手机号",
dataIndex: "phone", dataIndex: "phone",
render: (text, record) => { render: (text, record) => {
const { phone, bindingWeChat } = record; const { phone = "", bindingWeChat } = record;
return ( return <div>{phone}</div>;
<div>
{phone}
{
<Tooltip
title={`${bindingWeChat ? "已绑定微信" : "未绑定微信"}`}
>
<span
className="icon iconfont"
style={
bindingWeChat
? {
color: "#00D20D",
fontSize: "16px",
marginLeft: 6,
}
: {
fontSize: "16px",
color: "#BFBFBF",
marginLeft: 6,
}
}
>
&#xe68d;
</span>
</Tooltip>
}
</div>
);
}, },
}, },
{ {
...@@ -273,29 +174,22 @@ class DataList extends React.Component { ...@@ -273,29 +174,22 @@ class DataList extends React.Component {
} }
// 学员导出5.0 // 学员导出5.0
handleExportV5 = () => { handleExportV5 = () => {
const { type, courseId } = this.state; const { courseId, storeId } = this.state;
const url =
type === "large" CourseService.exportStudentCourseData({
? "public/businessLive/exportLargeClassLiveAsync" liveCourseId: courseId,
: "public/businessLive/exportClassInteractionLiveSync"; exportLiveType: "VISITOR",
// window.axios storeId
// .Apollo(url, { }).then((res) => {
// liveCourseId: courseId, if(res.success){
// exportLiveType: 'VISITOR', message.success("导出成功!")
// }) }
// .then((res) => { });
// Bus.trigger('get_download_count');
// Modal.success({
// title: '导出任务提交成功',
// content: '请前往右上角的“任务中心”进行下载',
// okText: '我知道了',
// });
// });
}; };
handleCheckEnterTimes = () => { handleCheckEnterTimes = () => {
const { teacherData } = this.state; const { teacherData } = this.state;
if (teacherData.times > 0) { if (teacherData.entryNum > 0) {
if ( if (
teacherData.visitorInfoVOList && teacherData.visitorInfoVOList &&
teacherData.visitorInfoVOList.length > 0 teacherData.visitorInfoVOList.length > 0
...@@ -319,7 +213,7 @@ class DataList extends React.Component { ...@@ -319,7 +213,7 @@ class DataList extends React.Component {
return <div className="live-table--empty">暂无观看数据</div>; return <div className="live-table--empty">暂无观看数据</div>;
} }
} else { } else {
return <span>{teacherData.times}</span>; return <span>{teacherData.entryNum}</span>;
} }
}; };
...@@ -348,7 +242,7 @@ class DataList extends React.Component { ...@@ -348,7 +242,7 @@ class DataList extends React.Component {
className="avatar" className="avatar"
/> />
<div className="right"> <div className="right">
<div className="name">{teacherData.name || "王凯凯"}</div> <div className="name">{teacherData.userName || "王凯凯"}</div>
<div className="phone"> <div className="phone">
{teacherData.phone || "13888884388"} {teacherData.phone || "13888884388"}
</div> </div>
...@@ -358,20 +252,20 @@ class DataList extends React.Component { ...@@ -358,20 +252,20 @@ class DataList extends React.Component {
<div className="times item-block"> <div className="times item-block">
<div <div
className={`times-num ${ className={`times-num ${
Number(teacherData.times) > 0 ? "can-click" : "" Number(teacherData.entryNum) > 0 ? "can-click" : ""
}`} }`}
onClick={() => { onClick={() => {
this.handleCheckEnterTimes(); this.handleCheckEnterTimes();
}} }}
> >
{teacherData.times || "47"} {teacherData.entryNum || "47"}
</div> </div>
<div className="text">进入直播间次数</div> <div className="text">进入直播间次数</div>
</div> </div>
<div className="online-duration item-block"> <div className="online-duration item-block">
<div className="duration"> <div className="duration">
{dealTimeDuration(teacherData.duration) || "20:30:45"} {dealTimeDuration(teacherData.totalDuration) || "20:30:45"}
</div> </div>
<div className="text">累计在线时长</div> <div className="text">累计在线时长</div>
</div> </div>
......
import React from 'react'; import React from 'react';
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import { Table, Button, Modal } from 'antd'; import { Table, Button, Modal } from 'antd';
import dealTimeDuration from '../utils/dealTimeDuration'; import dealTimeDuration from '../utils/dealTimeDuration';
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import Bus from '@/core/bus';
import './DataList.less'; import './DataList.less';
import CourseService from "@/domains/course-domain/CourseService";
import User from '@/common/js/user';
const liveTypeMap = { const liveTypeMap = {
USER: "学生", USER: "学生",
ANCHOR: "老师", ANCHOR: "老师",
...@@ -23,7 +19,8 @@ class PlaybackData extends React.Component { ...@@ -23,7 +19,8 @@ class PlaybackData extends React.Component {
playbackData: [], playbackData: [],
current: 1, current: 1,
size: 10, size: 10,
total: 0 total: 0,
storeId: User.getStoreId()
} }
} }
...@@ -38,19 +35,19 @@ class PlaybackData extends React.Component { ...@@ -38,19 +35,19 @@ class PlaybackData extends React.Component {
current: page, current: page,
size: size size: size
} }
// window.axios
// .Apollo("public/businessLive/queryUserReplayRecordPage", params) CourseService.fetchPlaybackList(params).then((res) => {
// .then((res) => { if (res.result) {
// if (res.result) { const { records = [], current, size, total } = res.result;
// const { records = [], current, size, total } = res.result; this.setState({
// this.setState({ playbackData: records,
// playbackData: records, current,
// current, size,
// size, total
// total });
// }); }
// } });
// });
}; };
getPlaybackColumns() { getPlaybackColumns() {
const columns = [ const columns = [
...@@ -87,19 +84,16 @@ class PlaybackData extends React.Component { ...@@ -87,19 +84,16 @@ class PlaybackData extends React.Component {
} }
// 导出 // 导出
handleplaybackExport() { handleplaybackExport() {
const type = getParameterByName("type"); const { storeId } = this.state;
const url = type === 'large' ? 'public/businessLive/exportLargeClassLiveAsync' : 'public/businessLive/exportClassInteractionLiveSync'; CourseService.exportPlayBackCourseData({
// window.axios.Apollo(url, { liveCourseId: getParameterByName("id"),
// liveCourseId: getParameterByName("id"), exportLiveType: "PLAY_BACK",
// exportLiveType: 0 storeId
// }).then((res) => { }).then((res) => {
// Bus.trigger('get_download_count'); if(res.success){
// Modal.success({ message.success("导出成功!")
// title: '导出任务提交成功', }
// content: '请前往右上角的“' + window.NewVersion?'任务中心' : '导出中心' + '”进行下载', })
// okText: <span id="I_know">我知道了</span>,
// });
// })
} }
render() { render() {
......
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