Tap_set_Ann.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. this.mTitle.string = data.title;
  21. this.mContent.string = data.content
  22. }else{
  23. this.main.showTips('网络异常');
  24. }
  25. })
  26. }
  27. /**
  28. *
  29. * @param prev 父界面
  30. */
  31. public show(prev?:ViewObject){
  32. if(prev){
  33. this.prev = prev;
  34. this.prev.__close();
  35. }
  36. this.main.viewManage.popView1(this.node);
  37. if(this.main && this.main.gameHttp){
  38. this.main.gameHttp.pushEvent(this);
  39. }
  40. }
  41. }