reza achanged video tube

master
Reza 3 years ago
parent e95a56533a
commit a51732d800
  1. 8
      src/redux/reducers/public.tsx
  2. 2
      src/router.js
  3. 2
      src/util/location.js
  4. 2
      src/views/Course/Lesson/index.tsx
  5. 5
      src/views/Course/index.tsx
  6. 17
      src/views/VideoTube/LessonPlayList/index.tsx
  7. 1
      src/views/VideoTube/index.tsx

@ -1,5 +1,7 @@
import { PublicAction } from "../actions-type"; import { PublicAction } from "../actions-type";
import proxy from "../proxy"; import proxy from "../proxy";
import location from '../../util/location';
const initialState = { const initialState = {
homeData: [], homeData: [],
newProducts: [], newProducts: [],
@ -69,13 +71,13 @@ export default function publicApi(state = initialState, action: PublicAction) {
error: null, error: null,
}; };
case "public/vod/bookSection": case "public/vod/bookSection":
const videoId: any = localStorage.getItem("category")?.split(",")[2]; const videoId: any = location.getId();
return { return {
...state, ...state,
loading: false, loading: false,
bookSection: data, bookSection: data,
error: null, error: null,
selectedVideo: data?.vods?.filter((item: any) => item.name === videoId)[0] selectedVideo: data.vods?.filter((item: any) => item.id !== videoId)[0]
}; };
case "public/vod/bookCourse": case "public/vod/bookCourse":
@ -98,7 +100,7 @@ export default function publicApi(state = initialState, action: PublicAction) {
categories: allCats.map((item: any) => categories: allCats.map((item: any) =>
data.vods.filter((item1: any) => item1.categoryId === item) data.vods.filter((item1: any) => item1.categoryId === item)
), ),
selectedVideo: data?.vods[0], selectedVideo: data.vods.filter((item : any) => item.id !== location.getId())[0],
}; };
case "public/homePage": case "public/homePage":
let itemsLevel; let itemsLevel;

