From d4d69efc67d343f5bc8b858671f6ba3be8bd4ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 09:40:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B425338=20=E5=A4=9A=E7=BA=A7tab?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/user/usersInfo/common/InfoTab.js | 15 ++++-- .../user/usersInfo/video/InfosVideo.js | 48 ++++++++++++++++--- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/user/usersInfo/common/InfoTab.js b/public/react/src/modules/user/usersInfo/common/InfoTab.js index d4b374886..bb0761440 100644 --- a/public/react/src/modules/user/usersInfo/common/InfoTab.js +++ b/public/react/src/modules/user/usersInfo/common/InfoTab.js @@ -5,12 +5,12 @@ import { getUrl2, isDev, ThemeContext } from 'educoder' import axios from 'axios' -function InfoTab (props) { +function InfoTab(props) { const theme = useContext(ThemeContext); const { category, changeCategory, categories, right } = props; const username = props.match.params.username - + useEffect(() => { }, []) @@ -19,7 +19,16 @@ function InfoTab (props) {
{categories && categories.map(item => { return ( -
  • changeCategory(item.key)}>{item.name}
  • + item.id === 1 ? +
  • changeCategory(item.key)} + style={{width: "70px"}}>{item.name}
  • + : +
  • changeCategory(item.key)} + style={{width: "80px"}}>{item.name}
  • ) })} {/*
  • this.changeCategory()}>全部
  • diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index 19829b76e..bcc5acd2e 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -193,10 +193,31 @@ function InfoVideo (props) { } // TODO use封装 function onSortChange(key, index) { - const _item = _items[index] - _items.splice(index, 1) - _items.unshift(_item) - setSortKey(key) + + try { + const _item = _items[index]; + _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) { return `` @@ -264,7 +285,18 @@ function InfoVideo (props) { border: 0px solid #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; + } `} @@ -272,10 +304,12 @@ function InfoVideo (props) { {...props} categories={[{ key: 'all', - name: '全部视频' + name: '全部视频', + id: 1, }, { key: 'review', - name: '待审核视频' + name: '待审核视频', + id: 2 }]} {...categoryObj}