page.js 704 B

123456789101112131415161718192021222324252627282930
  1. import React from 'react';
  2. import './index.less';
  3. import Page from '@src/containers/Page';
  4. import { asyncSMessage } from '@src/services/AsyncTools';
  5. import { Main } from '../../../stores/main';
  6. export default class extends Page {
  7. constructor(props) {
  8. super(props);
  9. this.state = { courseIndex: 0 };
  10. }
  11. initData() {
  12. const { key } = this.params;
  13. Main.getContract(key)
  14. .then(result => {
  15. this.setState({ data: result });
  16. })
  17. .catch(e => {
  18. asyncSMessage(e.message, 'error');
  19. linkTo('empty');
  20. });
  21. }
  22. renderView() {
  23. const { data = {} } = this.state;
  24. return <div dangerouslySetInnerHTML={{ __html: data.content || '' }} />;
  25. }
  26. }