import { asyncCallNetworkApiGet, asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";

const { ccclass, property } = cc._decorator;

@ccclass
export default class SceneComponent extends MyCocosSceneComponent {

  addPreloadImage() {
    // this._imageResList.push({ url: this.data.pic_url });
  }

  async onLoadEnd() {
    await this.initData();
    this.initView();
    this.initListener();
  }

  async initData() {
    const middleLayer = cc.find('middleLayer');
    if (!middleLayer) {
      return;
    }
    const middleLayerComponent = middleLayer.getComponent('middleLayer');
    const folderId = middleLayerComponent.getData();
    console.log('folderId = ' + folderId);

    const resStr = await asyncCallNetworkApiGet('/api/syllabus/v1/list', {
      pid: folderId
    });
    console.log('resStr = ' + resStr);
    const res = JSON.parse(resStr);
  }

  initView() {

  }

  initListener() {

  }
}
