local this = class("pageCommonWeb", G_UIPageBase)

function this.bind()
  return {
    txtTitle = "",
    webView = {
      moduleName = "pages/common/modules/webView"
    }
  }
end

function this.methods()
  return {
    btnClose = function(self)
      local data_tip = {
        txtContent = L_WordsTpl:getValue("ui_systemMessage_08"),
        confirmCallback = function()
          L_UI:close(self.pageName)
        end
      }
      L_GameUtil.showCommonTip(data_tip)
    end
  }
end

function this:preOpen(option)
  local url = option.url
  local resolution = option.resolution or 1
  local showLoading = option.showLoading == true
  local title = option.title
  self.callback = option.callback
  self.bind.txtTitle = title
  self.modules.webView:setResolution(resolution)
  self.modules.webView:showLoading(showLoading)
  if self.messageHandler == nil then
    self.messageHandler = handler(self, self.onMessageHandler)
  end
  self.modules.webView:setMessageHandler(self.messageHandler)
  self.modules.webView:setUrl(url)
end

function this:close()
  if self.callback then
    self.callback()
  end
end

function this:escHandle()
  local data_tip = {
    txtContent = L_WordsTpl:getValue("ui_systemMessage_08"),
    confirmCallback = function()
      L_UI:close(self.pageName)
      Unity.Input.imeCompositionMode = Unity.IMECompositionMode.Auto
    end
  }
  L_GameUtil.showCommonTip(data_tip)
end

function this:onMessageHandler(message)
end

return this
