From 224e56672dac0e515ac738a60cfc97be9a574b4f Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 24 Oct 2017 19:02:29 +0800 Subject: [PATCH] active date selection --- src/routes/Dashboard/Analysis.js | 27 +++++++++++++++++++++++---- src/routes/Dashboard/Analysis.less | 3 +++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/routes/Dashboard/Analysis.js b/src/routes/Dashboard/Analysis.js index f025825f..75f85791 100644 --- a/src/routes/Dashboard/Analysis.js +++ b/src/routes/Dashboard/Analysis.js @@ -75,6 +75,17 @@ export default class Analysis extends Component { }); } + isActive(type) { + const { rangePickerValue } = this.state; + const value = getTimeDistance(type); + if (!rangePickerValue[0] || !rangePickerValue[1]) { + return; + } + if (rangePickerValue[0].isSame(value[0], 'day') && rangePickerValue[1].isSame(value[1], 'day')) { + return styles.currentDate; + } + } + render() { const { rangePickerValue, salesType, currentTabKey } = this.state; const { chart } = this.props; @@ -104,10 +115,18 @@ export default class Analysis extends Component { const salesExtra = (
- this.selectDate('today')}>今日 - this.selectDate('week')}>本周 - this.selectDate('month')}>本月 - this.selectDate('year')}>全年 + this.selectDate('today')}> + 今日 + + this.selectDate('week')}> + 本周 + + this.selectDate('month')}> + 本月 + + this.selectDate('year')}> + 全年 +