Commit 9ce8980e by wufan

feat:接入上课数据接口

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