Commit 1b56f95f by zhangleyuan

feat:处理安装直播客户端

parent 8c741b60
import React from 'react'
import React from 'react';
import { Modal, Button } from "antd"; import { Modal, Button } from "antd";
import "./DownloadLiveModal.less" import "./DownloadLiveModal.less"
...@@ -12,37 +13,12 @@ class DownloadLiveModal extends React.Component { ...@@ -12,37 +13,12 @@ class DownloadLiveModal extends React.Component {
type: 'pre', 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() { render() {
const { url } = this.props; const { url } = this.props;
const { image, tip, text, type } = this.state; const { image, tip, text, type } = this.state;
return <Modal return <Modal
visible={true} visible={true}
maskClosable={false}
title="下载客户端" title="下载客户端"
className="download-live-modal" className="download-live-modal"
footer={null} footer={null}
...@@ -56,8 +32,17 @@ class DownloadLiveModal extends React.Component { ...@@ -56,8 +32,17 @@ class DownloadLiveModal extends React.Component {
type="primary" type="primary"
className="download-button" className="download-button"
onClick={() => { 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> >{text}</Button>
</Modal> </Modal>
......
...@@ -30,6 +30,7 @@ import './LiveCourseList.less'; ...@@ -30,6 +30,7 @@ import './LiveCourseList.less';
import { QuestionCircleOutlined } from '@ant-design/icons'; import { QuestionCircleOutlined } from '@ant-design/icons';
import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants'; import { appId, shareUrl, LIVE_SHARE } from '@/domains/course-domain/constants';
import CourseService from "@/domains/course-domain/CourseService"; import CourseService from "@/domains/course-domain/CourseService";
import BaseService from "@/domains/basic-domain/baseService";
import DataList from '../DataList/DataList'; import DataList from '../DataList/DataList';
import User from '@/common/js/user'; import User from '@/common/js/user';
...@@ -67,9 +68,10 @@ class LiveCourseList extends React.Component { ...@@ -67,9 +68,10 @@ class LiveCourseList extends React.Component {
} }
componentWillMount(){ componentWillMount(){
this.parseColumns(); this.parseColumns();
} }
componentDidMount() { componentDidMount() {
this.getDownloadVersion()
} }
// 显示分享弹窗 // 显示分享弹窗
handleShowShareModal = (item, needStr = false) => { handleShowShareModal = (item, needStr = false) => {
...@@ -173,7 +175,7 @@ class LiveCourseList extends React.Component { ...@@ -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-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> <span className="course-status" style={{color:courseStateShow[record.courseState].color,border:`1px solid ${courseStateShow[record.courseState].color}`}}>{courseStateShow[record.courseState].title}</span>
</div> </div>
<div class="teacher-assistant"> <div className="teacher-assistant">
<span className="teacher">讲师:{record.teacherName}</span> <span className="teacher">讲师:{record.teacherName}</span>
{ record.admins.length >0 && { record.admins.length >0 &&
...@@ -411,7 +413,14 @@ class LiveCourseList extends React.Component { ...@@ -411,7 +413,14 @@ class LiveCourseList extends React.Component {
_query.size = size; _query.size = size;
this.props.onChange(_query) this.props.onChange(_query)
} }
getDownloadVersion() {
BaseService
.getLastedVersion({ model: 1, platform: 1 })
.then((res) => {
const { result = {} } = res;
this.setState({ downloadUrl: result.releaseUrl });
})
}
render() { render() {
const { total, query, courseList, loading} = this.props; const { total, query, courseList, loading} = this.props;
const { current, size } = query; 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