local this = class("pageTrainTaskSettle", G_UIPageBase)

function this.bind()
  return {
    isOn_success = false,
    go_listReward = false,
    list_reward = L_Const.ModuleInfo.CellIconBag
  }
end

function this.methods()
  return {
    onClick_quit = function(self)
      L_UI:close(self.pageName)
      L_DungeonManager:exitDungeon(true)
    end,
    onClick_restart = function(self)
      L_UI:close(self.pageName)
    end
  }
end

function this:check(options, callback)
  callback(L_DungeonManager:getIsInTrainTaskDungeon())
end

function this:preOpen(options)
  self:initPage()
end

function this:close(options)
end

function this:escHandle()
end

function this:initPage()
  local dungeonState = L_DungeonStore:getStatus()
  local isSuccess = L_WorldManager:getCurModule() == L_Const.worldModule.dungeon and dungeonState == CS.Protocal.Cs.CampaignStatusType.CstWin
  self.bind.isOn_success = isSuccess
  local hasGetReward = true
  self.bind.go_listReward = isSuccess and not hasGetReward
  if self.bind.go_listReward then
    local temp = {}
    self.bind.list_reward:clear()
    self.bind.list_reward:insert_array(temp)
  end
end

return this
