CardWriterUI.js 952 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. export class CardWriterUI {
  2. start(params) {
  3. const allowed = hmFS.SysProGetBool("mmk_c_aw");
  4. if(!allowed) return hmApp.goBack();
  5. hmSetting.setBrightScreen(60);
  6. this.viewText = hmUI.createWidget(hmUI.widget.TEXT, {
  7. x: 0,
  8. y: 240,
  9. w: 192,
  10. h: 24,
  11. align_h: hmUI.align.CENTER_H,
  12. color: 0xaaaaaa,
  13. text: "Обработка...",
  14. });
  15. const t = timer.createTimer(0, 1000, () => {
  16. timer.stopTimer(t);
  17. try {
  18. this.process(params);
  19. } catch(e) {
  20. console.log(e);
  21. hmUI.showToast({text: "Что-то пошло не так"});
  22. }
  23. this.finish();
  24. });
  25. }
  26. finish() {
  27. hmUI.deleteWidget(this.viewText);
  28. hmFS.SysProSetBool("mmk_c_aw", false);
  29. const t = timer.createTimer(0, 500, () => {
  30. timer.stopTimer(t);
  31. hmApp.gotoPage({
  32. url: "page/CardView",
  33. param: JSON.stringify(this.result),
  34. });
  35. });
  36. }
  37. }