mirror of
https://github.com/PlayEdu/h5.git
synced 2025-02-05 21:47:19 +08:00
课程详情课件下载
This commit is contained in:
parent
061e9a7057
commit
cf1fc2519c
@ -4,7 +4,7 @@ import styles from "./index.module.scss";
|
||||
import { useNavigate, useLocation, useParams } from "react-router-dom";
|
||||
import backIcon from "../../assets/images/commen/icon-back-n.png";
|
||||
import { course as vod } from "../../api/index";
|
||||
import { isEmptyObject, isWechat } from "../../utils/index";
|
||||
import { isEmptyObject, isWechat, isIOS } from "../../utils/index";
|
||||
import { Empty } from "../../components";
|
||||
import { HourCompenent } from "./compenents/hour";
|
||||
|
||||
@ -126,7 +126,18 @@ const CoursePage = () => {
|
||||
document.body.removeChild(input);
|
||||
window.open(res.data.download_url);
|
||||
} else {
|
||||
window.open(res.data.download_url);
|
||||
if (isIOS()) {
|
||||
Toast.show("请点击右上角···浏览器打开下载");
|
||||
var input = document.createElement("input");
|
||||
input.value = res.data.download_url;
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
document.execCommand("Copy");
|
||||
document.body.removeChild(input);
|
||||
window.open(res.data.download_url);
|
||||
} else {
|
||||
window.open(res.data.download_url);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -85,3 +85,8 @@ export function isWechat() {
|
||||
let ua = window.navigator.userAgent.toLowerCase();
|
||||
return /micromessenger/.test(ua);
|
||||
}
|
||||
|
||||
export function isIOS() {
|
||||
var u = navigator.userAgent;
|
||||
return !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user