mirror of
https://github.com/PlayEdu/h5.git
synced 2026-01-02 03:19:46 +08:00
Compare commits
35 Commits
v1.1
...
19df4739ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19df4739ad | ||
|
|
e5315f621f | ||
|
|
0f811618b7 | ||
|
|
21e152cb74 | ||
|
|
23b332826d | ||
|
|
95b7b2306e | ||
|
|
e7ed87649d | ||
|
|
c445b4c04e | ||
|
|
34dd41a810 | ||
|
|
5d03a69888 | ||
|
|
e8e047da37 | ||
|
|
b01a392b5a | ||
|
|
951d2489d6 | ||
|
|
9fbd7a6d95 | ||
|
|
ae6c82ccf4 | ||
|
|
b3cd899b70 | ||
|
|
cf1fc2519c | ||
|
|
061e9a7057 | ||
|
|
457fb0a067 | ||
|
|
dbab0780fe | ||
|
|
b9901b12cb | ||
|
|
22533dc828 | ||
|
|
6218a01042 | ||
|
|
89974cb611 | ||
|
|
6cc81ea6b7 | ||
|
|
84bbd23ff2 | ||
|
|
70e5646e6b | ||
|
|
531b09cb53 | ||
|
|
898b069552 | ||
|
|
be75b79b01 | ||
|
|
f881fc914b | ||
|
|
200f489359 | ||
|
|
37b034c555 | ||
|
|
2d09dc2f70 | ||
|
|
f1be7c2c27 |
202
LICENSE
Normal file
202
LICENSE
Normal file
@@ -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.
|
||||||
@@ -28,9 +28,11 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^18.0.28",
|
"@types/react": "^18.0.28",
|
||||||
"@types/react-dom": "^18.0.11",
|
"@types/react-dom": "^18.0.11",
|
||||||
|
"@vitejs/plugin-legacy": "^4.1.1",
|
||||||
"@vitejs/plugin-react-swc": "^3.0.0",
|
"@vitejs/plugin-react-swc": "^3.0.0",
|
||||||
"rollup-plugin-gzip": "^3.1.0",
|
"rollup-plugin-gzip": "^3.1.0",
|
||||||
"sass": "^1.59.3",
|
"sass": "^1.59.3",
|
||||||
|
"terser": "^5.19.4",
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
"vite": "^4.2.0"
|
"vite": "^4.2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,3 +31,8 @@ export function playPing(courseId: number, hourId: number) {
|
|||||||
export function latestLearn() {
|
export function latestLearn() {
|
||||||
return client.get(`/api/v1/user/latest-learn`, {});
|
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`, {});
|
||||||
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export class HttpClient {
|
|||||||
GoLogin();
|
GoLogin();
|
||||||
} else if (status === 404) {
|
} else if (status === 404) {
|
||||||
// 跳转到404页面
|
// 跳转到404页面
|
||||||
|
GoLogin();
|
||||||
} else if (status === 403) {
|
} else if (status === 403) {
|
||||||
// 跳转到无权限页面
|
// 跳转到无权限页面
|
||||||
} else if (status === 500) {
|
} else if (status === 500) {
|
||||||
|
|||||||
@@ -10,3 +10,10 @@ export function login(email: string, password: string) {
|
|||||||
export function logout() {
|
export function logout() {
|
||||||
return client.post("/api/v1/auth/logout", {});
|
return client.post("/api/v1/auth/logout", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function loginLdap(email: string, password: string) {
|
||||||
|
return client.post("/api/v1/auth/login/ldap", {
|
||||||
|
username: email,
|
||||||
|
password: password,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React from "react";
|
||||||
import { NavBar, Badge, TabBar } from "antd-mobile";
|
import { TabBar } from "antd-mobile";
|
||||||
import styles from "./index.module.scss";
|
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 = () => {
|
export const TabBarFooter: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
@import "./assets/iconfont/iconfont.css";
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
@@ -155,3 +153,15 @@ code {
|
|||||||
.dplayer-mobile-play {
|
.dplayer-mobile-play {
|
||||||
opacity: 1 !important;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import ReactDOM from "react-dom/client";
|
|||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import store from "./store";
|
import store from "./store";
|
||||||
import { BrowserRouter } from "react-router-dom";
|
import { BrowserRouter } from "react-router-dom";
|
||||||
|
import "./assets/iconfont/iconfont.css";
|
||||||
import "./main.scss";
|
import "./main.scss";
|
||||||
import App from "./App";
|
import App from "./App";
|
||||||
import AutoScorllTop from "./AutoTop";
|
import AutoScorllTop from "./AutoTop";
|
||||||
|
|||||||
@@ -79,6 +79,14 @@
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin-top: -20px;
|
margin-top: -20px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
.tabs {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
.desc {
|
.desc {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
@@ -130,3 +138,65 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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 {
|
||||||
|
width: calc(100% - 34px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
.label {
|
||||||
|
width: 100%;
|
||||||
|
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 {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 14px;
|
||||||
|
height: 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: rgba(0, 0, 0, 0.88);
|
||||||
|
line-height: 16px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.download {
|
||||||
|
width: 34px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #ff4d4f;
|
||||||
|
line-height: 16px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Image, ProgressCircle } 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, 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";
|
||||||
import { course as vod } from "../../api/index";
|
import { course as vod } from "../../api/index";
|
||||||
import { isEmptyObject } from "../../utils/index";
|
import { isEmptyObject, isWechat, isIOS } from "../../utils/index";
|
||||||
import { Empty } from "../../components";
|
import { Empty } from "../../components";
|
||||||
import { HourCompenent } from "./compenents/hour";
|
import { HourCompenent } from "./compenents/hour";
|
||||||
|
|
||||||
@@ -16,10 +16,25 @@ type LocalCourseHour = {
|
|||||||
[key: number]: CourseHourModel[];
|
[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 CoursePage = () => {
|
||||||
const { courseId } = useParams();
|
const { courseId } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const result = new URLSearchParams(useLocation().search);
|
||||||
const [course, setCourse] = useState<CourseModel | null>(null);
|
const [course, setCourse] = useState<CourseModel | null>(null);
|
||||||
const [chapters, setChapters] = useState<ChapterModel[]>([]);
|
const [chapters, setChapters] = useState<ChapterModel[]>([]);
|
||||||
const [hours, setHours] = useState<LocalCourseHour | null>(null);
|
const [hours, setHours] = useState<LocalCourseHour | null>(null);
|
||||||
@@ -31,30 +46,43 @@ const CoursePage = () => {
|
|||||||
|
|
||||||
const [courseTypeText, setCourseTypeText] = useState("");
|
const [courseTypeText, setCourseTypeText] = useState("");
|
||||||
const [userCourseProgress, setUserCourseProgress] = useState(0);
|
const [userCourseProgress, setUserCourseProgress] = useState(0);
|
||||||
|
const [tabKey, setTabKey] = useState(Number(result.get("tab") || 1));
|
||||||
|
const [attachments, setAttachments] = useState<attachModal[]>([]);
|
||||||
|
const [items, setItems] = useState<tabModal[]>([]);
|
||||||
|
const [downLoadTemplateURL, setDownLoadTemplateURL] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (courseId) {
|
getDetail();
|
||||||
getDetail(Number(courseId));
|
|
||||||
}
|
|
||||||
}, [courseId]);
|
}, [courseId]);
|
||||||
|
|
||||||
const getDetail = (cid: number) => {
|
const getDetail = () => {
|
||||||
vod.detail(cid).then((res: any) => {
|
vod.detail(Number(courseId)).then((res: any) => {
|
||||||
let courseItem: CourseModel = res.data.course;
|
let courseItem: CourseModel = res.data.course;
|
||||||
|
|
||||||
document.title = courseItem.title || "课程详情";
|
document.title = courseItem.title || "课程详情";
|
||||||
|
|
||||||
setCourse(courseItem);
|
setCourse(courseItem);
|
||||||
setChapters(res.data.chapters);
|
setChapters(res.data.chapters);
|
||||||
setHours(res.data.hours);
|
setHours(res.data.hours);
|
||||||
|
|
||||||
if (res.data.learn_record) {
|
if (res.data.learn_record) {
|
||||||
setLearnRecord(res.data.learn_record);
|
setLearnRecord(res.data.learn_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.learn_hour_records) {
|
if (res.data.learn_hour_records) {
|
||||||
setLearnHourRecord(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,13 +106,54 @@ const CoursePage = () => {
|
|||||||
navigate(`/course/${cid}/hour/${id}`);
|
navigate(`/course/${cid}/hour/${id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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);
|
||||||
|
input.select();
|
||||||
|
document.execCommand("Copy");
|
||||||
|
document.body.removeChild(input);
|
||||||
|
window.open(res.data.download_url);
|
||||||
|
} else {
|
||||||
|
if (isIOS()) {
|
||||||
|
setDownLoadTemplateURL(res.data.download_url);
|
||||||
|
setTimeout(() => {
|
||||||
|
let $do: any = document.querySelector("#downLoadExcel");
|
||||||
|
$do.click();
|
||||||
|
}, 500);
|
||||||
|
} else {
|
||||||
|
window.open(res.data.download_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="main-body">
|
<div className="main-body">
|
||||||
|
<a
|
||||||
|
style={{ display: "none" }}
|
||||||
|
id="downLoadExcel"
|
||||||
|
href={downLoadTemplateURL}
|
||||||
|
download={true}
|
||||||
|
></a>
|
||||||
<div className="main-header" style={{ backgroundColor: "#FF4D4F" }}>
|
<div className="main-header" style={{ backgroundColor: "#FF4D4F" }}>
|
||||||
<Image
|
<Image
|
||||||
className="back-icon"
|
className="back-icon"
|
||||||
src={backIcon}
|
src={backIcon}
|
||||||
onClick={() => navigate(-1)}
|
onClick={() => {
|
||||||
|
if (window.history.length <= 1) {
|
||||||
|
// 将页面跳转到首页
|
||||||
|
navigate("/");
|
||||||
|
} else {
|
||||||
|
// 返回到前一个页面
|
||||||
|
navigate(-1);
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["top-content"]}>
|
<div className={styles["top-content"]}>
|
||||||
@@ -116,47 +185,51 @@ const CoursePage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles["other-content"]}>
|
<div className={styles["other-content"]}>
|
||||||
{course?.short_desc && (
|
<div className="course-tab-box">
|
||||||
|
<Tabs
|
||||||
|
activeLineMode="fixed"
|
||||||
|
activeKey={String(tabKey)}
|
||||||
|
onChange={(key: any) => {
|
||||||
|
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",
|
||||||
|
"--content-padding": "18px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{items.map((item) => (
|
||||||
|
<Tabs.Tab title={item.label} key={item.key} />
|
||||||
|
))}
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
{tabKey === 1 && (
|
||||||
<>
|
<>
|
||||||
<div className={styles["desc"]}>{course.short_desc}</div>
|
{course?.short_desc && (
|
||||||
<div className={styles["line"]}></div>
|
<>
|
||||||
</>
|
<div className={styles["desc"]}>{course.short_desc}</div>
|
||||||
)}
|
<div className={styles["line"]}></div>
|
||||||
<div className={styles["chapters-hours-cont"]}>
|
</>
|
||||||
{chapters.length === 0 && !hours && <Empty />}
|
)}
|
||||||
|
<div className={styles["chapters-hours-cont"]}>
|
||||||
|
{chapters.length === 0 && !hours && <Empty />}
|
||||||
|
|
||||||
{chapters.length === 0 && hours && (
|
{chapters.length === 0 && hours && (
|
||||||
<div className={styles["hours-list-box"]} style={{ marginTop: 10 }}>
|
<div
|
||||||
{hours[0].map((item: CourseHourModel) => (
|
className={styles["hours-list-box"]}
|
||||||
<div key={item.id} className={styles["hours-it"]}>
|
style={{ marginTop: 10 }}
|
||||||
<HourCompenent
|
>
|
||||||
id={item.id}
|
{hours[0].map((item: CourseHourModel) => (
|
||||||
cid={item.course_id}
|
<div key={item.id} className={styles["hours-it"]}>
|
||||||
title={item.title}
|
|
||||||
record={learnHourRecord[item.id]}
|
|
||||||
duration={item.duration}
|
|
||||||
onSuccess={(cid: number, id: number) => {
|
|
||||||
playVideo(cid, id);
|
|
||||||
}}
|
|
||||||
></HourCompenent>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{chapters.length > 0 && hours && (
|
|
||||||
<div className={styles["hours-list-box"]}>
|
|
||||||
{chapters.map((item: ChapterModel) => (
|
|
||||||
<div key={item.id} className={styles["chapter-it"]}>
|
|
||||||
<div className={styles["chapter-name"]}>{item.name}</div>
|
|
||||||
{hours[item.id]?.map((it: CourseHourModel) => (
|
|
||||||
<div key={it.id} className={styles["hours-it"]}>
|
|
||||||
<HourCompenent
|
<HourCompenent
|
||||||
id={it.id}
|
id={item.id}
|
||||||
cid={item.course_id}
|
cid={item.course_id}
|
||||||
title={it.title}
|
title={item.title}
|
||||||
record={learnHourRecord[it.id]}
|
record={learnHourRecord[item.id]}
|
||||||
duration={it.duration}
|
duration={item.duration}
|
||||||
onSuccess={(cid: number, id: number) => {
|
onSuccess={(cid: number, id: number) => {
|
||||||
playVideo(cid, id);
|
playVideo(cid, id);
|
||||||
}}
|
}}
|
||||||
@@ -164,10 +237,64 @@ const CoursePage = () => {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
))}
|
)}
|
||||||
|
|
||||||
|
{chapters.length > 0 && hours && (
|
||||||
|
<div className={styles["hours-list-box"]}>
|
||||||
|
{chapters.map((item: ChapterModel) => (
|
||||||
|
<div key={item.id} className={styles["chapter-it"]}>
|
||||||
|
<div className={styles["chapter-name"]}>{item.name}</div>
|
||||||
|
{hours[item.id]?.map((it: CourseHourModel) => (
|
||||||
|
<div key={it.id} className={styles["hours-it"]}>
|
||||||
|
<HourCompenent
|
||||||
|
id={it.id}
|
||||||
|
cid={item.course_id}
|
||||||
|
title={it.title}
|
||||||
|
record={learnHourRecord[it.id]}
|
||||||
|
duration={it.duration}
|
||||||
|
onSuccess={(cid: number, id: number) => {
|
||||||
|
playVideo(cid, id);
|
||||||
|
}}
|
||||||
|
></HourCompenent>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
</>
|
||||||
</div>
|
)}
|
||||||
|
{tabKey === 2 && (
|
||||||
|
<div className={styles["attachments-cont"]}>
|
||||||
|
{attachments.map((item: any, index: number) => (
|
||||||
|
<div key={index} className={styles["attachments-item"]}>
|
||||||
|
<div className={styles["left-cont"]}>
|
||||||
|
<div className={styles["label"]}>
|
||||||
|
<i
|
||||||
|
className="iconfont icon-icon-file"
|
||||||
|
style={{
|
||||||
|
fontSize: 15,
|
||||||
|
color: "rgba(0,0,0,0.3)",
|
||||||
|
marginRight: 5,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span>课件</span>
|
||||||
|
</div>
|
||||||
|
<div className={styles["title"]}>
|
||||||
|
{item.title}.{item.ext}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={styles["download"]}
|
||||||
|
onClick={() => downLoadFile(item.course_id, item.id)}
|
||||||
|
>
|
||||||
|
下载
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -90,15 +90,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
}
|
.act-category-child-tit {
|
||||||
|
|
||||||
.active-child-item {
|
|
||||||
width: 100%;
|
|
||||||
float: left;
|
|
||||||
height: auto;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding-left: 20px;
|
|
||||||
.category-child-tit {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { user } from "../../api/index";
|
|||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useNavigate, useLocation } from "react-router-dom";
|
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 { CoursesModel } from "./compenents/courses-model";
|
||||||
import { isEmptyObject } from "../../utils/index";
|
import { isEmptyObject } from "../../utils/index";
|
||||||
|
|
||||||
@@ -163,16 +163,13 @@ const IndexPage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{data.map((item: any) => (
|
{data.map((item: any) => (
|
||||||
<div
|
<div key={item.key} className={styles["child-item"]}>
|
||||||
key={item.key}
|
|
||||||
className={
|
|
||||||
item.key === categoryId
|
|
||||||
? styles["active-child-item"]
|
|
||||||
: styles["child-item"]
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
className={styles["category-child-tit"]}
|
className={
|
||||||
|
item.key === categoryId
|
||||||
|
? styles["act-category-child-tit"]
|
||||||
|
: styles["category-child-tit"]
|
||||||
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCategoryId(item.key);
|
setCategoryId(item.key);
|
||||||
setCategoryText(item.title);
|
setCategoryText(item.title);
|
||||||
@@ -324,7 +321,6 @@ const IndexPage = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<TabBarFooter></TabBarFooter>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export const InitPage = (props: Props) => {
|
|||||||
if (props.configData) {
|
if (props.configData) {
|
||||||
let config: SystemConfigStoreInterface = {
|
let config: SystemConfigStoreInterface = {
|
||||||
//系统配置
|
//系统配置
|
||||||
|
"ldap-enabled": props.configData["ldap-enabled"],
|
||||||
systemApiUrl: props.configData["system-api-url"],
|
systemApiUrl: props.configData["system-api-url"],
|
||||||
systemH5Url: props.configData["system-h5-url"],
|
systemH5Url: props.configData["system-h5-url"],
|
||||||
systemLogo: props.configData["system-logo"],
|
systemLogo: props.configData["system-logo"],
|
||||||
|
|||||||
17
src/pages/layouts/with-footer/index.tsx
Normal file
17
src/pages/layouts/with-footer/index.tsx
Normal file
@@ -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 (
|
||||||
|
<>
|
||||||
|
<Suspense fallback={<LoadingPage />}>
|
||||||
|
<Outlet />
|
||||||
|
</Suspense>
|
||||||
|
<TabBarFooter></TabBarFooter>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WithoutHeaderWithoutFooter;
|
||||||
13
src/pages/layouts/without-footer/index.tsx
Normal file
13
src/pages/layouts/without-footer/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { Suspense } from "react";
|
||||||
|
import { Outlet } from "react-router-dom";
|
||||||
|
import LoadingPage from "../../loading";
|
||||||
|
|
||||||
|
const WithoutHeaderWithoutFooter = () => {
|
||||||
|
return (
|
||||||
|
<Suspense fallback={<LoadingPage />}>
|
||||||
|
<Outlet />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default WithoutHeaderWithoutFooter;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Button, Toast, Input, Image } from "antd-mobile";
|
import { Button, Toast, Input, Image } from "antd-mobile";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { login, system, user } from "../../api/index";
|
import { login, system, user } from "../../api/index";
|
||||||
import { setToken } from "../../utils/index";
|
import { setToken } from "../../utils/index";
|
||||||
@@ -19,6 +19,7 @@ const LoginPage = () => {
|
|||||||
const [email, setEmail] = useState("");
|
const [email, setEmail] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [bodyHeight, setBodyHeight] = useState(0);
|
const [bodyHeight, setBodyHeight] = useState(0);
|
||||||
|
const systemConfig = useSelector((state: any) => state.systemConfig.value);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = "登录";
|
document.title = "登录";
|
||||||
@@ -29,7 +30,7 @@ const LoginPage = () => {
|
|||||||
const loginSubmit = async (e: any) => {
|
const loginSubmit = async (e: any) => {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
content: "请输入学员邮箱账号",
|
content: "请输入邮箱或UID",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,17 +48,32 @@ const LoginPage = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
if (systemConfig["ldap-enabled"] === "1") {
|
||||||
let res: any = await login.login(email, password);
|
try {
|
||||||
setToken(res.data.token); //将token写入本地
|
let res: any = await login.loginLdap(email, password);
|
||||||
await getSystemConfig(); //获取系统配置并写入store
|
setToken(res.data.token); //将token写入本地
|
||||||
await getUser(); //获取登录用户的信息并写入store
|
await getSystemConfig(); //获取系统配置并写入store
|
||||||
setLoading(false);
|
await getUser(); //获取登录用户的信息并写入store
|
||||||
navigate("/member", { replace: true });
|
setLoading(false);
|
||||||
} catch (e) {
|
navigate("/member", { replace: true });
|
||||||
console.error("错误信息", e);
|
} catch (e) {
|
||||||
setLoading(false);
|
console.error("错误信息", e);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
try {
|
||||||
|
let res: any = await login.login(email, password);
|
||||||
|
setToken(res.data.token); //将token写入本地
|
||||||
|
await getSystemConfig(); //获取系统配置并写入store
|
||||||
|
await getUser(); //获取登录用户的信息并写入store
|
||||||
|
setLoading(false);
|
||||||
|
navigate("/member", { replace: true });
|
||||||
|
} catch (e) {
|
||||||
|
console.error("错误信息", e);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUser = async () => {
|
const getUser = async () => {
|
||||||
@@ -70,6 +86,7 @@ const LoginPage = () => {
|
|||||||
if (configRes.data) {
|
if (configRes.data) {
|
||||||
let config: SystemConfigStoreInterface = {
|
let config: SystemConfigStoreInterface = {
|
||||||
//系统配置
|
//系统配置
|
||||||
|
"ldap-enabled": configRes.data["ldap-enabled"],
|
||||||
systemApiUrl: configRes.data["system-api-url"],
|
systemApiUrl: configRes.data["system-api-url"],
|
||||||
systemH5Url: configRes.data["system-h5-url"],
|
systemH5Url: configRes.data["system-h5-url"],
|
||||||
systemLogo: configRes.data["system-logo"],
|
systemLogo: configRes.data["system-logo"],
|
||||||
@@ -110,7 +127,7 @@ const LoginPage = () => {
|
|||||||
<div className={styles["input-box"]}>
|
<div className={styles["input-box"]}>
|
||||||
<Input
|
<Input
|
||||||
className={styles["input-item"]}
|
className={styles["input-item"]}
|
||||||
placeholder="请输入学员邮箱账号"
|
placeholder="请输入邮箱或UID"
|
||||||
value={email}
|
value={email}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
setEmail(val);
|
setEmail(val);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.main-body {
|
.main-body {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
@@ -160,7 +160,12 @@
|
|||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
left: 20px;
|
left: 20px;
|
||||||
right: 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 {
|
.dialog-box {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 162px;
|
height: 162px;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { loginAction, logoutAction } from "../../store/user/loginUserSlice";
|
|||||||
import { ImageUploadItem } from "antd-mobile/es/components/image-uploader";
|
import { ImageUploadItem } from "antd-mobile/es/components/image-uploader";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { TabBarFooter } from "../../components";
|
|
||||||
import moreIcon from "../../assets/images/commen/icon-more.png";
|
import moreIcon from "../../assets/images/commen/icon-more.png";
|
||||||
|
|
||||||
const MemberPage = () => {
|
const MemberPage = () => {
|
||||||
@@ -23,10 +22,8 @@ const MemberPage = () => {
|
|||||||
url: "",
|
url: "",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const [learnTodayDay, setLearnTodayDay] = useState(0);
|
|
||||||
const [learnTodayHour, setLearnTodayHour] = useState(0);
|
const [learnTodayHour, setLearnTodayHour] = useState(0);
|
||||||
const [learnTodayMin, setLearnTodayMin] = useState(0);
|
const [learnTodayMin, setLearnTodayMin] = useState(0);
|
||||||
const [learnTotalDay, setLearnTotalDay] = useState(0);
|
|
||||||
const [learnTotalHour, setLearnTotalHour] = useState(0);
|
const [learnTotalHour, setLearnTotalHour] = useState(0);
|
||||||
const [learnTotalMin, setLearnTotalMin] = useState(0);
|
const [learnTotalMin, setLearnTotalMin] = useState(0);
|
||||||
const user = useSelector((state: any) => state.loginUser.value.user);
|
const user = useSelector((state: any) => state.loginUser.value.user);
|
||||||
@@ -61,19 +58,17 @@ const MemberPage = () => {
|
|||||||
setStats(res.data.stats);
|
setStats(res.data.stats);
|
||||||
let todayData = studyTimeFormat(res.data.stats.today_learn_duration);
|
let todayData = studyTimeFormat(res.data.stats.today_learn_duration);
|
||||||
if (todayData) {
|
if (todayData) {
|
||||||
setLearnTodayDay(todayData[0]);
|
setLearnTodayHour(todayData[0]);
|
||||||
setLearnTodayHour(todayData[1]);
|
setLearnTodayMin(todayData[1]);
|
||||||
setLearnTodayMin(todayData[2]);
|
if (todayData[1] === 0 && todayData[2] > 0) {
|
||||||
if (todayData[2] === 0 && todayData[3] > 0) {
|
|
||||||
setLearnTodayMin(1);
|
setLearnTodayMin(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let totalData = studyTimeFormat(res.data.stats.learn_duration);
|
let totalData = studyTimeFormat(res.data.stats.learn_duration);
|
||||||
if (totalData) {
|
if (totalData) {
|
||||||
setLearnTotalDay(totalData[0]);
|
setLearnTotalHour(totalData[0]);
|
||||||
setLearnTotalHour(totalData[1]);
|
setLearnTotalMin(totalData[1]);
|
||||||
setLearnTotalMin(totalData[2]);
|
if (totalData[1] === 0 && totalData[2] > 0) {
|
||||||
if (totalData[2] === 0 && totalData[3] > 0) {
|
|
||||||
setLearnTodayMin(1);
|
setLearnTodayMin(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,11 +187,6 @@ const MemberPage = () => {
|
|||||||
<div className={styles["stats-content"]}>
|
<div className={styles["stats-content"]}>
|
||||||
<div className={styles["stat-item"]}>
|
<div className={styles["stat-item"]}>
|
||||||
<span className={styles["time"]}>
|
<span className={styles["time"]}>
|
||||||
{learnTodayDay > 0 && (
|
|
||||||
<>
|
|
||||||
<strong>{learnTodayDay} </strong>天
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<strong> {learnTodayHour} </strong>时
|
<strong> {learnTodayHour} </strong>时
|
||||||
<strong> {learnTodayMin} </strong>分
|
<strong> {learnTodayMin} </strong>分
|
||||||
</span>
|
</span>
|
||||||
@@ -204,11 +194,6 @@ const MemberPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles["stat-item"]}>
|
<div className={styles["stat-item"]}>
|
||||||
<span className={styles["time"]}>
|
<span className={styles["time"]}>
|
||||||
{learnTotalDay > 0 && (
|
|
||||||
<>
|
|
||||||
<strong>{learnTotalDay} </strong>天
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<strong> {learnTotalHour} </strong>时
|
<strong> {learnTotalHour} </strong>时
|
||||||
<strong> {learnTotalMin} </strong>分
|
<strong> {learnTotalMin} </strong>分
|
||||||
</span>
|
</span>
|
||||||
@@ -317,7 +302,6 @@ const MemberPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Mask>
|
</Mask>
|
||||||
<TabBarFooter></TabBarFooter>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from "react";
|
|||||||
import { Skeleton } from "antd-mobile";
|
import { Skeleton } from "antd-mobile";
|
||||||
import styles from "./index.module.scss";
|
import styles from "./index.module.scss";
|
||||||
import { course } from "../../api/index";
|
import { course } from "../../api/index";
|
||||||
import { TabBarFooter, Empty } from "../../components";
|
import { Empty } from "../../components";
|
||||||
import { CoursesModel } from "./compenents/courses-model";
|
import { CoursesModel } from "./compenents/courses-model";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
|
||||||
@@ -143,7 +143,6 @@ const StudyPage = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<TabBarFooter></TabBarFooter>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,17 +1,29 @@
|
|||||||
import { lazy } from "react";
|
import { lazy } from "react";
|
||||||
import { RouteObject } from "react-router-dom";
|
import { RouteObject } from "react-router-dom";
|
||||||
import { system, user } from "../api";
|
import { system, user } from "../api";
|
||||||
|
|
||||||
import { getToken } from "../utils";
|
import { getToken } from "../utils";
|
||||||
|
// 页面加载
|
||||||
import { InitPage } from "../pages/init";
|
import { InitPage } from "../pages/init";
|
||||||
import IndexPage from "../pages/index/index";
|
|
||||||
import LoginPage from "../pages/login";
|
import LoginPage from "../pages/login";
|
||||||
import MemberPage from "../pages/member/index";
|
import WithFooter from "../pages/layouts/with-footer";
|
||||||
import ChangePasswordPage from "../pages/change-password/index";
|
import WithoutFooter from "../pages/layouts/without-footer";
|
||||||
import ChangeDepartmentPage from "../pages/change-department/index";
|
|
||||||
import StudyPage from "../pages/study/index";
|
//用户中心页面
|
||||||
import CoursePage from "../pages/course/index";
|
const MemberPage = lazy(() => import("../pages/member/index"));
|
||||||
import CoursePlayPage from "../pages/course/video";
|
//主页
|
||||||
|
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";
|
import PrivateRoute from "../components/private-route";
|
||||||
|
|
||||||
let RootPage: any = null;
|
let RootPage: any = null;
|
||||||
@@ -53,35 +65,47 @@ const routes: RouteObject[] = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
element: <PrivateRoute Component={<IndexPage />} />,
|
element: <WithFooter />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
element: <PrivateRoute Component={<IndexPage />} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/member",
|
||||||
|
element: <PrivateRoute Component={<MemberPage />} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/study",
|
||||||
|
element: <PrivateRoute Component={<StudyPage />} />,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/login",
|
path: "/",
|
||||||
element: <LoginPage />,
|
element: <WithoutFooter />,
|
||||||
},
|
children: [
|
||||||
{
|
{
|
||||||
path: "/member",
|
path: "/login",
|
||||||
element: <PrivateRoute Component={<MemberPage />} />,
|
element: <LoginPage />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/change-password",
|
path: "/change-password",
|
||||||
element: <PrivateRoute Component={<ChangePasswordPage />} />,
|
element: <PrivateRoute Component={<ChangePasswordPage />} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/study",
|
path: "/change-department",
|
||||||
element: <PrivateRoute Component={<StudyPage />} />,
|
element: <PrivateRoute Component={<ChangeDepartmentPage />} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/change-department",
|
path: "/course/:courseId",
|
||||||
element: <PrivateRoute Component={<ChangeDepartmentPage />} />,
|
element: <PrivateRoute Component={<CoursePage />} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/course/:courseId",
|
path: "/course/:courseId/hour/:hourId",
|
||||||
element: <PrivateRoute Component={<CoursePage />} />,
|
element: <PrivateRoute Component={<CoursePlayPage />} />,
|
||||||
},
|
},
|
||||||
{
|
],
|
||||||
path: "/course/:courseId/hour/:hourId",
|
|
||||||
element: <PrivateRoute Component={<CoursePlayPage />} />,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { createSlice } from "@reduxjs/toolkit";
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
type SystemConfigStoreInterface = {
|
type SystemConfigStoreInterface = {
|
||||||
|
"ldap-enabled": string;
|
||||||
systemApiUrl: string;
|
systemApiUrl: string;
|
||||||
systemPcUrl: string;
|
systemPcUrl: string;
|
||||||
systemH5Url: string;
|
systemH5Url: string;
|
||||||
@@ -16,6 +17,7 @@ type SystemConfigStoreInterface = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let defaultValue: SystemConfigStoreInterface = {
|
let defaultValue: SystemConfigStoreInterface = {
|
||||||
|
"ldap-enabled": "",
|
||||||
systemApiUrl: "",
|
systemApiUrl: "",
|
||||||
systemPcUrl: "",
|
systemPcUrl: "",
|
||||||
systemH5Url: "",
|
systemH5Url: "",
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export function changeAppUrl(str: string) {
|
|||||||
export function studyTimeFormat(dateStr: number) {
|
export function studyTimeFormat(dateStr: number) {
|
||||||
var d = moment.duration(dateStr / 1000, "seconds");
|
var d = moment.duration(dateStr / 1000, "seconds");
|
||||||
let value = [];
|
let value = [];
|
||||||
value.push(Math.floor(d.asDays()));
|
|
||||||
value.push(d.hours());
|
value.push(d.hours());
|
||||||
value.push(d.minutes());
|
value.push(d.minutes());
|
||||||
value.push(d.seconds());
|
value.push(d.seconds());
|
||||||
@@ -80,3 +79,13 @@ export function isMobile() {
|
|||||||
export function isEmptyObject(obj: Object) {
|
export function isEmptyObject(obj: Object) {
|
||||||
return Object.keys(obj).length === 0;
|
return Object.keys(obj).length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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/);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react-swc";
|
import react from "@vitejs/plugin-react-swc";
|
||||||
import gzipPlugin from "rollup-plugin-gzip";
|
import gzipPlugin from "rollup-plugin-gzip";
|
||||||
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
},
|
},
|
||||||
plugins: [react()],
|
plugins: [
|
||||||
|
react(),
|
||||||
|
legacy({
|
||||||
|
targets: ["chrome 52"],
|
||||||
|
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
||||||
|
renderLegacyChunks: true,
|
||||||
|
modernPolyfills: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
plugins: [gzipPlugin()],
|
plugins: [gzipPlugin()],
|
||||||
|
|||||||
Reference in New Issue
Block a user