ClubMemberUnCheck.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. import GameM, { AUDIO_TYPE } from "../../manager/GameM";
  8. import MemberListItem from "./MemberListItem";
  9. const {ccclass, property} = cc._decorator;
  10. @ccclass
  11. export default class ClubMemberUnCheck extends cc.Component {
  12. @property(cc.Node)
  13. contentNode: cc.Node = null;
  14. @property(cc.Prefab)
  15. memberInfoPrefab:cc.Prefab = null;
  16. @property(cc.Node)
  17. emtpyTip:cc.Node = null;
  18. @property(cc.Label)
  19. checkLabel:cc.Label = null;
  20. // LIFE-CYCLE CALLBACKS:
  21. // onLoad () {}
  22. childMoney = null
  23. childList = null
  24. childNum = null
  25. currentIndex = 0
  26. start () {
  27. }
  28. closeClick(){
  29. GameM.audioM.playEffect(AUDIO_TYPE.button)
  30. if(cc.isValid(this.node)){
  31. this.node.destroy()
  32. }
  33. }
  34. showMemberListByInfo(event,type){
  35. let index = Number(type)
  36. this.currentIndex = index
  37. this.contentNode.destroyAllChildren()
  38. if(this.childList != null && this.childList != undefined){
  39. for(let entry of this.childList){
  40. let node = cc.instantiate(this.memberInfoPrefab)
  41. node.parent = this.contentNode
  42. node.getComponent(MemberListItem).initInfo(entry)
  43. }
  44. }
  45. }
  46. getChildInfo(){
  47. this.contentNode.destroyAllChildren()
  48. let memberInfo = GameM.ClubData.memberInfo
  49. if(memberInfo == null || memberInfo == null){
  50. this.emtpyTip.active = true
  51. return
  52. }
  53. let child1List = GameM.ClubData.memberInfo.g1Members
  54. let validStandard = GameM.ClubData.memberInfo.validStandard
  55. this.emtpyTip.active = false
  56. let count = 0
  57. for (let entry of child1List) {
  58. if(entry.validStatus == 0){
  59. let node = cc.instantiate(this.memberInfoPrefab)
  60. node.parent = this.contentNode
  61. this.setNodeInfo(node,entry,validStandard)
  62. count++
  63. }
  64. }
  65. if(count> 0){
  66. this.emtpyTip.active = false
  67. }else{
  68. this.emtpyTip.active = true
  69. }
  70. }
  71. setNodeInfo(node:cc.Node,data,validStandard){
  72. if(data == null || data == undefined){
  73. return
  74. }
  75. if (data.avatar != null && data.avatar != undefined && data.avatar != "") {
  76. cc.loader.load(data.avatar + "?aaa=aa.jpg", (err, res) => {
  77. if (err) {
  78. console.log('err:', err);
  79. return;
  80. }
  81. if (cc.isValid(node.getChildByName("maskNode") && cc.isValid(node.getChildByName("maskNode").getChildByName("head")))) {
  82. let tex: cc.Texture2D = res as cc.Texture2D;
  83. node.getChildByName("maskNode").getChildByName("head").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(tex);
  84. }
  85. })
  86. }
  87. node.getChildByName("nameLabel").getComponent(cc.Label).string = data.nickname
  88. node.getChildByName("unCheckJindu").getComponent(cc.Sprite).fillRange = data.gameWithdrawAmount /data.validStandard
  89. node.getChildByName("jinduLabel").getComponent(cc.Label).string = (data.gameWithdrawAmount/10000).toFixed(2) +"/"+(validStandard/10000)+"元"
  90. }
  91. // update (dt) {}
  92. }