调整25338 多级tab结构

issues25489
杨树林 5 years ago
parent 60810336a5
commit d4d69efc67

@ -5,12 +5,12 @@ import { getUrl2, isDev, ThemeContext } from 'educoder'
import axios from 'axios' import axios from 'axios'
function InfoTab (props) { function InfoTab(props) {
const theme = useContext(ThemeContext); const theme = useContext(ThemeContext);
const { category, changeCategory, categories, right } = props; const { category, changeCategory, categories, right } = props;
const username = props.match.params.username const username = props.match.params.username
useEffect(() => { useEffect(() => {
}, []) }, [])
@ -19,7 +19,16 @@ function InfoTab (props) {
<div className="white-panel edu-back-white pt20 pb20 clearfix "> <div className="white-panel edu-back-white pt20 pb20 clearfix ">
{categories && categories.map(item => { {categories && categories.map(item => {
return ( return (
<li key={item.key} className={category == item.key ? "active" : ''}><a href="javascript:void(0)" onClick={()=>changeCategory(item.key)}>{item.name}</a></li> item.id === 1 ?
<li key={item.key}
className={category == item.key ? "active whitepanelysllisyt" : 'whitepanelysllisyt'}><a
href="javascript:void(0)" onClick={() => changeCategory(item.key)}
style={{width: "70px"}}>{item.name}</a></li>
:
<li key={item.key}
className={category == item.key ? "active whitepanelysllisyts" : 'whitepanelysllisyts'}><a
href="javascript:void(0)" onClick={() => changeCategory(item.key)}
style={{width: "80px"}}>{item.name}</a></li>
) )
})} })}
{/* <li className={category ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeCategory()}></a></li> {/* <li className={category ? "" : "active"}><a href="javascript:void(0)" onClick={()=>this.changeCategory()}></a></li>

@ -193,10 +193,31 @@ function InfoVideo (props) {
} }
// TODO use封装 // TODO use封装
function onSortChange(key, index) { function onSortChange(key, index) {
const _item = _items[index]
_items.splice(index, 1) try {
_items.unshift(_item) const _item = _items[index];
setSortKey(key) _items.splice(index, 1);
_items.unshift(_item);
const keys = key.split('-');
const sorts = sortKey.split('-');
if (key === "published_at-desc") {
if (keys[1] === sorts[1]) {
setSortKey("published_at-asc")
} else {
setSortKey(key)
}
} else if (key === "published_at-asc") {
if (keys[1] === sorts[1]) {
setSortKey("published_at-desc")
} else {
setSortKey(key)
}
}
} catch (e) {
}
} }
function getCopyText (file_url, cover_url) { function getCopyText (file_url, cover_url) {
return `<video src="${file_url}" controls="true" controlslist="nodownload" width="${DEFAULT_VIDEO_WIDTH_IN_MD}" height="${DEFAULT_VIDEO_HEIGHT_IN_MD}" poster="${cover_url}">您的浏览器不支持 video 标签。</video>` return `<video src="${file_url}" controls="true" controlslist="nodownload" width="${DEFAULT_VIDEO_WIDTH_IN_MD}" height="${DEFAULT_VIDEO_HEIGHT_IN_MD}" poster="${cover_url}">您的浏览器不支持 video 标签。</video>`
@ -264,7 +285,18 @@ function InfoVideo (props) {
border: 0px solid #4CACFF; border: 0px solid #4CACFF;
color: #4CACFF; color: #4CACFF;
} }
.whitepanelysllisyt {
width: 70px !important;
height: 48px !important;
line-height: 46px !important;
}
.whitepanelysllisyts {
width: 80px !important;
height: 48px !important;
line-height: 46px !important;
margin-left: 30px;
}
`}</style> `}</style>
@ -272,10 +304,12 @@ function InfoVideo (props) {
{...props} {...props}
categories={[{ categories={[{
key: 'all', key: 'all',
name: '全部视频' name: '全部视频',
id: 1,
}, { }, {
key: 'review', key: 'review',
name: '待审核视频' name: '待审核视频',
id: 2
}]} }]}
{...categoryObj} {...categoryObj}

Loading…
Cancel
Save