Commit 42ba818f by wufan

feat:完成直播课和视频课分享功能

parent 80ea47d4
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:51
* @LastEditors: wufan
* @LastEditTime: 2020-12-17 14:14:43
* @LastEditTime: 2021-01-06 20:18:46
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -23,7 +23,7 @@ class Service {
return Axios.post('POST', `hades/${url}`, params, option);
}
static Sales(url: string, params: any, option: any) {
static Sales(url: string, params: any, option?: any) {
return Axios.post('POST', `sales/${url}`, params, option);
}
......
/*
* @Author: wufan
* @Date: 2020-12-12 11:57:10
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-25 17:48:50
* @LastEditors: wufan
* @LastEditTime: 2021-01-06 20:18:16
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -12,6 +12,9 @@ import Service from "@/common/js/service";
export function fetchLecturerData(params: object) {
return Service.Hades("public/courseCloud/queryTeacherVisitData", params);
}
export function getQrcode(params: object) {
return Service.Sales("public/businessShow/convertShortUrls", params);
}
export function fetchUserData(params: object) {
return Service.Hades("public/courseCloud/queryStudentVisitData", params);
......
/*
* @Author: wufan
* @Date: 2020-11-25 18:25:02
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-25 18:21:33
* @LastEditors: wufan
* @LastEditTime: 2021-01-06 20:17:40
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import { fetchLecturerData, fetchUserData, exportStudentCourseData,exportPlayBackCourseData, fetchPlaybackList,createLiveCloudCourse,getLiveCloudCoursePage,
getLiveCloudCourseDetail,updateLiveCloudCourse,turnOnOrOffLiveCloudCourse,delLiveCloudCourse,changeVideoShelfState,createVideoSchedule,delVideoSchedule,editVideoSchedule,userWatchInfo,videoSchedulePage,videoScheduleDetail,videoWatchInfo} from '@/data-source/course/request-api';
import {
fetchLecturerData, fetchUserData, exportStudentCourseData, exportPlayBackCourseData, fetchPlaybackList, createLiveCloudCourse, getLiveCloudCoursePage,
getLiveCloudCourseDetail, updateLiveCloudCourse, turnOnOrOffLiveCloudCourse, delLiveCloudCourse, changeVideoShelfState, createVideoSchedule, delVideoSchedule, editVideoSchedule, userWatchInfo, videoSchedulePage, videoScheduleDetail, videoWatchInfo, getQrcode
} from '@/data-source/course/request-api';
export default class courseService {
// 获取讲师上课数据
......@@ -15,6 +17,11 @@ export default class courseService {
return fetchLecturerData(params);
}
// 生成二维码
static getQrcode(params: any) {
return getQrcode(params);
}
// 获取用户上课数据
static fetchUserData(params: any) {
return fetchUserData(params);
......@@ -25,7 +32,7 @@ export default class courseService {
static getLiveCloudCoursePage(params: any) {
return getLiveCloudCoursePage(params);
}
// 导出学生上课数据
static exportStudentCourseData(params: any) {
return exportStudentCourseData(params);
......@@ -40,7 +47,7 @@ export default class courseService {
static fetchPlaybackList(params: any) {
return fetchPlaybackList(params);
}
static getLiveCloudCourseDetail(params: any) {
return getLiveCloudCourseDetail(params);
}
......
/*
* @Author: 吴文洁
* @Date: 2020-08-20 09:21:40
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-25 18:27:16
* @LastEditors: wufan
* @LastEditTime: 2021-01-06 20:38:03
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -26,11 +26,11 @@ const shareUrlMap: MapInterface = {
}
const LIVE_SHARE_MAP: MapInterface = {
dev: 'https://dev.xiaomai5.com/xiaomai-live-share/index.html#/',
dev1: 'https://dev.xiaomai5.com/xiaomai-live-share/index.html#/',
rc: 'https://rc.xiaomai5.com/xiaomai-live-share/index.html#/',
gray: 'https://res.xiaomai5.com/xiaomai-live-share/gray/index.html#/',
prod: 'https://res.xiaomai5.com/xiaomai-live-share/index.html#/',
dev: 'https://dev.xiaomai5.com/store-live/index.html#/',
dev1: 'https://dev.xiaomai5.com/store-live/index.html#/',
rc: 'https://rc.xiaomai5.com/store-live/index.html#/',
gray: 'https://res.xiaomai0.com/store-live/gray/index.html#/',
prod: 'https://res.xiaomai0.com/store-live/index.html#/',
}
export const appId: string = appIdMap[ENV];
......
......@@ -31,6 +31,7 @@ import { QuestionCircleOutlined } from '@ant-design/icons';
import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants';
import CourseService from "@/domains/course-domain/CourseService";
import DataList from '../DataList/DataList';
import User from '@/common/js/user';
const { confirm } = Modal;
const courseStateShow = {
......@@ -73,13 +74,11 @@ class LiveCourseList extends React.Component {
// 显示分享弹窗
handleShowShareModal = (item, needStr = false) => {
const _appId = appId;
const _shareUrl = shareUrl;
const { liveCourseId } = item;
const { saaSVersionEnum } = window.currentUserInstInfo;
const htmlUrl = `${LIVE_SHARE}liveShare?id=${liveCourseId}&saasVersion=${saaSVersionEnum}`;
const link = `${_appId}&redirect_uri=${encodeURIComponent(htmlUrl)}%26appid%3D${_appId}&response_type=code&scope=snsapi_base&state=state#wechat_redirect`;
const longUrl = `${_shareUrl}${link}`;
const htmlUrl = `${LIVE_SHARE}store/${User.getStoreId()}/live_detail/${liveCourseId}`;
const longUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${_appId}&redirect_uri=${encodeURIComponent(htmlUrl)}%26appid%3D${_appId}&response_type=code&scope=snsapi_base&state=state#wechat_redirect`;
console.log('htmlUrl',htmlUrl,longUrl);
const shareData = { ...item, longUrl };
const shareLiveModal = (
......
......@@ -13,6 +13,7 @@ import html2canvas from 'html2canvas';
import qrcode from "@/libs/qrcode/qrcode.js";
import User from '@/common/js/user';
import $ from 'jquery';
import CourseService from "@/domains/course-domain/CourseService";
import './ShareLiveModal.less';
......@@ -36,22 +37,22 @@ class ShareLiveModal extends React.Component {
handleConvertShortUrl = () => {
const { longUrl } = this.props.data;
// // 发请求
// axios.Sales('public/businessShow/convertShortUrls', {
// urls: [longUrl]
// }).then((res) => {
// const { result = [] } = res;
// this.setState({
// shareUrl: result[0].shortUrl
// }, () => {
// const qrcodeWrapDom = document.querySelector('#qrcodeWrap');
// const qrcodeNode = new qrcode({
// text: this.state.shareUrl,
// size: 98,
// })
// qrcodeWrapDom.appendChild(qrcodeNode);
// });
// })
// 发请求
CourseService.getQrcode({
urls: [longUrl]
}).then((res) => {
const { result = [] } = res;
this.setState({
shareUrl: result[0].shortUrl
}, () => {
const qrcodeWrapDom = document.querySelector('#qrcodeWrap');
const qrcodeNode = new qrcode({
text: this.state.shareUrl,
size: 98,
})
qrcodeWrapDom.appendChild(qrcodeNode);
});
})
}
componentWillUnmount() {
......
/*
* @Author: 吴文洁
* @Date: 2020-08-05 10:12:45
* @LastEditors: zhangleyuan
* @LastEditTime: 2020-12-31 18:26:57
* @LastEditors: wufan
* @LastEditTime: 2021-01-06 20:53:27
* @Description: 视频课-列表模块
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -11,6 +11,7 @@ import { Table, Modal, message , Tooltip,Switch,Dropdown} from 'antd';
import { PageControl } from "@/components";
import { LIVE_SHARE_MAP } from '@/common/constants/academic/cloudClass';
import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants';
import ShareLiveModal from '@/modules/course-manage/modal/ShareLiveModal';
......@@ -233,13 +234,14 @@ class VideoCourseList extends React.Component {
// 显示分享弹窗
handleShowShareModal = (record, needStr = false) => {
// const appId = CONFIG.appId[ENV];
const shareUrl = "";
const { id, scheduleVideoUrl } = record;
const htmlUrl = `${LIVE_SHARE_MAP[ENV]}videoShare?id=${id}`;
const link = htmlUrl;
const longUrl = "";
const _appId = appId;
const { liveCourseId } = record;
const htmlUrl = `${LIVE_SHARE}store/${User.getStoreId()}/video_detail/${liveCourseId}`;
const longUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${_appId}&redirect_uri=${encodeURIComponent(htmlUrl)}%26appid%3D${_appId}&response_type=code&scope=snsapi_base&state=state#wechat_redirect`;
const { coverUrl, scheduleName } = record;
const shareData = {
......
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