Commit 1b56f95f by zhangleyuan

feat:处理安装直播客户端

parent 8c741b60
import React from 'react'
import React from 'react';
import { Modal, Button } from "antd";
import "./DownloadLiveModal.less"
......@@ -12,37 +13,12 @@ class DownloadLiveModal extends React.Component {
type: 'pre',
}
}
downloadLiveClient(){
if (type === 'pre') {
const isMac = /macintosh|mac os x/i.test(navigator.userAgent);
if(isMac){
Modal.info({
title: "抱歉,暂不支持Mac版",
content: "Mac版正在开发中,敬请期待",
icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>,
okText: '我知道了'
});
return;
}
url && window.open(url);
this.setState({
image: 'https://image.xiaomaiketang.com/xm/wPwRdaa7MM.png',
tip: '安装完成后,再次打开即可开始直播。',
text: '我知道了',
type: 'finish',
})
} else {
this.props.onCancel();
}
}
render() {
const { url } = this.props;
const { image, tip, text, type } = this.state;
return <Modal
visible={true}
maskClosable={false}
title="下载客户端"
className="download-live-modal"
footer={null}
......@@ -56,8 +32,17 @@ class DownloadLiveModal extends React.Component {
type="primary"
className="download-button"
onClick={() => {
if (type === 'pre') {
url && window.open(url);
this.setState({
image: 'https://image.xiaomaiketang.com/xm/wPwRdaa7MM.png',
tip: '安装完成后,再次打开即可开始直播。',
text: '我知道了',
type: 'finish',
})
} else {
this.props.onCancel();
}
}}
>{text}</Button>
</Modal>
......
......@@ -30,6 +30,7 @@ import './LiveCourseList.less';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants';
import CourseService from "@/domains/course-domain/CourseService";
import BaseService from "@/domains/basic-domain/baseService";
import DataList from '../DataList/DataList';
import User from '@/common/js/user';
......@@ -67,9 +68,10 @@ class LiveCourseList extends React.Component {
}
componentWillMount(){
this.parseColumns();
}
componentDidMount() {
this.getDownloadVersion()
}
// 显示分享弹窗
handleShowShareModal = (item, needStr = false) => {
......@@ -173,7 +175,7 @@ class LiveCourseList extends React.Component {
<span className="course-time">{formatDate("YYYY-MM-DD H:i",parseInt(record.startTime))}~{formatDate("H:i", parseInt(record.endTime))}</span>
<span className="course-status" style={{color:courseStateShow[record.courseState].color,border:`1px solid ${courseStateShow[record.courseState].color}`}}>{courseStateShow[record.courseState].title}</span>
</div>
<div class="teacher-assistant">
<div className="teacher-assistant">
<span className="teacher">讲师:{record.teacherName}</span>
{ record.admins.length >0 &&
......@@ -411,7 +413,14 @@ class LiveCourseList extends React.Component {
_query.size = size;
this.props.onChange(_query)
}
getDownloadVersion() {
BaseService
.getLastedVersion({ model: 1, platform: 1 })
.then((res) => {
const { result = {} } = res;
this.setState({ downloadUrl: result.releaseUrl });
})
}
render() {
const { total, query, courseList, loading} = this.props;
const { current, size } = query;
......
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