Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

62 righe
1.4 KiB

  1. local ErrorView = {};
  2. ErrorView.__index = ErrorView;
  3. -- 创建新对象
  4. function ErrorView:new(...)
  5. local instance = {};
  6. setmetatable(instance , ErrorView);
  7. instance:ctor(...);
  8. return instance;
  9. end
  10. function ErrorView:ctor(errString, onClickOk)
  11. self.errString = errString;
  12. self.onClickOk = onClickOk;
  13. self:onEnter();
  14. end
  15. function ErrorView:onEnter()
  16. local ui = loadUI("preload/res/preload_error.ui")
  17. self.ui = ui;
  18. local actorId = loadUserId()
  19. local errcode = string.format("errorCode:%s_%s", actorId, os.date("%Y%m%d%H%M%S", os.time()))
  20. self.ui.Items.Text_ID:setString(errcode)
  21. ui.Items.Button:addTouchEventListener(handler(self, self.onClickOk))
  22. local function onButtonClickKeFu()
  23. playBtnEffect()
  24. local tt =
  25. {
  26. action = "collecturl.getDataByUid";
  27. app_id = getAppId(); --应用id
  28. };
  29. local phpUrl = getGlobalPhpUrl()
  30. httpPost(phpUrl, tt, function(status, response)
  31. if status == "successed" then
  32. local data = json.decode(response)
  33. if data.code == 200 and data.result ~= null then
  34. app.plugin:callUrl(data.result.kefuurl)
  35. end
  36. else
  37. local url = "http://cs.zxtycest.com/addons/kefu?gameid=47"
  38. app.plugin:callUrl(url)
  39. end
  40. end)
  41. end
  42. ui.Items.Button_KeFu:registerClick(onButtonClickKeFu);
  43. end
  44. function ErrorView:onClickOk(sender, eventType)
  45. if eventType == 2 then
  46. -- 回调
  47. if self.onClickOk then
  48. self.onClickOk()
  49. end
  50. end
  51. self.ui:removeFromParent()
  52. return true;
  53. end
  54. return ErrorView;