Service.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. m_WXLabel:cc.Label,
  5. m_QQLabel:cc.Label,
  6. },
  7. OnShowView:function () {
  8. var layout = this.$(`BG/ScrollView/view/Layout`);
  9. for(var i=0;i<layout.childrenCount;i++){
  10. layout.children[i].active = false;
  11. }
  12. this.m_LabExample = this.$(`BG/ScrollView/view/Layout/WX`);
  13. this.m_Parent = this.$(`BG/ScrollView/view/Layout`);
  14. this.m_LabQQExample = this.$(`BG/ScrollView/view/Layout/QQ`);
  15. this.m_QQParent = this.$(`BG/ScrollView/view/Layout`);
  16. this.m_Lab24Example = this.$(`BG/ScrollView/view/Layout/24`);
  17. this.m_24Parent = this.$(`BG/ScrollView/view/Layout`);
  18. this.m_LabText = [];
  19. this.Num = 0;
  20. var webUrl = window.PHP_HOME+'/Services.php?&GetMark=0';
  21. WebCenter.GetData(webUrl, 0, function (data) {
  22. var Json = JSON.parse(data);
  23. for(var i=0;i<Json[0].length;i++){
  24. if(Json[0][i].length > 0){
  25. this.Num++;
  26. this.$(`BG/ScrollView/view/Layout/WX/Label@Label`).string = Json[0][i];
  27. this.m_LabText[this.Num] = this.CopyLabel(this.m_LabExample, this.m_Parent);
  28. }
  29. }
  30. var webUrl1 = window.PHP_HOME+'/Services.php?&GetMark=1';
  31. WebCenter.GetData(webUrl1, 0, function (data) {
  32. var Data = JSON.parse(data);
  33. for(var i=0;i<Data[0].length;i++){
  34. if(Data[0][i].length > 0){
  35. this.Num++;
  36. this.$(`BG/ScrollView/view/Layout/QQ/Label@Label`).string = Data[0][i];
  37. this.m_LabText[this.Num] = this.CopyLabel(this.m_LabQQExample, this.m_QQParent);
  38. }
  39. }
  40. this.m_LabText[this.Num] = this.CopyLabel(this.m_Lab24Example, this.m_24Parent);
  41. }.bind(this));
  42. }.bind(this));
  43. },
  44. CopyLabel: function(pLabel, Parent) {
  45. var pLabCopy = cc.instantiate(pLabel);
  46. Parent.addChild(pLabCopy);
  47. pLabCopy.name = `${Parent.children.length-1}`;
  48. pLabCopy.active = true;
  49. return pLabCopy;
  50. },
  51. OnBtWXCopy:function(){
  52. cc.gSoundRes.PlaySound('Button');
  53. ThirdPartyCopyClipper(this.m_WXLabel.string);
  54. this.m_Hook.ShowTips('已複製到剪貼簿')
  55. },
  56. OnBtCallBack:function(){
  57. cc.gSoundRes.PlaySound('Button');
  58. this.ShowPrefabDLG('CallBack');
  59. },
  60. OnBtComplain:function(){
  61. cc.gSoundRes.PlaySound('Button');
  62. this.ShowPrefabDLG('Complain');
  63. }
  64. // update (dt) {},
  65. });