local ErrorView = {}; ErrorView.__index = ErrorView; -- 创建新对象 function ErrorView:new(...) local instance = {}; setmetatable(instance , ErrorView); instance:ctor(...); return instance; end function ErrorView:ctor(errString, onClickOk) self.errString = errString; self.onClickOk = onClickOk; self:onEnter(); end function ErrorView:onEnter() local ui = loadUI("preload/res/preload_error.ui") self.ui = ui; local actorId = loadUserId() local errcode = string.format("errorCode:%s_%s", actorId, os.date("%Y%m%d%H%M%S", os.time())) self.ui.Items.Text_ID:setString(errcode) ui.Items.Button:addTouchEventListener(handler(self, self.onClickOk)) local function onButtonClickKeFu() playBtnEffect() local tt = { action = "collecturl.getDataByUid"; app_id = getAppId(); --应用id }; local phpUrl = getGlobalPhpUrl() httpPost(phpUrl, tt, function(status, response) if status == "successed" then local data = json.decode(response) if data.code == 200 and data.result ~= null then app.plugin:callUrl(data.result.kefuurl) end else local url = "http://cs.zxtycest.com/addons/kefu?gameid=47" app.plugin:callUrl(url) end end) end ui.Items.Button_KeFu:registerClick(onButtonClickKeFu); end function ErrorView:onClickOk(sender, eventType) if eventType == 2 then -- 回调 if self.onClickOk then self.onClickOk() end end self.ui:removeFromParent() return true; end return ErrorView;