// import {getRankingList, getRaceRanking } from '../../../../service/match';
import { getRaceInfo } from '../../../../service/match';
import {
  $,
  setBg,
  setBack
} from '../../../../util/utils'
class detailsScene extends scene {
    constructor(scope) {
        super(scope);

    }

    onCreate(data) {
        const raceId = data.raceId;
        this.getInfoData(raceId).then(res => {
            this.setContentView(require('../../../../res/tpl/match/details.juicer'), {
                data: res
            }, 'details', {
              containerId: 'root'
            }, () => {
              setBack(false, '.32');
              setBg('#000')
            });
        })

    }
    onOK(e) {
        console.log(e)
        const flag = e.target.con.attributes['data-event'].nodeValue;
        switch (flag) {
            case 'back':
                this.hideScene({}, 'match')
                break;

        }
    }
    getInfoData(raceId) {
        return new Promise((resolve, reject) => {
          getRaceInfo(raceId).success(res => {
            const data = res.data.race.description && res.data.race.description.split(',');
            resolve(data)
          })
        })

    }

    onBack(e) {

    }
}

module.exports = detailsScene;