year
This commit is contained in:
parent
6b20391c72
commit
a9e3513706
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import './Index.scss';
|
import './Index.scss';
|
||||||
import 'echarts/lib/component/tooltip';
|
import 'echarts/lib/component/tooltip';
|
||||||
import 'echarts/lib/component/title';
|
import 'echarts/lib/component/title';
|
||||||
|
@ -12,13 +12,24 @@ import Line from '../Echart/Line';
|
||||||
import Calendar from '../Echart/Calendar';
|
import Calendar from '../Echart/Calendar';
|
||||||
import ConcentrateProject from './ConcentrateProject';
|
import ConcentrateProject from './ConcentrateProject';
|
||||||
import Activity from './Activity';
|
import Activity from './Activity';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
const aLimit = 5;
|
const aLimit = 5;
|
||||||
function Index(props) {
|
function Index(props) {
|
||||||
const [ page , setPage ] = useState(1);
|
const [ page , setPage ] = useState(1);
|
||||||
const [ total , setTotal ] = useState(0);
|
const [ total , setTotal ] = useState(0);
|
||||||
|
const [ createYear , setCreateYear ] = useState(undefined);
|
||||||
|
|
||||||
const username = props.match.params.username;
|
const username = props.match.params.username;
|
||||||
const current_user = props.current_user;
|
const current_user = props.current_user;
|
||||||
|
const user = props.user;
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if(user){
|
||||||
|
let c = user.created_time && user.created_time.split("-")[0];
|
||||||
|
setCreateYear(parseInt(c,0));
|
||||||
|
}
|
||||||
|
},[user])
|
||||||
|
|
||||||
// 在贡献度日历表中选择一个时间
|
// 在贡献度日历表中选择一个时间
|
||||||
function chooseTime(data) {
|
function chooseTime(data) {
|
||||||
|
@ -27,6 +38,12 @@ function Index(props) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderYear(){
|
||||||
|
let y = moment().get('year');
|
||||||
|
for(var i = y ; i > createYear;i--){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -39,7 +56,8 @@ function Index(props) {
|
||||||
<FlexAJ>
|
<FlexAJ>
|
||||||
<span className="font-18">贡献度</span>
|
<span className="font-18">贡献度</span>
|
||||||
<Select style={{width:"200px"}} placeholder="选择年份">
|
<Select style={{width:"200px"}} placeholder="选择年份">
|
||||||
<Select.Option key="2021">2021</Select.Option>
|
<Select.Option key="">选择年份</Select.Option>
|
||||||
|
{ createYear && renderYear()}
|
||||||
</Select>
|
</Select>
|
||||||
</FlexAJ>
|
</FlexAJ>
|
||||||
<Calendar time={''} userLogin={username} chooseTime={chooseTime}/>
|
<Calendar time={''} userLogin={username} chooseTime={chooseTime}/>
|
||||||
|
|
Loading…
Reference in New Issue