king
2020-08-17 ed818fbca1a913065a6a3c2c767714efe5b18685
src/tabviews/zshare/calendar/index.jsx
@@ -49,7 +49,7 @@
    let level = _levels[0]
    let monthlist = null
    if (_levels.includes('month')) {
    if (_levels.includes('month') || _levels.includes('year')) {
      monthlist = datelist.filter(item => item.month === moment().format('MM'))[0]
    }
@@ -67,7 +67,7 @@
      let datelist = this.mountdata(this.state.datelist, nextProps.data || [])
      let monthlist = null
      if (this.state.levels.includes('month')) {
      if (this.state.levels.includes('month') || this.state.levels.includes('year')) {
        monthlist = datelist.filter(item => item.month === this.state.selectMonth)[0]
      }
@@ -115,9 +115,9 @@
      })
    })
    if (datalist.length === 0) return datelist
    datalist.sort((a, b) => a.level - b.level)
    if (datalist.length > 0) {
      datalist.sort((a, b) => a.level - b.level)
    }
    let styles = [
      {background: '#d0021b', color: '#ffffff'},
@@ -131,6 +131,7 @@
    ]
    return datelist.map(month => {
      month.subData = []
      datalist.forEach(item => {
        if (item.startMonth <= month.time && item.endMonth >= month.time) {
          month.subData.push(item)
@@ -143,6 +144,7 @@
        week.sublist = week.sublist.map(day => {
          if (!day) return null
          day.subData = []
          datalist.forEach(item => {
            if (item.start <= day.time && item.end >= day.time) {
              day.subData.push(item)
@@ -152,13 +154,10 @@
          if (day.subData[0]) {
            day.style = styles[day.subData[0].level - 1] || null
          }
          return day
        })
        return week
      })
      return month
    })
  }
@@ -218,7 +217,7 @@
    let datelist = this.getDateList(value)
    let monthlist = null
    if (levels.includes('month')) {
    if (levels.includes('month') || levels.includes('year')) {
      monthlist = datelist.filter(item => item.month === selectMonth)[0]
    }
    
@@ -227,9 +226,9 @@
      this.setState({ selectYear: value, datelist, monthlist })
    } else {
      this.setState({ selectYear: value, datelist, monthlist })
      this.props.changeDate(value)
      this.setState({ selectYear: value, datelist, monthlist }, () => {
        this.props.changeDate(value)
      })
    }
  }
@@ -237,6 +236,7 @@
    const { datelist } = this.state
    this.setState({
      level: 'month',
      selectMonth: value,
      monthlist: datelist.filter(item => item.month === value)[0]
    })
@@ -357,7 +357,7 @@
          {level === 'year' && monthlist ? <Row className="year-calendar">
            {datelist.map(item => (
              <Col span={8} key={item.month}>
                <div className="year-wrap" style={item.style || null} onClick={() => this.triggerDay(item)}>
                <div className="year-wrap" style={item.style || null} onClick={() => this.monthChange(item.month)}>
                  <div className="header" style={item.style ? null : {color: '#1890ff'}}>
                    {item.label}
                  </div>