|
|
@ -23,29 +23,26 @@ function VodTube({ |
|
|
|
getInfo, |
|
|
|
getInfo, |
|
|
|
categories, |
|
|
|
categories, |
|
|
|
setVideoActive, |
|
|
|
setVideoActive, |
|
|
|
|
|
|
|
allBooks, |
|
|
|
}: any) { |
|
|
|
}: any) { |
|
|
|
const videoListTag = useRef(null); |
|
|
|
const videoListTag = useRef(null); |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
localStorage.setItem("scroll-list", "on"); |
|
|
|
scroll.goToTop(); |
|
|
|
scroll.goToTop(); |
|
|
|
// getInfo({
|
|
|
|
getInfo({ |
|
|
|
// bookId: 1,
|
|
|
|
bookId: localStorage.getItem("bookId") |
|
|
|
// // window.location.pathname.slice(
|
|
|
|
? localStorage.getItem("bookId") |
|
|
|
// // window.location.pathname.lastIndexOf("/") + 1,
|
|
|
|
: localStorage.getItem("category")?.split(",")[0], |
|
|
|
// // window.location.pathname.length
|
|
|
|
}); |
|
|
|
// // ),
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
getInfo({ bookId: localStorage.getItem("bookId") }); |
|
|
|
|
|
|
|
}, []); |
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (!info && localStorage.getItem("category")) { |
|
|
|
if (allBooks && localStorage.getItem("category")) { |
|
|
|
const cat: any = localStorage.getItem("category")?.split(","); |
|
|
|
const cat: any = localStorage.getItem("category")?.split(","); |
|
|
|
bookSection({ bookId: cat[0], categoryId: cat[1] }); |
|
|
|
bookSection({ bookId: cat[0], categoryId: cat[1] }); |
|
|
|
} |
|
|
|
} |
|
|
|
if(info && localStorage.getItem("category")){ |
|
|
|
}, [allBooks]); |
|
|
|
// document.getElementsByClassName('video-tube__sidebar--playlist___list').scrollTo(0,)
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, [info]); |
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<div |
|
|
|
<div |
|
|
@ -94,12 +91,16 @@ function VodTube({ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<img src={listIcon} alt="" /> |
|
|
|
<img src={listIcon} alt="" /> |
|
|
|
</header> |
|
|
|
</header> |
|
|
|
<div ref={videoListTag} className="video-tube__sidebar--playlist___list d-flex flex-column"> |
|
|
|
<div |
|
|
|
|
|
|
|
ref={videoListTag} |
|
|
|
|
|
|
|
className="video-tube__sidebar--playlist___list d-flex flex-column" |
|
|
|
|
|
|
|
id="list" |
|
|
|
|
|
|
|
> |
|
|
|
{localStorage.getItem("bookId") |
|
|
|
{localStorage.getItem("bookId") |
|
|
|
? categories?.map((video: any, i: any) => ( |
|
|
|
? categories?.map((video: any, i: any) => ( |
|
|
|
<LessonPlayList category={video} key={i} /> |
|
|
|
<LessonPlayList category={video} key={i} /> |
|
|
|
)) |
|
|
|
)) |
|
|
|
: info?.vods?.map((video: any, i: any) => ( |
|
|
|
: info?.vods.map((video: any, i: any) => ( |
|
|
|
<LessonPlayList category={video} key={i} /> |
|
|
|
<LessonPlayList category={video} key={i} /> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -125,7 +126,7 @@ function VodTube({ |
|
|
|
<span>تا 50% تخفیف </span> |
|
|
|
<span>تا 50% تخفیف </span> |
|
|
|
</header> |
|
|
|
</header> |
|
|
|
<div className="video-tube__sidebar--suggests___list d-flex justify-content-between align-items-center"> |
|
|
|
<div className="video-tube__sidebar--suggests___list d-flex justify-content-between align-items-center"> |
|
|
|
{info?.related?.map((item: any, i: any) => ( |
|
|
|
{info?.related.slice(0,3).map((item: any, i: any) => ( |
|
|
|
<Book data={item} key={i} /> |
|
|
|
<Book data={item} key={i} /> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -163,6 +164,7 @@ export default connect( |
|
|
|
info: state.publicApi.bookSection, |
|
|
|
info: state.publicApi.bookSection, |
|
|
|
loading: state.publicApi.loading, |
|
|
|
loading: state.publicApi.loading, |
|
|
|
categories: state.publicApi.categories, |
|
|
|
categories: state.publicApi.categories, |
|
|
|
|
|
|
|
allBooks: state.publicApi.bookInfo?.vods, |
|
|
|
}), |
|
|
|
}), |
|
|
|
{ |
|
|
|
{ |
|
|
|
getInfo: publicApi.bookInfo, |
|
|
|
getInfo: publicApi.bookInfo, |
|
|
|