课程详情课件下载

This commit is contained in:
unknown 2023-07-30 16:00:34 +08:00
parent 061e9a7057
commit cf1fc2519c
2 changed files with 18 additions and 2 deletions

View File

@ -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);
}
}
});
};

View File

@ -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/);
}