我的页面优化

This commit is contained in:
禺狨 2023-07-04 16:56:29 +08:00
parent fe7b20ff23
commit 1eaf8a7218
8 changed files with 25 additions and 20 deletions

View File

@ -10,7 +10,6 @@ import backIcon from "../../assets/images/commen/icon-back.png";
const ChangeDepartmentPage = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const [loading, setLoading] = useState<boolean>(false);
const departments = useSelector(
(state: any) => state.loginUser.value.departments
);

View File

@ -7,10 +7,10 @@ import backIcon from "../../assets/images/commen/icon-back.png";
const ChangePasswordPage = () => {
const navigate = useNavigate();
const [loading, setLoading] = useState<boolean>(false);
const [oldPassword, setOldPassword] = useState<string>("");
const [newPassword, setNewPassword] = useState<string>("");
const [againPassword, setAgainPassword] = useState<string>("");
const [loading, setLoading] = useState(false);
const [oldPassword, setOldPassword] = useState("");
const [newPassword, setNewPassword] = useState("");
const [againPassword, setAgainPassword] = useState("");
useEffect(() => {
document.title = "修改密码";

View File

@ -65,7 +65,7 @@ const CoursePage = () => {
useEffect(() => {
if (learnRecord?.progress) {
setUserCourseProgress(learnRecord.progress / 100);
setUserCourseProgress(Math.floor(learnRecord.progress / 100));
} else if (learnHourRecord) {
setUserCourseProgress(1);
} else {

View File

@ -23,14 +23,14 @@ const CoursePlayPage = () => {
const params = useParams();
const systemConfig = useSelector((state: any) => state.systemConfig.value);
const user = useSelector((state: any) => state.loginUser.value.user);
const [playUrl, setPlayUrl] = useState<string>("");
const [playUrl, setPlayUrl] = useState("");
const [playDuration, setPlayDuration] = useState(0);
const [playendedStatus, setPlayendedStatus] = useState<Boolean>(false);
const [playendedStatus, setPlayendedStatus] = useState(false);
const [lastSeeValue, setLastSeeValue] = useState({});
const [course, setCourse] = useState<CourseModel | null>(null);
const [hour, setHour] = useState<any>({});
const [loading, setLoading] = useState<Boolean>(false);
const [isLastpage, setIsLastpage] = useState<Boolean>(false);
const [loading, setLoading] = useState(false);
const [isLastpage, setIsLastpage] = useState(false);
const [totalHours, setTotalHours] = useState<any>([]);
const [playingTime, setPlayingTime] = useState(0);
const [watchedSeconds, setWatchedSeconds] = useState(0);

View File

@ -20,7 +20,7 @@ const IndexPage = () => {
const ref = useRef<DropdownRef>(null);
const navigate = useNavigate();
const result = new URLSearchParams(useLocation().search);
const [loading, setLoading] = useState<boolean>(false);
const [loading, setLoading] = useState(false);
const [tabKey, setTabKey] = useState(result.get("tab") || "0");
const [coursesList, setCoursesList] = useState<CourseModel[]>([]);
const [categories, setCategories] = useState<any>([]);

View File

@ -15,10 +15,10 @@ import banner from "../../assets/images/login/banner.png";
const LoginPage = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const [loading, setLoading] = useState<boolean>(false);
const [email, setEmail] = useState<string>("");
const [password, setPassword] = useState<string>("");
const [bodyHeight, setBodyHeight] = useState<number>(0);
const [loading, setLoading] = useState(false);
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [bodyHeight, setBodyHeight] = useState(0);
useEffect(() => {
document.title = "登录";

View File

@ -13,10 +13,10 @@ import moreIcon from "../../assets/images/commen/icon-more.png";
const MemberPage = () => {
const dispatch = useDispatch();
const navigate = useNavigate();
const [loading, setLoading] = useState<boolean>(false);
const [currentDepartment, setCurrentDepartment] = useState<string>("");
const [visible, setVisible] = useState<boolean>(false);
const [init, setInit] = useState<boolean>(false);
const [loading, setLoading] = useState(false);
const [currentDepartment, setCurrentDepartment] = useState("");
const [visible, setVisible] = useState(false);
const [init, setInit] = useState(false);
const [stats, setStats] = useState<any>({});
const [fileList, setFileList] = useState<ImageUploadItem[]>([
{
@ -64,12 +64,18 @@ const MemberPage = () => {
setLearnTodayDay(todayData[0]);
setLearnTodayHour(todayData[1]);
setLearnTodayMin(todayData[2]);
if (todayData[2] === 0 && todayData[3] > 0) {
setLearnTodayMin(1);
}
}
let totalData = studyTimeFormat(res.data.stats.learn_duration);
if (totalData) {
setLearnTotalDay(totalData[0]);
setLearnTotalHour(totalData[1]);
setLearnTotalMin(totalData[2]);
if (totalData[2] === 0 && totalData[3] > 0) {
setLearnTodayMin(1);
}
}
setLoading(false);
});

View File

@ -7,7 +7,7 @@ import { CoursesModel } from "./compenents/courses-model";
import moment from "moment";
const StudyPage = () => {
const [loading, setLoading] = useState<boolean>(false);
const [loading, setLoading] = useState(false);
const [todayCourses, setTodayCourses] = useState<CourseModel[]>([]);
const [yesterdayCourses, setYesterdayCourses] = useState<CourseModel[]>([]);
const [courses, setCourses] = useState<CourseModel[]>([]);