@ -47,7 +47,7 @@ function router({ status }) {
<Route exact path={"/courses/:id"}> <Route exact path={"/courses/:id"}>
<Course /> <Course />
</Route> </Route>
<Route exact path={"/video-tube"}> <Route exact path={"/video/:id"}>
<VideoTube /> <VideoTube />
</Route> </Route>
<Route exact path={"/subscribe"}> <Route exact path={"/subscribe"}>

@ -8,4 +8,4 @@ class location {
const _location = new location(); const _location = new location();
export default _location; export default _location;

@ -111,7 +111,7 @@ function Lesson({
</div> </div>
<ul className="d-flex"> <ul className="d-flex">
<li>{data.type !== "pdf" && duration(data.duration)}</li> <li>{data.type !== "pdf" && duration(data.duration)}</li>
<Link to="/video-tube" onClick={() => setCategory(lesson[0].categoryId, data.name)}> <Link to={"/video/"+ data.id} onClick={() => setCategory(lesson[0].categoryId, data.name)}>
<li>{"مشاهده"}</li> <li>{"مشاهده"}</li>
</Link> </Link>
{/* <li>{data.download ? "دانلود" : <img src={lock} alt="" />}</li> */} {/* <li>{data.download ? "دانلود" : <img src={lock} alt="" />}</li> */}

@ -94,7 +94,7 @@ function Course({ getInfo, info, categories, loading }: any) {
<img src={bookmark} alt="" /> <img src={bookmark} alt="" />
</button> </button>
<Link <Link
to="/video-tube" to={"/video/" + info?.vods[0]?.id}
className="course__options--button d-flex align-items-center justify-content-between" className="course__options--button d-flex align-items-center justify-content-between"
onClick={() => checkFreeCat()} onClick={() => checkFreeCat()}
> >
@ -133,7 +133,7 @@ function Course({ getInfo, info, categories, loading }: any) {
<img src={bookmark} alt="" /> <img src={bookmark} alt="" />
</button> </button>
<Link <Link
to="/video-tube" to={"/video/" + info?.vods[0]?.id}
className="course__options--button d-flex align-items-center justify-content-around" className="course__options--button d-flex align-items-center justify-content-around"
onClick={() => checkFreeCat()} onClick={() => checkFreeCat()}
> >
@ -173,7 +173,6 @@ function Course({ getInfo, info, categories, loading }: any) {
export default connect( export default connect(
(state: any) => ({ (state: any) => ({
lessons: state.book.mockLessons,
info: state.publicApi.bookInfo, info: state.publicApi.bookInfo,
categories: state.publicApi.categories, categories: state.publicApi.categories,
loading: state.publicApi.loading, loading: state.publicApi.loading,

@ -2,6 +2,7 @@ import React, { useEffect } from "react";
import "./index.scss"; import "./index.scss";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { publicApi } from "../../../redux/actions"; import { publicApi } from "../../../redux/actions";
import { Link } from "react-router-dom";
function LessonPlayList({ function LessonPlayList({
category, category,
@ -16,12 +17,12 @@ function LessonPlayList({
if (localStorage.getItem("scroll-list") && vods) { if (localStorage.getItem("scroll-list") && vods) {
const list: HTMLElement = document.getElementById("list") as HTMLElement; const list: HTMLElement = document.getElementById("list") as HTMLElement;
const listItem: HTMLElement = document.getElementById( const listItem: HTMLElement = document.getElementById(
"listItem" + selectedVideo.id "listItem" + selectedVideo?.id
) as HTMLElement; ) as HTMLElement;
const elementHeight: any = (listItem as any)?.offsetHeight; const elementHeight: any = (listItem as any)?.offsetHeight;
const listHeight: any = (list as any).offsetHeight; const listHeight: any = (list as any).offsetHeight;
const index = vods.findIndex(( const index = vods?.findIndex((
(item: any) => item.name === selectedVideo.name (item: any) => item?.name === selectedVideo?.name
)); ));
console.log(index); console.log(index);
console.log(listHeight,elementHeight * (Number(index) + 1)); console.log(listHeight,elementHeight * (Number(index) + 1));
@ -52,7 +53,8 @@ function LessonPlayList({
{bookId ? ( {bookId ? (
category.map((video: any, i: any) => ( category.map((video: any, i: any) => (
<div <Link
to={"/video/" + video.id}
className={ className={
"lesson-playlist__item d-flex align-items-center" + "lesson-playlist__item d-flex align-items-center" +
" " + " " +
@ -82,10 +84,11 @@ function LessonPlayList({
<h4>{video.name}</h4> <h4>{video.name}</h4>
{/* <p>{file.text}</p> */} {/* <p>{file.text}</p> */}
</div> </div>
</div> </Link>
)) ))
) : ( ) : (
<div <Link
to={"/video/" + category.id}
className={ className={
"lesson-playlist__item d-flex align-items-center" + "lesson-playlist__item d-flex align-items-center" +
" " + " " +
@ -112,7 +115,7 @@ function LessonPlayList({
<h4>{category.name}</h4> <h4>{category.name}</h4>
{/* <p>{file.text}</p> */} {/* <p>{file.text}</p> */}
</div> </div>
</div> </Link>
)} )}
</div> </div>
} }

@ -12,6 +12,7 @@ import "./index.scss";
import listIcon from "../../assets/icons/list.png"; import listIcon from "../../assets/icons/list.png";
import { connect } from "react-redux"; import { connect } from "react-redux";
import scroll from "../../util/scroll.js"; import scroll from "../../util/scroll.js";
import location from "../../util/location.js";
import { book, publicApi } from "../../redux/actions"; import { book, publicApi } from "../../redux/actions";
import Loader from "../../components/Loader"; import Loader from "../../components/Loader";

Loading…
Cancel
Save