index.js 3.07 KB
Newer Older
FE committed
1 2 3 4
import React, { Component } from 'react';
import { http } from '@/utils';
import { HeaderBar } from "@/common";
import CollegeBanner from './banner';
FE committed
5
import CollegeHeader from './header';
FE committed
6 7 8 9 10 11 12 13 14
import './index.scss';

class CollegePage extends Component {
  constructor(props) {
    super(props);
    this.state = {
      sectionInfo: [
        {
          title: '系统赞助',
FE committed
15
          desc: '免费提供在线直播系统,支持电脑屏幕实时演示,以及视频回放、互动答疑。',
FE committed
16 17 18
          icon: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/college-plan/system.png',
        },
        {
FE committed
19 20
          title: '课程赞助 ',
          desc: '免费开放相关课程的视频、课件、作业、考试、代码、项目、云平台(在线编译、在线批改)。',
FE committed
21 22 23
          icon: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/college-plan/content.png',
        },
      ],
FE committed
24
      schoolList: [],
FE committed
25 26 27 28
    };
  }

  componentDidMount() {
FE committed
29
    this.fetchSchoolList();
xuzhenghua committed
30
    document.title = `免费提供在线教学系统 助力全国高校在线教学 - 七月在线`
FE committed
31 32 33
  }

  fetchSchoolList = () => {
FE committed
34
    const { schoolList } = this.state;
FE committed
35 36 37 38
    http.get(`${API['home']}/sys/school/list`).then(res => {
      const { code, data } = res.data;
      if(code === 200) {
        this.setState({
FE committed
39
          schoolList: data.concat(schoolList),
FE committed
40 41 42 43 44 45 46
        });
      }
    });
  }

  toCollegeCourse = (id) => {
    const { history } = this.props;
FE committed
47 48 49
    if(id) {
      history.push(`/college/${id}`);
    }
FE committed
50 51 52 53 54 55 56 57 58
  }

  render() {
    const { sectionInfo = [], schoolList = [] } = this.state;
    return (
      <>
        <HeaderBar title={'助学计划'} arrow={true}/>
        <CollegeBanner />
        <div className="college-page__banner"></div>
xuzhenghua committed
59
        <CollegeHeader
FE committed
60 61 62
          headerStyle={{
            marginTop: '20px'
          }}
xuzhenghua committed
63
          title="助力高校在线教学计划"
FE committed
64 65 66 67 68 69 70 71 72 73 74 75 76
        />
        <p className="college-page__contact">免费入驻联系周先生:18910848502(微信同)</p>
        {
          sectionInfo.map(({title, desc, icon}, index) => (
            <div className="college-page__section" key={index}>
              <i className="section__icon" style={{'backgroundImage': `url(${icon})`}}></i>
              <div className="section__body">
                <h2 className="section__title">{title}</h2>
                <p className="section__desc">{desc}</p>
              </div>
            </div>
          ))
        }
xuzhenghua committed
77
        <CollegeHeader
FE committed
78 79 80 81
          headerStyle={{
            marginTop: '20px'
          }}
          isDecorate={false} 
FE committed
82
          title="入驻院校" 
FE committed
83 84 85 86
        />
        <div className="college-page__college">
          {
            schoolList.map(({id, name, logo}) => (
xuzhenghua committed
87 88
              <div
                className="college__item"
FE committed
89
                onClick={() => this.toCollegeCourse(id)}
xuzhenghua committed
90
                key={id}
FE committed
91 92 93 94 95 96 97 98 99 100 101 102 103
              >
                <i className="college__iamge" style={{'backgroundImage': `url(${logo})`}}></i>
                <p className="college__name">{name}</p>
              </div>
            ))
          }
        </div>
      </>
    )
  }
}

export default CollegePage;