local this = class("moduleCommonTipBase", G_UIModuleBase)

function this:clickClose()
  self:emit("onClick_close")
end

function this:clickCancel()
  self:emit("onClick_cancel")
end

function this:clickConfirm()
  self:emit("onClick_confirm")
end

function this:cilckBg()
  self:emit("onClick_bg")
end

function this:open()
  if self.parent and self.parent.pageName then
    self._parentPageName = self.parent.pageName
    L_UI:addListener(L_UI.pageEvent.closed, self.preClose, self)
  end
  this.super.open(self)
end

function this:preClose(pageName)
  if pageName ~= self._parentPageName then
    return
  end
  self:close()
end

function this:close()
  if self._parentPageName then
    self._parentPageName = nil
    L_UI:removeListener(L_UI.pageEvent.closed, self.preClose, self)
  end
  this.super.close(self)
end

function this:initModule(params)
  params = params or {}
  self.bind.txt_title = params.txtTitle or L_WordsTpl:getValue("notice_title_hint")
  self.bind.txt_btnCancel = params.txtCancel or L_WordsTpl:getValue("common_window_2")
  self.bind.txt_btnConfirm = params.txtConfirm or L_WordsTpl:getValue("common_window_1")
  self.bind.go_btnConfirm = not params.hideConfirm
  self.bind.go_btnCancel = not params.hideCancel
end

return this
