import React from 'react'; import './index.less'; import Page from '@src/containers/Page'; import { getMap } from '@src/services/Tools'; import Money from '../../../components/Money'; import Button from '../../../components/Button'; import Tag from '../../../components/Tag'; // import Avatar from '../../../components/Avatar'; import { Course } from '../../../stores/course'; import { Order } from '../../../stores/order'; import { ServiceKey, ServiceParamMap } from '../../../../Constant'; export default class extends Page { init() { } initData() { const { id } = this.params; Course.getPackage(id).then(result => { result.originPrice = result.courses.reduce((x, y) => x + y, 0); this.setState({ data: result }); }); } buy() { Order.speedPay({ productType: 'course_package', productId: this.params.id }) .then((result) => { linkTo(`/pay/${result.id}`); }); } renderView() { const { data = {} } = this.state; return (
{data.title}
{data.isNovice > 0 && 适合新手}
授课老师
{/* */} {(data.courses || []).map(row => { return {row.teacher}; })}
课程介绍
{data.description}
包含课程
{(data.courses || []).map(row => { return ( {row.title}({row.noNumber}课时) ); })}
配套服务
预习作业 课后答疑
赠送服务
{data.gift && ServiceKey.map(row => { if (!data.gift[row.value]) return null; const list = ServiceParamMap[row.value]; if (list) { const map = getMap(list, 'value', 'label'); return ( {row.label}×{map[data.gift[row.value]]} ); } return ( {row.label}×{data.gift[row.value]} ); })}
原价:
套餐价:
); } }