import './index.less'
import React, { useEffect, useState } from "react";
import api from '~/api'
export const VideoList: React.FC = (props: any) => {
    const [configList, setConfigList] = useState([{
        jiao: 'https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu1jiao.png',
        title: "科目一",
        bg: "https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu1Bg.png"
    }, {
        jiao: 'https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu2jiao.png',
        bg: "https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu2Bg.png",
        title: "科目二"
    }, {
        jiao: 'https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu3jiao.png',
        bg: "https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu3Bg.png",
        title: "科目三"
    }, {
        jiao: 'https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu4jiao.png',
        bg: "https://t1-1305573081.file.myqcloud.com/ctjk/nbjk/h5/videoList/kemu4Bg.png",
        title: "科目四"
    }])
    const [list, setList] = useState([{
        createTime: "2023-02-20 14:46:40",
        id: 1,
        state: 1,
        updateTime: "2023-02-20 15:13:57",
        videoCover: "https://t1-1305573081.file.myqcloud.com/ctjk/h5/videoList/km1.png",
        videoName: "01小车科目一ABS题",
        videoSubject: 1,
        videoUrl: "https://mp.weixin.qq.com/s?__biz=Mzg2OTkwMDU0OA==&mid=2247483656&idx=1&sn=61381ded69ebe20d8c0fedc7e77ee0ce&chksm=ce974963f9e0c075bb209fde63d128a97936eb65694d373853c6352584acc645085f42f7b9d5#rd"
    }])
    const [subject, setSubject] = useState(1)
   
    useEffect(()=>{
        let query = new URLSearchParams(window.location.search)
        console.log(query.get("subject"))
        api.studentVideoTeachingList({
            state: 1,
            videoSubject: Number(query.get("subject"))
        }).then(res => {
            setList(res.data.rows)
            console.log(res)
            
        
    
    
        })

    },[])
   

    return (
        <div className="videoList">
            <div className="list">

                <div className="list-title">书籍视频解说</div>
                {
                    list.map((item, index) => {
                        return (
                            <a key={index} href={item.videoUrl}>
                                <div className='list-item'>
                                    <img className='list-item-play' alt='' src='https://t1-1305573081.file.myqcloud.com/ctjk/h5/videoList/play.png' />
                                    <img style={{ width: '44.5w' }} alt='' src={item.videoCover} />
                                    <div className='list-item-name'>{item.videoName}</div>
                                </div>


                            </a>)
                    })

                }
            </div>
        </div>
    )

}