From 37b034c555dd0d18934e0c7be011eb07c1e60a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Fri, 14 Jul 2023 14:34:29 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=A1=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.module.scss | 10 +--------- src/pages/index/index.tsx | 15 ++++++--------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/pages/index/index.module.scss b/src/pages/index/index.module.scss index 7e2a8ef..8ab7721 100644 --- a/src/pages/index/index.module.scss +++ b/src/pages/index/index.module.scss @@ -90,15 +90,7 @@ overflow: hidden; text-overflow: ellipsis; } -} - -.active-child-item { - width: 100%; - float: left; - height: auto; - box-sizing: border-box; - padding-left: 20px; - .category-child-tit { + .act-category-child-tit { width: 100%; font-size: 14px; font-weight: 400; diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index d7ff20f..0f4dae0 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -163,16 +163,13 @@ const IndexPage = () => { return ( <> {data.map((item: any) => ( -
+
{ setCategoryId(item.key); setCategoryText(item.title); From 200f48935998cbc9caedf5d79b6538b19d079f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Mon, 17 Jul 2023 16:43:35 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BC=93=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/internal/httpClient.ts | 1 + src/routes/index.tsx | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/api/internal/httpClient.ts b/src/api/internal/httpClient.ts index 8225eeb..0dcec87 100644 --- a/src/api/internal/httpClient.ts +++ b/src/api/internal/httpClient.ts @@ -56,6 +56,7 @@ export class HttpClient { GoLogin(); } else if (status === 404) { // 跳转到404页面 + GoLogin(); } else if (status === 403) { // 跳转到无权限页面 } else if (status === 500) { diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 656bcda..63e2045 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -1,17 +1,26 @@ import { lazy } from "react"; import { RouteObject } from "react-router-dom"; import { system, user } from "../api"; - import { getToken } from "../utils"; +// 页面加载 import { InitPage } from "../pages/init"; -import IndexPage from "../pages/index/index"; import LoginPage from "../pages/login"; -import MemberPage from "../pages/member/index"; -import ChangePasswordPage from "../pages/change-password/index"; -import ChangeDepartmentPage from "../pages/change-department/index"; -import StudyPage from "../pages/study/index"; -import CoursePage from "../pages/course/index"; -import CoursePlayPage from "../pages/course/video"; +//用户中心页面 +const MemberPage = lazy(() => import("../pages/member/index")); +//主页 +const IndexPage = lazy(() => import("../pages/index/index")); +//修改密码页面 +const ChangePasswordPage = lazy(() => import("../pages/change-password/index")); +//修改部门页面 +const ChangeDepartmentPage = lazy( + () => import("../pages/change-department/index") +); +//学习页面 +const StudyPage = lazy(() => import("../pages/study/index")); +//课程页面 +const CoursePage = lazy(() => import("../pages/course/index")); +const CoursePlayPage = lazy(() => import("../pages/course/video")); + import PrivateRoute from "../components/private-route"; let RootPage: any = null; From f881fc914be69ba34478a234968c42f879c95339 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 24 Jul 2023 10:50:07 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E7=BC=93=E5=8A=A0=E8=BD=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/bar-footer/index.tsx | 6 +- src/pages/index/index.tsx | 3 +- src/pages/layouts/with-footer/index.tsx | 17 ++++++ src/pages/layouts/without-footer/index.tsx | 13 ++++ src/pages/member/index.tsx | 2 - src/pages/study/index.tsx | 3 +- src/routes/index.tsx | 69 +++++++++++++--------- 7 files changed, 77 insertions(+), 36 deletions(-) create mode 100644 src/pages/layouts/with-footer/index.tsx create mode 100644 src/pages/layouts/without-footer/index.tsx diff --git a/src/components/bar-footer/index.tsx b/src/components/bar-footer/index.tsx index 794941a..2016d24 100644 --- a/src/components/bar-footer/index.tsx +++ b/src/components/bar-footer/index.tsx @@ -1,7 +1,7 @@ -import React, { useState } from "react"; -import { NavBar, Badge, TabBar } from "antd-mobile"; +import React from "react"; +import { TabBar } from "antd-mobile"; import styles from "./index.module.scss"; -import { Link, useNavigate, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; export const TabBarFooter: React.FC = () => { const navigate = useNavigate(); diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 0f4dae0..83d66c9 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -5,7 +5,7 @@ import { user } from "../../api/index"; import styles from "./index.module.scss"; import { useSelector } from "react-redux"; import { useNavigate, useLocation } from "react-router-dom"; -import { Footer, TabBarFooter, Empty } from "../../components"; +import { Footer, Empty } from "../../components"; import { CoursesModel } from "./compenents/courses-model"; import { isEmptyObject } from "../../utils/index"; @@ -321,7 +321,6 @@ const IndexPage = () => { )}
-
); }; diff --git a/src/pages/layouts/with-footer/index.tsx b/src/pages/layouts/with-footer/index.tsx new file mode 100644 index 0000000..cd6d412 --- /dev/null +++ b/src/pages/layouts/with-footer/index.tsx @@ -0,0 +1,17 @@ +import { Suspense } from "react"; +import { Outlet } from "react-router-dom"; +import LoadingPage from "../../loading"; +import { TabBarFooter } from "../../../components"; + +const WithoutHeaderWithoutFooter = () => { + return ( + <> + }> + + + + + ); +}; + +export default WithoutHeaderWithoutFooter; diff --git a/src/pages/layouts/without-footer/index.tsx b/src/pages/layouts/without-footer/index.tsx new file mode 100644 index 0000000..8791cea --- /dev/null +++ b/src/pages/layouts/without-footer/index.tsx @@ -0,0 +1,13 @@ +import { Suspense } from "react"; +import { Outlet } from "react-router-dom"; +import LoadingPage from "../../loading"; + +const WithoutHeaderWithoutFooter = () => { + return ( + }> + + + ); +}; + +export default WithoutHeaderWithoutFooter; diff --git a/src/pages/member/index.tsx b/src/pages/member/index.tsx index be64460..7f5271d 100644 --- a/src/pages/member/index.tsx +++ b/src/pages/member/index.tsx @@ -7,7 +7,6 @@ import { loginAction, logoutAction } from "../../store/user/loginUserSlice"; import { ImageUploadItem } from "antd-mobile/es/components/image-uploader"; import styles from "./index.module.scss"; import { useDispatch, useSelector } from "react-redux"; -import { TabBarFooter } from "../../components"; import moreIcon from "../../assets/images/commen/icon-more.png"; const MemberPage = () => { @@ -317,7 +316,6 @@ const MemberPage = () => {
- ); }; diff --git a/src/pages/study/index.tsx b/src/pages/study/index.tsx index f327744..1b87bb1 100644 --- a/src/pages/study/index.tsx +++ b/src/pages/study/index.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from "react"; import { Skeleton } from "antd-mobile"; import styles from "./index.module.scss"; import { course } from "../../api/index"; -import { TabBarFooter, Empty } from "../../components"; +import { Empty } from "../../components"; import { CoursesModel } from "./compenents/courses-model"; import moment from "moment"; @@ -143,7 +143,6 @@ const StudyPage = () => { )} - ); }; diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 63e2045..0deebb2 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -5,6 +5,9 @@ import { getToken } from "../utils"; // 页面加载 import { InitPage } from "../pages/init"; import LoginPage from "../pages/login"; +import WithFooter from "../pages/layouts/with-footer"; +import WithoutFooter from "../pages/layouts/without-footer"; + //用户中心页面 const MemberPage = lazy(() => import("../pages/member/index")); //主页 @@ -62,35 +65,47 @@ const routes: RouteObject[] = [ children: [ { path: "/", - element: } />, + element: , + children: [ + { + path: "/", + element: } />, + }, + { + path: "/member", + element: } />, + }, + { + path: "/study", + element: } />, + }, + ], }, { - path: "/login", - element: , - }, - { - path: "/member", - element: } />, - }, - { - path: "/change-password", - element: } />, - }, - { - path: "/study", - element: } />, - }, - { - path: "/change-department", - element: } />, - }, - { - path: "/course/:courseId", - element: } />, - }, - { - path: "/course/:courseId/hour/:hourId", - element: } />, + path: "/", + element: , + children: [ + { + path: "/login", + element: , + }, + { + path: "/change-password", + element: } />, + }, + { + path: "/change-department", + element: } />, + }, + { + path: "/course/:courseId", + element: } />, + }, + { + path: "/course/:courseId/hour/:hourId", + element: } />, + }, + ], }, ], }, From be75b79b0146267d6e1e1188ecd1542ec2bd1a95 Mon Sep 17 00:00:00 2001 From: none Date: Fri, 7 Jul 2023 08:39:18 +0800 Subject: [PATCH 04/22] license --- LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f9dcb41 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2023 杭州白书科技有限公司 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file From 898b0695526e173f048ec1cb1531f2a7d86341ca Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sat, 29 Jul 2023 16:47:23 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course.ts | 5 + src/pages/course/index.module.scss | 102 +++++++++++++++ src/pages/course/index.tsx | 193 +++++++++++++++++++++-------- 3 files changed, 249 insertions(+), 51 deletions(-) diff --git a/src/api/course.ts b/src/api/course.ts index 53d62bf..70a4dec 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -31,3 +31,8 @@ export function playPing(courseId: number, hourId: number) { export function latestLearn() { return client.get(`/api/v1/user/latest-learn`, {}); } + +//下载课件 +export function downloadAttachment(courseId: number, id: number) { + return client.get(`/api/v1/course/${courseId}/attach/${id}/download`, {}); +} diff --git a/src/pages/course/index.module.scss b/src/pages/course/index.module.scss index 99408f9..689b1fc 100644 --- a/src/pages/course/index.module.scss +++ b/src/pages/course/index.module.scss @@ -79,6 +79,48 @@ padding: 20px; margin-top: -20px; z-index: 10; + .tabs { + width: 100%; + min-height: 24px; + display: flex; + align-items: center; + position: relative; + margin-bottom: 20px; + .tab-item { + width: auto; + min-height: 24px; + margin-right: 36px; + position: relative; + .tit { + font-size: 16px; + font-weight: 400; + color: rgba(0, 0, 0, 0.45); + line-height: 16px; + } + } + .tab-active-item { + width: auto; + min-height: 24px; + margin-right: 36px; + display: flex; + flex-direction: column; + align-items: center; + .tit { + font-size: 16px; + font-weight: 500; + color: rgba(0, 0, 0, 0.88); + line-height: 16px; + } + .act-line { + margin-top: 5px; + display: block; + width: 20px; + height: 3px; + background: #ff4d4f; + border-radius: 2px; + } + } + } .desc { width: 100%; height: auto; @@ -130,3 +172,63 @@ } } } + +.attachments-cont { + width: 100%; + height: auto; + display: flex; + flex-direction: column; + .attachments-item { + width: 100%; + height: 69px; + background: #fafafa; + border-radius: 7px; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + box-sizing: border-box; + padding: 10px 15px 10px 10px; + text-align: left; + margin-bottom: 10px; + &:last-child { + margin-bottom: 0px; + } + .left-cont { + flex: 1; + display: flex; + flex-direction: column; + margin-right: 10px; + .label { + height: 16px; + display: flex; + align-items: center; + span { + height: 16px; + font-size: 12px; + font-weight: 400; + color: rgba(0, 0, 0, 0.45); + line-height: 16px; + } + } + .title { + margin-top: 15px; + height: 14px; + font-size: 14px; + font-weight: 400; + color: rgba(0, 0, 0, 0.88); + line-height: 14px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + } + .download { + width: auto; + font-size: 12px; + font-weight: 400; + color: #ff4d4f; + line-height: 16px; + } + } +} diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index ea7ff95..2e64e93 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { Image, ProgressCircle } from "antd-mobile"; import styles from "./index.module.scss"; -import { useNavigate, useParams } from "react-router-dom"; +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 } from "../../utils/index"; @@ -16,10 +16,25 @@ type LocalCourseHour = { [key: number]: CourseHourModel[]; }; +type tabModal = { + key: number; + label: string; +}; + +type attachModal = { + id: number; + course_id: number; + rid: number; + sort: number; + title: string; + type: string; + url?: string; +}; + const CoursePage = () => { const { courseId } = useParams(); const navigate = useNavigate(); - + const result = new URLSearchParams(useLocation().search); const [course, setCourse] = useState(null); const [chapters, setChapters] = useState([]); const [hours, setHours] = useState(null); @@ -31,30 +46,42 @@ const CoursePage = () => { const [courseTypeText, setCourseTypeText] = useState(""); const [userCourseProgress, setUserCourseProgress] = useState(0); + const [tabKey, setTabKey] = useState(Number(result.get("tab") || 1)); + const [attachments, setAttachments] = useState([]); + const [items, setItems] = useState([]); useEffect(() => { - if (courseId) { - getDetail(Number(courseId)); - } + getDetail(); }, [courseId]); - const getDetail = (cid: number) => { - vod.detail(cid).then((res: any) => { + const getDetail = () => { + vod.detail(Number(courseId)).then((res: any) => { let courseItem: CourseModel = res.data.course; - document.title = courseItem.title || "课程详情"; - setCourse(courseItem); setChapters(res.data.chapters); setHours(res.data.hours); - if (res.data.learn_record) { setLearnRecord(res.data.learn_record); } - if (res.data.learn_hour_records) { setLearnHourRecord(res.data.learn_hour_records); } + let arr = res.data.attachments; + let tabs = [ + { + key: 1, + label: `课程目录`, + }, + ]; + if (arr.length > 0) { + tabs.push({ + key: 2, + label: `课程附件`, + }); + setAttachments(arr); + } + setItems(tabs); }); }; @@ -78,6 +105,17 @@ const CoursePage = () => { navigate(`/course/${cid}/hour/${id}`); }; + const onChange = (key: number) => { + setTabKey(key); + // navigate("/course/" + courseId + "?tab=" + key); + }; + + const downLoadFile = (cid: number, id: number) => { + vod.downloadAttachment(cid, id).then((res: any) => { + window.open(res.data.download_url); + }); + }; + return (
@@ -116,47 +154,48 @@ const CoursePage = () => {
- {course?.short_desc && ( - <> -
{course.short_desc}
-
- - )} -
- {chapters.length === 0 && !hours && } - - {chapters.length === 0 && hours && ( -
- {hours[0].map((item: CourseHourModel) => ( -
- { - playVideo(cid, id); - }} - > -
- ))} +
+ {items.map((item: any) => ( +
{ + onChange(item.key); + }} + > +
{item.label}
+ {item.key === tabKey && }
- )} + ))} +
+ {tabKey === 1 && ( + <> + {course?.short_desc && ( + <> +
{course.short_desc}
+
+ + )} +
+ {chapters.length === 0 && !hours && } - {chapters.length > 0 && hours && ( -
- {chapters.map((item: ChapterModel) => ( -
-
{item.name}
- {hours[item.id]?.map((it: CourseHourModel) => ( -
+ {chapters.length === 0 && hours && ( +
+ {hours[0].map((item: CourseHourModel) => ( +
{ playVideo(cid, id); }} @@ -164,10 +203,62 @@ const CoursePage = () => {
))}
- ))} + )} + + {chapters.length > 0 && hours && ( +
+ {chapters.map((item: ChapterModel) => ( +
+
{item.name}
+ {hours[item.id]?.map((it: CourseHourModel) => ( +
+ { + playVideo(cid, id); + }} + > +
+ ))} +
+ ))} +
+ )}
- )} -
+ + )} + {tabKey === 2 && ( +
+ {attachments.map((item: any, index: number) => ( +
+
+
+ + 课件 +
+ {item.title} +
+
downLoadFile(item.course_id, item.id)} + > + 下载 +
+
+ ))} +
+ )}
); From 531b09cb53c5619940126d9ba84b893fa1e5af7b Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 13:11:29 +0800 Subject: [PATCH 06/22] =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AF=BE=E4=BB=B6=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.module.scss | 1 + src/pages/course/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/course/index.module.scss b/src/pages/course/index.module.scss index 689b1fc..992bef0 100644 --- a/src/pages/course/index.module.scss +++ b/src/pages/course/index.module.scss @@ -212,6 +212,7 @@ } } .title { + width: 276px; margin-top: 15px; height: 14px; font-size: 14px; diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 2e64e93..329701f 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -247,7 +247,9 @@ const CoursePage = () => { /> 课件
- {item.title} + + {item.title}({item.type}) +
Date: Sun, 30 Jul 2023 13:23:14 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.module.scss | 6 ++--- src/pages/course/index.tsx | 36 ++++++++++++++++-------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/pages/course/index.module.scss b/src/pages/course/index.module.scss index 992bef0..57b24a6 100644 --- a/src/pages/course/index.module.scss +++ b/src/pages/course/index.module.scss @@ -213,12 +213,12 @@ } .title { width: 276px; - margin-top: 15px; - height: 14px; + margin-top: 14px; + height: 16px; font-size: 14px; font-weight: 400; color: rgba(0, 0, 0, 0.88); - line-height: 14px; + line-height: 16px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 329701f..84a3cb5 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { Image, ProgressCircle } from "antd-mobile"; +import { Image, ProgressCircle, Tabs } from "antd-mobile"; import styles from "./index.module.scss"; import { useNavigate, useLocation, useParams } from "react-router-dom"; import backIcon from "../../assets/images/commen/icon-back-n.png"; @@ -155,22 +155,24 @@ const CoursePage = () => {
- {items.map((item: any) => ( -
{ - onChange(item.key); - }} - > -
{item.label}
- {item.key === tabKey && } -
- ))} + { + setTabKey(Number(key)); + }} + style={{ + "--fixed-active-line-width": "20px", + "--active-line-height": "3px", + "--active-title-color": "rgba(0,0,0,0.88)", + "--active-line-border-radius": "2px", + "--title-font-size": "16px", + + }} + > + {items.map((item) => ( + + ))} +
{tabKey === 1 && ( <> From 84bbd23ff2c7a6db2516e1cd534e9419c5d2a97d Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 13:33:44 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85tab?= =?UTF-8?q?=E6=A0=8F=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.scss | 12 +++++++++++ src/pages/course/index.module.scss | 34 ------------------------------ src/pages/course/index.tsx | 5 +++-- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/main.scss b/src/main.scss index 6b1fc60..6f3a8fa 100644 --- a/src/main.scss +++ b/src/main.scss @@ -155,3 +155,15 @@ code { .dplayer-mobile-play { opacity: 1 !important; } + +.course-tab-box { + width: 100%; + min-height: 24px; + display: flex; + align-items: center; + position: relative; + margin-bottom: 20px; + .adm-tabs-tab-wrapper { + padding: 0 36px 0 0; + } +} diff --git a/src/pages/course/index.module.scss b/src/pages/course/index.module.scss index 57b24a6..a7bb7ae 100644 --- a/src/pages/course/index.module.scss +++ b/src/pages/course/index.module.scss @@ -86,40 +86,6 @@ align-items: center; position: relative; margin-bottom: 20px; - .tab-item { - width: auto; - min-height: 24px; - margin-right: 36px; - position: relative; - .tit { - font-size: 16px; - font-weight: 400; - color: rgba(0, 0, 0, 0.45); - line-height: 16px; - } - } - .tab-active-item { - width: auto; - min-height: 24px; - margin-right: 36px; - display: flex; - flex-direction: column; - align-items: center; - .tit { - font-size: 16px; - font-weight: 500; - color: rgba(0, 0, 0, 0.88); - line-height: 16px; - } - .act-line { - margin-top: 5px; - display: block; - width: 20px; - height: 3px; - background: #ff4d4f; - border-radius: 2px; - } - } } .desc { width: 100%; diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 84a3cb5..5b23f3c 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -154,8 +154,9 @@ const CoursePage = () => {
-
+
{ setTabKey(Number(key)); @@ -166,7 +167,7 @@ const CoursePage = () => { "--active-title-color": "rgba(0,0,0,0.88)", "--active-line-border-radius": "2px", "--title-font-size": "16px", - + "--content-padding":"18px" }} > {items.map((item) => ( From 6cc81ea6b7678394e70402a420023a94326b7e16 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 14:06:16 +0800 Subject: [PATCH 09/22] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/member/index.module.scss | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/member/index.module.scss b/src/pages/member/index.module.scss index 9985024..769b8ae 100644 --- a/src/pages/member/index.module.scss +++ b/src/pages/member/index.module.scss @@ -157,10 +157,15 @@ .dialog-body { position: fixed; - bottom: 0px; + bottom: 53px; left: 20px; right: 20px; - height: 253px; + min-height: 253px; + // box-sizing: border-box; + // padding-bottom: calc( + // 53px + constant(safe-area-inset-bottom) + // ); /* 兼容iOS 11.0 - 11.2 */ + // padding-bottom: calc(53px + env(safe-area-inset-bottom)); /* 兼容iOS 11.2+ */ .dialog-box { width: 100%; height: 162px; From 89974cb611cb3177b115461f80e0630e9ba4478d Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 14:09:33 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/member/index.module.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/member/index.module.scss b/src/pages/member/index.module.scss index 769b8ae..6f64006 100644 --- a/src/pages/member/index.module.scss +++ b/src/pages/member/index.module.scss @@ -7,6 +7,7 @@ background-image: url("../../assets/images/login/bg.png"); background-repeat: no-repeat; background-size: 100%; + z-index: 120; .support-box { position: fixed; top: 87%; @@ -157,7 +158,7 @@ .dialog-body { position: fixed; - bottom: 53px; + bottom: 0px; left: 20px; right: 20px; min-height: 253px; From 6218a0104278acb678b3d1cdd7a35d1d7fc02b5f Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 14:16:51 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=88=B0=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 5b23f3c..7559a97 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -1,5 +1,5 @@ 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 { useNavigate, useLocation, useParams } from "react-router-dom"; import backIcon from "../../assets/images/commen/icon-back-n.png"; @@ -105,14 +105,25 @@ const CoursePage = () => { navigate(`/course/${cid}/hour/${id}`); }; - const onChange = (key: number) => { - setTabKey(key); - // navigate("/course/" + courseId + "?tab=" + key); + const isAndroid = () => { + const u = navigator.userAgent; + + if (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) { + return true; + } + + return false; }; const downLoadFile = (cid: number, id: number) => { 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-line-border-radius": "2px", "--title-font-size": "16px", - "--content-padding":"18px" + "--content-padding": "18px", }} > {items.map((item) => ( From 22533dc82820839941f835414c68d10675b00522 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 15:36:51 +0800 Subject: [PATCH 12/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.module.scss | 5 +++-- src/pages/course/index.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/course/index.module.scss b/src/pages/course/index.module.scss index a7bb7ae..7110bbe 100644 --- a/src/pages/course/index.module.scss +++ b/src/pages/course/index.module.scss @@ -161,11 +161,12 @@ margin-bottom: 0px; } .left-cont { - flex: 1; + width: calc(100% - 34px); display: flex; flex-direction: column; margin-right: 10px; .label { + width: 100%; height: 16px; display: flex; align-items: center; @@ -178,7 +179,7 @@ } } .title { - width: 276px; + width: 100%; margin-top: 14px; height: 16px; font-size: 14px; diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 7559a97..c1d5d6f 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -261,9 +261,9 @@ const CoursePage = () => { /> 课件
- +
{item.title}({item.type}) - +
Date: Sun, 30 Jul 2023 15:43:47 +0800 Subject: [PATCH 13/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 22 ++++++++++++++-------- src/utils/index.ts | 5 +++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index c1d5d6f..0dd8afc 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -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 } from "../../utils/index"; +import { isEmptyObject, isWechat } from "../../utils/index"; import { Empty } from "../../components"; import { HourCompenent } from "./compenents/hour"; @@ -117,13 +117,19 @@ const CoursePage = () => { const downLoadFile = (cid: number, id: number) => { vod.downloadAttachment(cid, id).then((res: any) => { - 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("下载链接已复制,请在浏览器中粘贴下载"); + if (isWechat()) { + const input = document.createElement("input"); + document.body.appendChild(input); + input.setAttribute("value", res.data.download_url); + input.select(); + if (document.execCommand("copy")) { + document.execCommand("copy"); + Toast.show("下载链接已复制,请在浏览器中粘贴下载"); + } + document.body.removeChild(input); + } else { + window.open(res.data.download_url); + } }); }; diff --git a/src/utils/index.ts b/src/utils/index.ts index 4b06c5e..be86612 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -80,3 +80,8 @@ export function isMobile() { export function isEmptyObject(obj: Object) { return Object.keys(obj).length === 0; } + +export function isWechat() { + let ua = window.navigator.userAgent.toLowerCase(); + return /micromessenger/.test(ua); +} From dbab0780fe034da5a9a480b405956f5852befab6 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 15:45:36 +0800 Subject: [PATCH 14/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 0dd8afc..a20404f 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -124,7 +124,7 @@ const CoursePage = () => { input.select(); if (document.execCommand("copy")) { document.execCommand("copy"); - Toast.show("下载链接已复制,请在浏览器中粘贴下载"); + Toast.show("请点击右上角···浏览器打开下载"); } document.body.removeChild(input); } else { From 457fb0a0671ae4d7695d15b23ca6f1577443964a Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 15:47:31 +0800 Subject: [PATCH 15/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index a20404f..1ab7800 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -118,15 +118,14 @@ const CoursePage = () => { const downLoadFile = (cid: number, id: number) => { vod.downloadAttachment(cid, id).then((res: any) => { if (isWechat()) { - const input = document.createElement("input"); + Toast.show("请点击右上角···浏览器打开下载"); + var input = document.createElement("input"); + input.value = res.data.download_url; document.body.appendChild(input); - input.setAttribute("value", res.data.download_url); input.select(); - if (document.execCommand("copy")) { - document.execCommand("copy"); - Toast.show("请点击右上角···浏览器打开下载"); - } + document.execCommand("Copy"); document.body.removeChild(input); + window.open(res.data.download_url); } else { window.open(res.data.download_url); } From 061e9a7057c1016cdbc6a3eb9a438fbc466c761d Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 15:52:03 +0800 Subject: [PATCH 16/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 1ab7800..1637475 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -118,7 +118,6 @@ const CoursePage = () => { const downLoadFile = (cid: number, id: number) => { vod.downloadAttachment(cid, id).then((res: any) => { if (isWechat()) { - Toast.show("请点击右上角···浏览器打开下载"); var input = document.createElement("input"); input.value = res.data.download_url; document.body.appendChild(input); From cf1fc2519c3d0c0c1e3fa204fd59a0d13074e12a Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 16:00:34 +0800 Subject: [PATCH 17/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 15 +++++++++++++-- src/utils/index.ts | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 1637475..51f82b2 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -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); + } } }); }; diff --git a/src/utils/index.ts b/src/utils/index.ts index be86612..fa64b91 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -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/); +} From b3cd899b70b48669b50730c720e3d7d74235b1c7 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sun, 30 Jul 2023 16:14:37 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 51f82b2..4c8ebfa 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -49,6 +49,7 @@ const CoursePage = () => { const [tabKey, setTabKey] = useState(Number(result.get("tab") || 1)); const [attachments, setAttachments] = useState([]); const [items, setItems] = useState([]); + const [downLoadTemplateURL, setDownLoadTemplateURL] = useState(""); useEffect(() => { getDetail(); @@ -105,19 +106,12 @@ const CoursePage = () => { navigate(`/course/${cid}/hour/${id}`); }; - const isAndroid = () => { - const u = navigator.userAgent; - - if (u.indexOf("Android") > -1 || u.indexOf("Linux") > -1) { - return true; - } - - return false; - }; - const downLoadFile = (cid: number, id: number) => { vod.downloadAttachment(cid, id).then((res: any) => { if (isWechat()) { + if (isIOS()) { + Toast.show("请点击右上角···浏览器打开下载"); + } var input = document.createElement("input"); input.value = res.data.download_url; document.body.appendChild(input); @@ -127,14 +121,11 @@ const CoursePage = () => { window.open(res.data.download_url); } else { 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); + setDownLoadTemplateURL(res.data.download_url); + setTimeout(() => { + let $do: any = document.querySelector("#downLoadExcel"); + $do.click(); + }, 500); } else { window.open(res.data.download_url); } @@ -144,6 +135,12 @@ const CoursePage = () => { return (
+
Date: Sun, 30 Jul 2023 16:16:27 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 4c8ebfa..b071e7a 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -274,7 +274,7 @@ const CoursePage = () => { 课件
- {item.title}({item.type}) + {item.title}.{item.ext}
Date: Sun, 30 Jul 2023 16:32:03 +0800 Subject: [PATCH 20/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.module.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/course/index.module.scss b/src/pages/course/index.module.scss index 7110bbe..c6cd58e 100644 --- a/src/pages/course/index.module.scss +++ b/src/pages/course/index.module.scss @@ -164,7 +164,6 @@ width: calc(100% - 34px); display: flex; flex-direction: column; - margin-right: 10px; .label { width: 100%; height: 16px; @@ -192,11 +191,12 @@ } } .download { - width: auto; + width: 34px; font-size: 12px; font-weight: 400; color: #ff4d4f; line-height: 16px; + text-align: right; } } } From 951d2489d6eec3b42d836ee24addb04ad5d300af Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 31 Jul 2023 10:59:39 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E9=A1=B5=E6=97=A0=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/member/index.module.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/member/index.module.scss b/src/pages/member/index.module.scss index 6f64006..8d3aa6c 100644 --- a/src/pages/member/index.module.scss +++ b/src/pages/member/index.module.scss @@ -1,5 +1,5 @@ .main-body { - position: fixed; + position: absolute; bottom: 0; left: 0; right: 0; @@ -7,7 +7,6 @@ background-image: url("../../assets/images/login/bg.png"); background-repeat: no-repeat; background-size: 100%; - z-index: 120; .support-box { position: fixed; top: 87%; From b01a392b5a47d9ead6313b1542159bc9978003e9 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 31 Jul 2023 11:28:29 +0800 Subject: [PATCH 22/22] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=AF=BE=E7=A8=8B=E8=AF=A6=E6=83=85=E9=A1=B5=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index b071e7a..23dfe08 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -145,7 +145,15 @@ const CoursePage = () => { navigate(-1)} + onClick={() => { + if (window.history.length <= 1) { + // 将页面跳转到首页 + navigate("/"); + } else { + // 返回到前一个页面 + navigate(-1); + } + }} />