index.js 1.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import React, { Component } from 'react';
import './datum-catalog.scss'
import { Accordion } from "antd-mobile";


class DatumCatalog extends Component {

    static defaultProps = {
        datum: [{
            dir_name: '',
            files: [{
                file_name: '',
                file_id: 0
            }]
        }]
    }

    render() {
zhanghaozhe committed
19
        const {datum} = this.props
20 21 22 23 24
        return (
            <div className='datum-catalog'>
                <p className='prompt'>课程资料请到PC端播放页下载</p>
                <Accordion>
                    {
zhanghaozhe committed
25
                        datum && datum.length && datum.map((item, index) => {
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
                            return (
                                <Accordion.Panel header={item.dir_name} key={index}>
                                    {
                                        item.files.map(item => {
                                            return (
                                                <div key={item.file_id} className='file-name'>
                                                    {item.file_name}
                                                </div>
                                            )
                                        })
                                    }
                                </Accordion.Panel>
                            )
                        })
                    }
                </Accordion>
            </div>
        );
    }
}

export default DatumCatalog;