import React from 'react'; import './index.less'; import { Tabs } from 'antd-mobile'; import Page from '@src/containers/Page'; import Money from '../../../components/Money'; import Button from '../../../components/Button'; import { FAQItem, CommentItem } from '../../../components/Item'; import { Course } from '../../../stores/course'; import { Order } from '../../../stores/order'; import { PcUrl } from '../../../../Constant'; export default class extends Page { initState() { return { tab: 'teacherContent' }; } initData() { const { id } = this.params; Course.get(id).then(result => { this.setState({ data: result }); }); } buy() { Order.speedPay({ productType: 'course', productId: this.params.id }) .then((result) => { linkTo(`/pay/${result.id}`); }); } renderText() { const { tab, data } = this.state; let content; switch (tab) { case 'teacherContent': case 'baseContent': case 'pointContent': content =
; break; case 'faq': content =
{(data.faqs || []).map(row => )}
; break; case 'comment': content =
{(data.comments || []).map(row => )}
; break; default: break; } return content; } renderView() { const { data = {}, tab } = this.state; return (
{data.title}
访问{PcUrl}/course/detail/{data.id},试听该课程
{ this.setState({ tab: value.key }); }} /> {this.renderText()}
总额:
); } }