import React from 'react'; import './index.less'; import { Anchor } from 'antd'; import { Tabs } from 'antd-mobile'; import Page from '@src/containers/Page'; import Assets from '@src/components/Assets'; import { getMap } from '@src/services/Tools'; import Money from '../../../components/Money'; import { LinkBlock, CourseBlock, DataBlock } from '../../../components/Block'; import { Main } from '../../../stores/main'; import { Course } from '../../../stores/course'; import { ServiceKey, CourseVsType } from '../../../../Constant'; export default class extends Page { init() { this.courseVsMap = {}; } initData() { Promise.all(ServiceKey.map(service => { return Main.getService(service.value).then(result => { this.setState({ [service.value]: result }); }); })); Course.allVs().then(list => { this.courseVsMap = getMap(list, 'vsType'); this.setState({ vsList: list }); }); Course.listVideo({ page: 1, size: 4, order: 'saleNumber', direction: 'desc' }) .then(result => { this.setState({ courseTop: result.list }); }); Course.listData({ page: 1, size: 4, order: 'saleNumber', direction: 'desc' }) .then((result) => { this.setState({ dataTop: result.list }); }); } renderView() { const { courseTop = [], dataTop = [] } = this.state; return [ { return ; }} /> ,
服务
{ServiceKey.map(service => { const s = this.state[service.value] || {}; const money = s.package ? s.package[0].price : 0; return
{ linkTo(`/product/service/${service.value}`); }}>
{service.label}
; })}
1V1私教
{CourseVsType.map((t, index) => { const course = this.courseVsMap[t.value] || {}; return 0 ? 'not' : 'default'} onClick={() => { linkTo(`/product/course/vs/${course.id}`); }} />; })} {/* */}
在线课程
{courseTop.map(row => { return ; })}
{ linkTo('/product/course/video'); }} >全部课程 >
资料
{dataTop.map(row => { return ; })}
{ linkTo('/product/data'); }}>全部资料 >
, ]; } }