diff --git a/public/react/src/modules/user/usersInfo/common/CRoundSelect.js b/public/react/src/modules/user/usersInfo/common/CRoundSelect.js
new file mode 100644
index 000000000..da62ac65b
--- /dev/null
+++ b/public/react/src/modules/user/usersInfo/common/CRoundSelect.js
@@ -0,0 +1,96 @@
+import React, { useState, useEffect, useContext, useRef, memo } from 'react';
+import {Link} from 'react-router-dom';
+import { Icon } from 'antd'
+import { getUrl2, isDev, ThemeContext } from 'educoder'
+import axios from 'axios'
+
+
+function CRoundSelect (props) {
+ const [open, setOpen] = useState(false)
+ const theme = useContext(ThemeContext);
+ const { category, changeCategory, categories, right, width, items,
+ sortKey, onSortChange } = props;
+ const username = props.match.params.username
+
+ useEffect(() => {
+
+ }, [])
+ function onToggleOpen(over) {
+ if (over) {
+ console.log('over')
+ setOpen(true)
+
+ } else {
+ console.log('out')
+ setOpen(false)
+
+ }
+ }
+ function findIndexByKey(key) {
+ let _index = -1
+ items && items.some((item, index) => {
+ if (item.key == key) {
+ _index = index
+ return true;
+ }
+ })
+ return _index
+ }
+ function _onSortChange(key, index) {
+ if (index == 0) {
+ return;
+ }
+ setOpen(false)
+ onSortChange(key, index)
+ }
+ let index = findIndexByKey(sortKey)
+ return (
+
+
+
+ {/* onMouseOut={onToggleOpen} */}
+
onToggleOpen(true)} >
+
+
+ {items[index].name}
+
+
+ {true &&
onToggleOpen(false)}
+ style={{display: open ? 'block' : 'none'}}
+ >
+ {items.map((item, index) =>
+ - _onSortChange(item.key, index)}>{item.name}
+ )}
+ {/* - AAAAAAAA
+ - BBBBBBB
+ - CCCCCCC
*/}
+
}
+
+
+ )
+}
+
+export default CRoundSelect
diff --git a/public/react/src/modules/user/usersInfo/common/InfoTab.js b/public/react/src/modules/user/usersInfo/common/InfoTab.js
index 615f84ea5..546b61820 100644
--- a/public/react/src/modules/user/usersInfo/common/InfoTab.js
+++ b/public/react/src/modules/user/usersInfo/common/InfoTab.js
@@ -8,7 +8,7 @@ import axios from 'axios'
function InfoTab (props) {
const theme = useContext(ThemeContext);
- const { category, changeCategory, categories } = props;
+ const { category, changeCategory, categories, right } = props;
const username = props.match.params.username
useEffect(() => {
@@ -25,6 +25,9 @@ function InfoTab (props) {
{/*
this.changeCategory()}>全部
this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
this.changeCategory("study")}>{is_current ? "我":"TA"}学习的 */}
+
+ {right}
+
)
}
diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.css b/public/react/src/modules/user/usersInfo/video/InfosVideo.css
index edbfb94aa..338c1397f 100644
--- a/public/react/src/modules/user/usersInfo/video/InfosVideo.css
+++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.css
@@ -65,4 +65,38 @@
.nItem.videoItem:hover .square-main {
color: #fff;
background: #333;
+}
+
+/* 预览弹框 */
+.showVideoModal .ant-modal-body {
+ display: flex;
+ flex-direction: column;
+}
+.showVideoModal video{
+ width: 800px;
+ height: 450px;
+}
+.showVideoModal .copyLine {
+ justify-content: space-between;
+ padding: 9px;
+ background: #000000;
+ width: 800px;
+}
+.showVideoModal .copyLine input {
+ color: #707070;
+ background-color: #000 !important;
+ border-color: #707070;
+ margin-right: 12px;
+}
+.showVideoModal .copyLine a {
+ flex: 0 0 106px;
+}
+.toolbarRow {
+ justify-content: space-between;
+ padding: 0 8px;
+}
+/* 跳转按钮 */
+.infoVideo .toUploadBtn {
+ height: 50px;
+ margin-right: 20px;
}
\ No newline at end of file
diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js
index 74e6aa273..35035fef7 100644
--- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js
+++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useContext, useRef, memo } from 'react';
import {Link} from 'react-router-dom';
-import { Pagination, Input } from 'antd'
+import { Pagination, Input, Button } from 'antd'
import { getUrl2, isDev, ThemeContext, ActionBtn } from 'educoder'
import axios from 'axios'
import VideoInReviewItem from './VideoInReviewItem'
@@ -8,6 +8,8 @@ import EditVideoModal from './EditVideoModal'
import './InfosVideo.css'
import InfoTab from '../common/InfoTab'
import HeadlessModal from '../common/HeadlessModal'
+import CRoundSelect from '../common/CRoundSelect'
+
import ClipboardJS from 'clipboard'
function useModal(initValue) {
@@ -38,15 +40,21 @@ function usePagination() {
onChange: onPageChange
}
}
-const PAGE_SIZE = 3
+const PAGE_SIZE = 4
const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400
const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400
let videoId = {};
let _clipboard = null;
+const _items=[
+ {key: 'published_at-desc', name: '最新上传'},
+ {key: 'published_at-asc', name: '最早上传'},
+]
function InfoVideo (props) {
const [videoes, setVideoes] = useState([])
const [reviewVideoes, setReviewVideoes] = useState([])
const [count, setCount] = useState(0)
+ const [sortKey, setSortKey] = useState(_items[0].key)
+
const editModalObj = useModal(false)
const videoModalObj = useModal(false)
const categoryObj = useCategory('all')
@@ -56,17 +64,22 @@ function InfoVideo (props) {
const editModalEl = useRef(null);
const videoEl = useRef(null);
- const { showNotification } = props;
+ const { showNotification, history } = props;
const username = props.match.params.username
+ function toUpload() {
+ history.push(`/users/${username}/videoes/upload`)
+ }
function fetchVideoes() {
const fetchUrl = `/users/${username}/videos.json`
+ const sorts = sortKey.split('-')
axios.get(fetchUrl, {
params: {
page: pageObj.current,
per_page: PAGE_SIZE,
- // sort_by
- // sort_direction
+ sort_by: sorts[0],
+ sort_direction: sorts[1],
+ //
}
})
.then((response) => {
@@ -96,7 +109,7 @@ function InfoVideo (props) {
useEffect(() => {
fetchVideoes()
- }, [pageObj.current])
+ }, [pageObj.current, sortKey])
useEffect(() => {
if (categoryObj.category == 'all') {
@@ -153,6 +166,13 @@ function InfoVideo (props) {
}
videoModalObj.setVisible(true)
}
+ // TODO use封装
+ function onSortChange(key, index) {
+ const _item = _items[index]
+ _items.splice(index, 1)
+ _items.unshift(_item)
+ setSortKey(key)
+ }
function getCopyText (file_url, cover_url) {
return ``
}
@@ -182,29 +202,6 @@ function InfoVideo (props) {