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