dev_cs_new
hjm 6 years ago
parent 8afa209ea8
commit 5b28c51d76

@ -65,3 +65,5 @@ export { default as ImageLayerHook } from './hooks/ImageLayerHook'
export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb' export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb'
export { CNotificationHOC as CNotificationHOC } from '../modules/courses/common/CNotificationHOC' export { CNotificationHOC as CNotificationHOC } from '../modules/courses/common/CNotificationHOC'
export { default as ModalWrapper } from '../modules/courses/common/ModalWrapper' export { default as ModalWrapper } from '../modules/courses/common/ModalWrapper'
export { default as NoneData } from '../modules/courses/coursesPublic/NoneData'

@ -6,8 +6,9 @@ class NoneData extends Component{
super(props) super(props)
} }
render(){ render(){
const { style } = this.props;
return( return(
<div className="edu-tab-con-box clearfix edu-txt-center"> <div className="edu-tab-con-box clearfix edu-txt-center" style={style}>
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/> <img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p> <p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div> </div>

@ -104,11 +104,11 @@ class InfosBanner extends Component{
onClick={() => this.setState({moduleName: 'package'})} onClick={() => this.setState({moduleName: 'package'})}
to={`/users/${username}/package`}>众包</Link> to={`/users/${username}/package`}>众包</Link>
</li> </li>
<li className={`${moduleName == 'videoes' ? 'active' : '' }`}> {/* <li className={`${moduleName == 'videoes' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'videoes'})} onClick={() => this.setState({moduleName: 'videoes'})}
to={`/users/${username}/videoes`}>视频</Link> to={`/users/${username}/videoes`}>视频</Link>
</li> </li> */}
</div> </div>
</div> </div>
</div> </div>

@ -1,7 +1,7 @@
import React, { useState, useEffect, useContext, useRef, memo } from 'react'; import React, { useState, useEffect, useContext, useRef, memo } from 'react';
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import { Pagination, Input, Button } from 'antd' import { Pagination, Input, Button } from 'antd'
import { getUrl2, isDev, ThemeContext, ActionBtn } from 'educoder' import { getUrl2, isDev, ThemeContext, ActionBtn, NoneData } from 'educoder'
import axios from 'axios' import axios from 'axios'
import VideoInReviewItem from './VideoInReviewItem' import VideoInReviewItem from './VideoInReviewItem'
import EditVideoModal from './EditVideoModal' import EditVideoModal from './EditVideoModal'
@ -50,9 +50,10 @@ const _items=[
{key: 'published_at-asc', name: '最早上传'}, {key: 'published_at-asc', name: '最早上传'},
] ]
function InfoVideo (props) { function InfoVideo (props) {
const [videoes, setVideoes] = useState([]) const [videoes, setVideoes] = useState(undefined)
const [reviewVideoes, setReviewVideoes] = useState([]) const [reviewVideoes, setReviewVideoes] = useState(undefined)
const [count, setCount] = useState(0) const [count, setCount] = useState(0)
const [loading, setLoading] = useState(true)
const [sortKey, setSortKey] = useState(_items[0].key) const [sortKey, setSortKey] = useState(_items[0].key)
const editModalObj = useModal(false) const editModalObj = useModal(false)
@ -73,6 +74,7 @@ function InfoVideo (props) {
function fetchVideoes() { function fetchVideoes() {
const fetchUrl = `/users/${username}/videos.json` const fetchUrl = `/users/${username}/videos.json`
const sorts = sortKey.split('-') const sorts = sortKey.split('-')
setLoading(true)
axios.get(fetchUrl, { axios.get(fetchUrl, {
params: { params: {
page: pageObj.current, page: pageObj.current,
@ -83,6 +85,7 @@ function InfoVideo (props) {
} }
}) })
.then((response) => { .then((response) => {
setLoading(false)
if (response.data.videos) { if (response.data.videos) {
setVideoes(response.data.videos) setVideoes(response.data.videos)
setCount(response.data.count) setCount(response.data.count)
@ -93,12 +96,14 @@ function InfoVideo (props) {
} }
function fetchReviewVideoes() { function fetchReviewVideoes() {
const fetchUrl = `/users/${username}/videos/review.json` const fetchUrl = `/users/${username}/videos/review.json`
setLoading(true)
axios.get(fetchUrl, { axios.get(fetchUrl, {
params: { params: {
per_page: 200 per_page: 200
} }
}) })
.then((response) => { .then((response) => {
setLoading(false)
if (response.data.videos) { if (response.data.videos) {
setReviewVideoes(response.data.videos) setReviewVideoes(response.data.videos)
setCount(response.data.count) setCount(response.data.count)
@ -270,10 +275,14 @@ function InfoVideo (props) {
sortKey={sortKey } sortKey={sortKey }
></CRoundSelect>} ></CRoundSelect>}
</div> </div>
{categoryObj.category == 'all' ? {categoryObj.category == 'all' ?
<div className="itemWrap"> <div className="itemWrap">
{videoes.map((item, index) => { {
videoes == undefined ? '' :
videoes.length ?
videoes.map((item, index) => {
return (<VideoInReviewItem return (<VideoInReviewItem
{...props} {...props}
@ -285,11 +294,16 @@ function InfoVideo (props) {
> >
</VideoInReviewItem>) </VideoInReviewItem>)
})} })
: <NoneData style={{width: '100%'}}></NoneData>
}
</div> </div>
: :
<div className="itemWrap"> <div className="itemWrap">
{reviewVideoes.map((item, index) => { {
videoes == undefined ? '' :
videoes.length ?
reviewVideoes.map((item, index) => {
return (<VideoInReviewItem return (<VideoInReviewItem
{...props} {...props}
@ -298,7 +312,9 @@ function InfoVideo (props) {
isReview={true} isReview={true}
> >
</VideoInReviewItem>) </VideoInReviewItem>)
})} })
: <NoneData style={{width: '100%'}}></NoneData>
}
</div> </div>
} }

Loading…
Cancel
Save