mirror of
https://github.com/PlayEdu/h5.git
synced 2025-06-08 01:14:11 +08:00
课件下载复制到浏览器下载
This commit is contained in:
parent
89974cb611
commit
6218a01042
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Image, ProgressCircle, Tabs } from "antd-mobile";
|
import { Image, ProgressCircle, Tabs, Toast } from "antd-mobile";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { useNavigate, useLocation, useParams } from "react-router-dom";
|
import { useNavigate, useLocation, useParams } from "react-router-dom";
|
||||||
import backIcon from "../../assets/images/commen/icon-back-n.png";
|
import backIcon from "../../assets/images/commen/icon-back-n.png";
|
||||||
@ -105,14 +105,25 @@ const CoursePage = () => {
|
|||||||
navigate(`/course/${cid}/hour/${id}`);
|
navigate(`/course/${cid}/hour/${id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (key: number) => {
|
const isAndroid = () => {
|
||||||
setTabKey(key);
|
const u = navigator.userAgent;
|
||||||
// navigate("/course/" + courseId + "?tab=" + key);
|
|
||||||
|
if (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
const downLoadFile = (cid: number, id: number) => {
|
const downLoadFile = (cid: number, id: number) => {
|
||||||
vod.downloadAttachment(cid, id).then((res: any) => {
|
vod.downloadAttachment(cid, id).then((res: any) => {
|
||||||
window.open(res.data.download_url);
|
var input = document.createElement("input");
|
||||||
|
input.value = res.data.download_url;
|
||||||
|
document.body.appendChild(input);
|
||||||
|
input.select();
|
||||||
|
document.execCommand("Copy");
|
||||||
|
document.body.removeChild(input);
|
||||||
|
Toast.show("下载链接已复制,请在浏览器中粘贴下载");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,7 +178,7 @@ const CoursePage = () => {
|
|||||||
"--active-title-color": "rgba(0,0,0,0.88)",
|
"--active-title-color": "rgba(0,0,0,0.88)",
|
||||||
"--active-line-border-radius": "2px",
|
"--active-line-border-radius": "2px",
|
||||||
"--title-font-size": "16px",
|
"--title-font-size": "16px",
|
||||||
"--content-padding":"18px"
|
"--content-padding": "18px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user