Tap_set_Ann.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import ViewObject from "../main/ViewObject";
  2. import { HttpStateType } from "../util/CHttp";
  3. /**
  4. * 公告
  5. */
  6. const { ccclass, property } = cc._decorator;
  7. @ccclass
  8. export default class Tap_set_Ann extends ViewObject {
  9. @property(cc.Label)
  10. mTitle: cc.Label = null;
  11. @property(cc.Label)
  12. mContent: cc.Label = null;
  13. public onLoad() {
  14. let http = this.main.loginHttp;
  15. this.main.startLoad();
  16. http.sendForm('/notice?channel=1',{},(state,reve:any)=>{
  17. this.main.stopLoad();
  18. if(state == HttpStateType.SUCCESS){
  19. let data = JSON.parse(reve.data)
  20. if(data && data.title){
  21. this.mTitle.string = data.title;
  22. this.mContent.string = data.content
  23. }
  24. }else{
  25. this.main.showTips('网络异常');
  26. }
  27. })
  28. }
  29. /**
  30. *
  31. * @param prev 父界面
  32. */
  33. public show(prev?:ViewObject){
  34. if(prev){
  35. this.prev = prev;
  36. this.prev.__close();
  37. }
  38. this.main.viewManage.popView1(this.node);
  39. if(this.main && this.main.gameHttp){
  40. this.main.gameHttp.pushEvent(this);
  41. }
  42. }
  43. }