History.js 50 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966
//观看历史
//这里跳转地址是由返回数据指定,暂未实现
//这里获取CategoryList数据的接口有问题
//正常接口不管limit字段多少返回的count都是总数据量,这里只返回了limit的数量,导致CategoryList刷新出错!!!
var Common = require('Common');
var Network = require('Network');
var TVFocus = require('TVFocus');
var FocusInfo = require('FocusInfo');
var TVCanvas = require('TVCanvas');
var TVScrollParameter = require('TVScrollParameter');
var ListView = require('ListView');
var ListCell = require('ListCell');
var Utils = require('Utils');
var BusinessParameter = require('BusinessParameter');

cc.Class({
    extends: TVCanvas,

    properties: {
        spriteScrollBarBlock: cc.Sprite,
        spriteScrollBarUp: cc.Sprite,
        spriteScrollBarDown: cc.Sprite,
        _bPfbTypeCellInit: false,
        _aTypeAppId: [],
        _aTypeUrl: [],
        _aNavList: [],
        _nodeTypeHeight: 0,
        TYPE_LIST_CELL_SIZE: 4,

        _strAppId: '',   //为了跳播放
        _strDirURL: '',
        _oDestURL: null,
        _strIndexURL: '',
        _strIconSrc: '',
        _iCollectionId: 0,//默认收藏夹的id
        _aEpisodeIndex: [],//剧集index集合
        _strPageIds: '', //页面内mediaId
        _bIsContentWStatus: true,//海报图状态,true为横图,false为竖图

        _bIsCategoryListDataInit: false,
        // _iCurrentTypeIndex: 0,
        _strIds: '',
        _oType: null,

        _aCategoryMediaId: [],
        _aCategoryAlreadyMediaId: [],

        _bBackStatus: false,

        // PFB_TYPE: {
        //     default: null,
        //     type: cc.Prefab,
        // },
    },

    onLoad: function () {
        this._super();

        this._iShowCellRows = 3;
        this._iAlphaCellRows = 0;
        this._iHiddenCellRows = 3;
        this._iCellCountEachRow = 2;
        this._iBeginPositionX = -200;
        this._iBeginPositionY = 210;
        this._fCellMarginTop = 20;
        this._fCellMarginRight = 15;
        this._fCellMarginBottom = 10;
        this._fCellMarginLeft = 0;

        //-----------上下文及参数相关处理------------
        let oSceneParameter = this._cApplication.getTopSceneParameter();
        if (oSceneParameter) {
            this._strAppId = oSceneParameter.appId;//应用id
        }
        //恢复上下文
        if (this._cApplication.getBackStatus()) {
            this._oSceneContext = this._cApplication.popSceneContext();
            this._cApplication.setBackStatus(false);
            this._bBackStatus = true;
        } else {
            this._oSceneContext = {};
            this._oSceneContext.requestedTypeId = null;
            this._oSceneContext._iCurrentTypeIndex = 0;
            this._oSceneContext.categoryRecordIndexOfFirstCell = 0;
            this._oSceneContext.focusPath = "CollectionIcon";
            this._oSceneContext.typeListY = 0;
            // this._oSceneContext.elderTypeId = oSceneParameter.elderTypeId || 37;    //从上级拿过来的二级父Id
        }

        this._strAppId = this._strAppId || "tda7e47f868313d9f5";  //测试
        //---------上下文及参数相关处理结束-----------

        //左分类框框
        this._nodeTypeListWrapper = cc.find("TypeListArea/TypeListWrapper", this.node);
        this._nodeTypeList = cc.find("TypeList", this._nodeTypeListWrapper);
        this._nodeTypeList.addComponent(TVScrollParameter);

        // //右分类框框
        this._nodeCategoryList = cc.find("CategoryList", this.node);

        // cc.find("HistoryIcon", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54));
        cc.find("CollectionIcon", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 176, 64));
        cc.find("EditorSprite", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 137, 64));
        cc.find("IndexSprite", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 137, 64));

        //滚动条按钮
        let nodeScrollBtn = cc.find("CategoryList/ScrollBarContainer/ScrollBarShadow/ScrollBarBlock", this.node);
        var fiScrollBtn = nodeScrollBtn.addComponent(FocusInfo);
        this._aFocusTargets[0]['scroll_bar_block'] = nodeScrollBtn;
        fiScrollBtn.init(null, true);

        this.getPageBg(this, 'background');
        // this.addHomeIcon(this);
        // this.getTypeList();  //暂时不要Type
        this.getListBookmark();     //直接请求
        this.checkDataReadyAndInitFocus();      //初始化焦点放到这里
    },

    // getTypeList: function () {
    //     let oTypeRequestParameters = {
    //         "view": "json",
    //         "start": 0,
    //         "limit": 100,
    //         "name": "indexHistoryNew",
    //         "sortField": "left",
    //         "sortDirection": "desc",
    //         "token": Common.TEST_API_TOKEN,
    //     };
    //     Network.ajax('GET', Common.TOPDRAW_API_SERVER + "Promotion/ListItemByName", null, oTypeRequestParameters,
    //         function (strResponse) {
    //             try {
    //                 var oJSONResult = JSON.parse(strResponse);
    //                 if (oJSONResult.businessCode == 'success') {
    //                     if (oJSONResult.resultSet.length > 0) {
    //                         this._oType = [];
    //                         this._aNavList = [];
    //                         cc.loader.setAutoReleaseRecursively(this.PFB_TYPE, true);   //设置允许自动释放
    //                         for (var i = 0; i < oJSONResult.resultSet.length; i++) {
    //                             let oTvlink = JSON.parse(oJSONResult.resultSet[i].tvlink);
    //                             let oListCell = {};
    //                             let jaClick = oTvlink.click;
    //                             let oParameters = null
    //                             for (let i = 0; i < jaClick.length; i++) {
    //                                 oParameters = jaClick[i].parameters;
    //                             }
    //                             oListCell.appId = oParameters.appId;

    //                             this._aNavList.push(oListCell);
    //                             this._aTypeAppId.push(oParameters.appId);      //拿到appId并保存到_aTypeAppId
    //                             this._oType.push(oJSONResult.resultSet[i]);
    //                             //恢复上下文带过来的位置
    //                             // if (this._oSceneContext.requestedTypeId && this._oSceneContext.requestedTypeId == oJSONResult.resultSet[i].id) {
    //                             //     this._iCurrentTypeIndex = i;
    //                             // }
    //                             let nodeTypeListCell = cc.instantiate(this.PFB_TYPE);
    //                             nodeTypeListCell.y = -nodeTypeListCell.height / 2 - i * (nodeTypeListCell.height + 27) - 10;
    //                             this._nodeTypeList.addChild(nodeTypeListCell, 10, "TypeListCell" + i);
    //                             //准备焦点坐标
    //                             let fiTypeBlock = nodeTypeListCell.addComponent(FocusInfo);
    //                             fiTypeBlock.init(
    //                                 '',
    //                                 true, null, null, 1.15
    //                             );
    //                             this._aFocusTargets[0]['type_list_cell_' + i] = nodeTypeListCell;
    //                             if (oJSONResult.resultSet[i].image[0]) {
    //                                 let width = oJSONResult.resultSet[i].image[0].width;
    //                                 let height = oJSONResult.resultSet[i].image[0].height / 2;
    //                                 nodeTypeListCell.width = width;
    //                                 nodeTypeListCell.height = height;
    //                                 this._nodeTypeHeight = height;
    //                                 if (this._oSceneContext._iCurrentTypeIndex == i) {
    //                                     Network.loadImageInNativeRuntime(
    //                                         Common.TOPDRAW_IMAGE_SERVER + oJSONResult.resultSet[i].image[0].fileUrl,
    //                                         function (texture) {
    //                                             cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height));
    //                                         }, null, this
    //                                     );
    //                                 } else {
    //                                     Network.loadImageInNativeRuntime(
    //                                         Common.TOPDRAW_IMAGE_SERVER + oJSONResult.resultSet[i].image[0].fileUrl,
    //                                         function (texture) {
    //                                             cc.find('Bg', nodeTypeListCell).getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height));
    //                                         }, null, this
    //                                     );
    //                                 }
    //                             }
    //                         }
    //                         this._oSceneContext.requestedTypeId = this._aTypeAppId[this._oSceneContext._iCurrentTypeIndex];
    //                         this.getCollectionId();

    //                         this._bInitTypeListSuccess = true;
    //                         this.checkDataReadyAndInitFocus();      //初始化焦点放到这里
    //                     } else {
    //                         this._oSceneContext.focusPath = "app";
    //                     }
    //                     cc.log("Success GET TYPE LIST...");
    //                 } else {
    //                     cc.log("Error GET TYPE LIST..." + oJSONResult.description);
    //                 }
    //             } catch (error) {
    //                 cc.log("Exception GET TYPE LIST..." + error);
    //             }
    //         },
    //         function (strResponse) {
    //             cc.log("Communication Error : Get Type List Information..." + strResponse + "\r\n");
    //         }, this, "uuid"
    //     );
    // },

    // //获取当前的appId等相关的信息
    // getCollectionId: function () {
    //     this._strAppId = this._aNavList[this._oSceneContext._iCurrentTypeIndex].appId;
    //     this._strDirURL = this._aNavList[this._oSceneContext._iCurrentTypeIndex].dirURL;
    //     this._oDestURL = this._aNavList[this._oSceneContext._iCurrentTypeIndex].destURL;
    //     this._strIndexURL = this._aNavList[this._oSceneContext._iCurrentTypeIndex].indexURL;
    //     var oGetDefaultCollectionPara = {
    //         'view': "json",
    //         'appId': this._strAppId,
    //         "token": Common.TEST_API_TOKEN,
    //     };
    //     Network.ajax('GET', Common.TOPDRAW_API_SERVER + "User/GetDefaultCollection", null, oGetDefaultCollectionPara,
    //         function (strResponse) {
    //             try {
    //                 var oJSONResult = JSON.parse(strResponse);
    //                 // var strBlank = '{"businessCode":"success","count":0,"currentTime":1542195457309,"description":"","resultSet":[]}';
    //                 if (oJSONResult.businessCode == 'success') {
    //                     this._iCollectionId = oJSONResult.resultSet[0].id;  //获取默认收藏id
    //                     // if (this._strAppId == BusinessParameter.CARTOON_APPID) {   //动漫
    //                     //     this._bIsContentWStatus = false;                  //竖图
    //                     //     //     this._nodeCategoryList.getComponents(ListView)[1].renderInitData(strBlank); //另一个置空
    //                     //     //     this.lvCategoryList = this._nodeCategoryList.getComponents(ListView)[0];
    //                     // } else {                                              //横图
    //                     //     this._bIsCategoryListDataInit = true;
    //                     //     //     this._nodeCategoryList.getComponents(ListView)[0].renderInitData(strBlank);
    //                     //     //     this.lvCategoryList = this._nodeCategoryList.getComponents(ListView)[1];
    //                     // }

    //                     this.getListBookmark();
    //                     cc.log("Success GET GetDefaultCollection...");
    //                 } else {
    //                     cc.log("Error GET GetDefaultCollection..." + oJSONResult.description);
    //                 }
    //             } catch (error) {
    //                 cc.log("Exception GET GetDefaultCollection..." + error);
    //             }
    //         },
    //         function (strResponse) {
    //             cc.log("Communication Error : Get GetDefaultCollection Information..." + strResponse + "\r\n");
    //         }, this, "uuid"
    //     );
    // },

    /**
     * 拿到列表需要的ids
     */
    getListBookmark: function () {
        let oTypeRequestParameters = {
            "view": "json",
            // "appId": this._aTypeAppId[this._oSceneContext._iCurrentTypeIndex],
            "sortByCollection": 1,
            "start": 0,
            "limit": 9,
            "sortField": "update_time",
            "sortDirection": "desc",
            "token": Common.TEST_API_TOKEN_EDU,
        };
        Network.ajax('GET', Common.TOPDRAW_API_SERVER_EDU + "User/ListBookmark", null, oTypeRequestParameters,
            function (strResponse) {
                try {
                    var oJSONResult = JSON.parse(strResponse);
                    if (oJSONResult.businessCode == 'success') {
                        this._strIds = "";    //初始化
                        if (oJSONResult.resultSet.length > 0) {
                            cc.find('BlankIcon', this.node).opacity = 0;
                            for (let i = 0; i < oJSONResult.resultSet.length; i++) {
                                if (oJSONResult.resultSet[i].media_id) {
                                    this._strIds = this._strIds + "," + oJSONResult.resultSet[i].media_id;
                                }
                            }
                            // this.getCategoryList();
                        }
                        this.getCategoryList();
                        //  else {
                        //     cc.find('BlankIcon', this.node).opacity = 255;
                        //     let lvCategoryList = this._nodeCategoryList.getComponent(ListView);
                        //     lvCategoryList.renderInitData(strResponse);     //将ListView数据置空
                        //     this._oSceneContext.focusPath = "app";
                        // }
                        cc.log("Success GET ListBookmark...");
                    } else {
                        cc.log("Error GET ListBookmark..." + oJSONResult.description);
                    }
                } catch (error) {
                    cc.log("Exception GET ListBookmark..." + error);
                }
            },
            function (strResponse) {
                cc.log("Communication Error : Get ListBookmark Information..." + strResponse + "\r\n");
            }, this, "uuid"
        );
    },

    getCategoryList: function () {
        //把之前的东西删掉
        let nodeCategoryList = this.node.getChildByName('CategoryList');
        // nodeCategoryList.getChildByName('DataContainerMask').getChildByName('DataContainer').removeAllChildren();
        nodeCategoryList.getChildByName('DataContainerMask').getChildByName('DataContainer').destroyAllChildren();

        // let strAppId = this._aTypeAppId[this._oSceneContext._iCurrentTypeIndex];
        // switch (strAppId) {
        //     case BusinessParameter.CARTOON_APPID:
        // this._oSceneContext.focusPath = this._oSceneContext.focusPath || "SongList/DataContainerMask/DataContainer/ListCell0/SongTitleContainer";
        // this._strSongListCellComponentName = "HistoryCartoonListCell";
        // this._iBeginPositionX = -250;
        // this._iBeginPositionY = 200;
        // this._iShowCellRows = 2;
        // this._iAlphaCellRows = 0;
        // this._iHiddenCellRows = 2;
        // this._iCellCountEachRow = 3;
        // this._fCellMarginTop = 0;
        // this._fCellMarginRight = 53;
        // this._fCellMarginBottom = 15;
        // this._fCellMarginLeft = 0;
        //     break;
        // default:
        //     // this._oSceneContext.focusPath = this._oSceneContext.focusPath || "SongList/DataContainerMask/DataContainer/ListCell0/ImageBlock";
        this._strSongListCellComponentName = "HistoryOtherListCell";
        this._iBeginPositionX = -450;
        this._iBeginPositionY = 250;
        this._iShowCellRows = 2;
        this._iAlphaCellRows = 1;
        this._iHiddenCellRows = 2;
        this._iCellCountEachRow = 4;
        this._fCellMarginTop = 0;
        this._fCellMarginRight = 20;
        this._fCellMarginBottom = 60;
        this._fCellMarginLeft = 0;
        //     break;
        // }
        //重新开始
        let lvCategoryList = nodeCategoryList.getComponent(ListView);
        if (!lvCategoryList) {
            lvCategoryList = nodeCategoryList.addComponent(ListView);
        }

        var ids = this._strIds.substring(1, this._strIds.length);
        lvCategoryList.init(this, this._iShowCellRows, this._iAlphaCellRows, this._iHiddenCellRows, this._iCellCountEachRow, this._strSongListCellComponentName,
            this._iBeginPositionX, this._iBeginPositionY,//起始位置
            this._fCellMarginTop, this._fCellMarginRight, this._fCellMarginBottom, this._fCellMarginLeft,
            1, 1, //0-横向 1-纵向
            function () {
                //请求列表
                let oMediaParas = {};
                oMediaParas.ids = ids;
                // oMediaParas.appId = strAppId;
                oMediaParas.sortField = "update_time";
                oMediaParas.sortDirection = "desc";
                let iStart1 = 0;
                if (null != this._oSceneContext.categoryRecordIndexOfFirstCell) {
                    iStart1 = this._oSceneContext.categoryRecordIndexOfFirstCell;
                }

                //函数默认取一页数据,但是第一次显示需要加上Alpha的部分
                lvCategoryList.setDataSource(
                    "GET",
                    Common.TOPDRAW_API_SERVER_EDU + "Media/List",
                    oMediaParas,
                    iStart1, (lvCategoryList.getShowCellRows() + lvCategoryList.getAlphaCellRows()) * lvCategoryList.getCellCountEachRow(),
                    null, null
                );
                lvCategoryList.loadData(
                    function (strResponse) {
                        lvCategoryList.renderInitData(strResponse, function () {
                            var oJSONResult = JSON.parse(strResponse);
                            if (oJSONResult.resultSet.length <= 0) {    //没有数据就显示占位图
                                cc.find('BlankIcon', this.node).opacity = 255
                            } else {
                                cc.find('BlankIcon', this.node).opacity = 0
                            }
                            // this.lvCategoryList.renderInitData(strResponse);
                            this._bIsCategoryListDataInit = true;
                            this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();

                            this.checkDataReadyAndInitFocus();

                            // for (var key in this._aFocusTargets[0]) {
                            //     cc.log(key + "=====current focus========" + this._aFocusTargets[0][key].name + "==cc.isValid==" + cc.isValid(this._aFocusTargets[0][key]));
                            // }
                        });
                    },
                    null,
                    this
                );
            }
        );

        // var self = this;

        // lvCategoryList.setDataDecorator(
        //     function (oData, onDecorate, oScope) {
        //         let oCollectionRequestParameters = {
        //             "view": "json",
        //             "mediaIds": "",
        //             "needCollection": 1,
        //             "start": 0,
        //             "limit": 0,
        //             "appId": self._strAppId,
        //             "token": Common.TEST_API_TOKEN,
        //         };

        //         let aData = oData.refData;

        //         //造一个跳转tvlink
        //         for (let i = 0; i < aData.length; i++) {
        //             //造一个跳转界面
        //             let tvlink = '';
        //             if (aData[i].type == 4) {
        //                 tvlink = '{"click": [{"action": "ChangeScene","parameters": {"sceneName":"sceneProgramPlayerFullScreen",\
        //                     "appId":"' + self._strAppId + '","id":"' + aData[i].id + '","episodeNum":"' + aData[i].episode_number + '"}}]}';
        //             } else {
        //                 tvlink = '{"click": [{"action": "ChangeScene","parameters": {"sceneName":"sceneProgramPlayerFullScreen",\
        //                 "appId":"' + self._strAppId + '","id":"' + aData[i].id + '"}}]}';
        //             }
        //             aData[i].tvlink = tvlink;
        //         }

        //         for (let i = 0; i < aData.length; i++) {
        //             oCollectionRequestParameters.mediaIds += (aData[i].id + ',');
        //         }
        //         oCollectionRequestParameters.limit = aData.length;
        //         oCollectionRequestParameters.mediaIds = oCollectionRequestParameters.mediaIds.substring(0, oCollectionRequestParameters.mediaIds.length - 1);

        //         // if (this._strAppId != BusinessParameter.CARTOON_APPID) {    //刨去动漫,动漫没有收藏选项
        //         // Network.ajax('GET', Common.TOPDRAW_API_SERVER + "User/ListMediaAdditional", null, oCollectionRequestParameters,
        //         //     function (strResponse) {
        //         //         try {
        //         //             var oJSONResult = JSON.parse(strResponse);
        //         //             if (oJSONResult.businessCode == 'success') {
        //         //                 self._aCategoryAlreadyMediaId = [];
        //         //                 for (var i = 0; i < oJSONResult.resultSet[0].collections.length; i++) {
        //         //                     var mediaId = oJSONResult.resultSet[0].collections[i].media_id;
        //         //                     for (let i = 0; i < aData.length; i++) {
        //         //                         // cc.log("tvlink--------------------->" + aData[i].tvlink);
        //         //                         if (aData[i].id == mediaId) {       //检测是否收藏
        //         //                             aData[i].isCollect = true;      //将已收藏的插进去
        //         //                         }
        //         //                     }
        //         //                 }

        //         //                 if (onDecorate) {
        //         //                     if (null != oScope) {
        //         //                         onDecorate.call(oScope, aData);
        //         //                     } else {
        //         //                         onDecorate(aData);
        //         //                     }
        //         //                 }

        //         //                 cc.log("Success GET MediaAdditinal...");
        //         //             } else {
        //         //                 cc.log("Error GET MediaAdditinal..." + oJSONResult.description);
        //         //             }
        //         //         } catch (error) {
        //         //             cc.log("Exception GET MediaAdditinal..." + error);
        //         //         }
        //         //     },
        //         //     function (strResponse) {
        //         //         cc.log("Communication Error : Get MediaAdditinal Information..." + strResponse + "\r\n");
        //         //     }, self, "uuid"
        //         // );
        //         // }

        //     }
        // );


        // lvCategoryList.setDataPositionRender(function (iPosition, iCount) {
        //     //这里是ListView的this 执行时作用域
        //     let nodeDataPosition = self.node.getChildByName('DataPosition');
        //     if (iCount == 0) {
        //         nodeDataPosition.getComponent(cc.Label).string = "1 / 1";
        //         nodeDataPosition.x = Common.SCREEN_WIDTH / 2 - 70 - nodeDataPosition.width / 2;
        //         return;
        //     }
        //     if (null == iCount) {
        //         iCount = parseInt(nodeDataPosition.getComponent(cc.Label).string.split('/')[1]);
        //         cc.log(iCount);
        //     }
        //     nodeDataPosition.getComponent(cc.Label).string = Math.ceil(Math.min((iPosition + self._iShowCellRows * self._iCellCountEachRow - 1), iCount) / self._iShowCellRows / self._iCellCountEachRow) + " / " + Math.ceil(iCount / self._iShowCellRows / self._iCellCountEachRow);
        //     nodeDataPosition.x = Common.SCREEN_WIDTH / 2 - 70 - nodeDataPosition.width / 2;
        //     // this._compSceneCanvas.checkCountAndDisplayTopBtns(iCount);
        // });
    },

    /**
     * 添加收藏
     */
    AddMedia2Collection: function () {
        let nodeId = this._fiCurrentFocus.node.parent.getComponent(ListCell).id;
        if (!nodeId || !this._iCollectionId) {
            return;
        }
        let oCollectionRequestParameters = {
            "view": "json",
            "mediaId": nodeId,
            "collectionId": this._iCollectionId,
            "appId": this._strAppId,
            "token": Common.TEST_API_TOKEN,
        };
        Network.ajax('GET', Common.TOPDRAW_API_SERVER + "User/AddMedia2Collection", null, oCollectionRequestParameters,
            function (strResponse) {
                try {
                    var oJSONResult = JSON.parse(strResponse);
                    if (oJSONResult.businessCode == 'success') {
                        cc.log("添加成功");
                        // this.getCategoryList();  //不能更新网络,焦点会错乱
                        this._aCategoryAlreadyMediaId.push(nodeId);
                        let nodeCollectionPic = cc.find("CollectionBg/CollectionPic", this._fiCurrentFocus.node.parent);
                        cc.loader.loadRes("texture/ui/collect_heart", cc.Texture2D, function (err, texture) {
                            var spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 28, 30, 28));
                            nodeCollectionPic.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                        });
                    } else {
                        cc.log("Error GET AddMedia..." + oJSONResult.description);
                    }
                } catch (error) {
                    cc.log("Exception GET AddMedia..." + error);
                }
            },
            function (strResponse) {
                cc.log("Communication Error : Get AddMedia Information..." + strResponse + "\r\n");
            }, this, "uuid"
        );
    },

    /**
     * 移除收藏
     */
    removeMedia2Collection: function () {
        let nodeId = this._fiCurrentFocus.node.parent.getChildByName('Id').getComponent(cc.Label).string;
        if (!nodeId || !this._iCollectionId) {
            return;
        }
        let oCollectionRequestParameters = {
            "view": "json",
            "mediaId": nodeId,
            "collectionId": this._iCollectionId,
            "appId": this._strAppId,
            "token": Common.TEST_API_TOKEN,
        };
        Network.ajax('GET', Common.TOPDRAW_API_SERVER + "User/RemoveMediaFromCollection", null, oCollectionRequestParameters,
            function (strResponse) {
                try {
                    var oJSONResult = JSON.parse(strResponse);
                    if (oJSONResult.businessCode == 'success') {
                        cc.log("移除成功");
                        // this.getCategoryList();  //不能更新网络,焦点会错乱
                        Utils.remove(this._aCategoryAlreadyMediaId, nodeId);
                        let nodeCollectionPic = cc.find("CollectionBg/CollectionPic", this._fiCurrentFocus.node.parent);
                        cc.loader.loadRes("texture/ui/collect_heart", cc.Texture2D, function (err, texture) {
                            var spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, 30, 28));
                            nodeCollectionPic.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                        });
                    } else {
                        cc.log("Error GET removeMedia..." + oJSONResult.description);
                    }
                } catch (error) {
                    cc.log("Exception GET removeMedia..." + error);
                }
            },
            function (strResponse) {
                cc.log("Communication Error : Get removeMedia Information..." + strResponse + "\r\n");
            }, this, "uuid"
        );
    },

    checkDataReadyAndInitFocus: function () {
        if (!this._bIsFocusInit) {
            this.initFocus();
            this._bIsFocusInit = true;
        }
    },

    initFocus: function () {
        var self = this;
        // //----------------Creator2.1.0-rc2版本有毒--------------------------
        // //动态加载这几张引起黑屏的罪魁祸首
        // cc.loader.loadRes("Texture/scroll/pageIncon", cc.SpriteFrame, function (err, spriteFrame) {
        //     self.spriteScrollBarBlock.spriteFrame = spriteFrame;
        // });
        // cc.loader.loadRes("Texture/scroll/up_arrow", cc.SpriteFrame, function (err, spriteFrame) {
        //     self.spriteScrollBarUp.spriteFrame = spriteFrame;
        // });
        // cc.loader.loadRes("Texture/scroll/down_arrow", cc.SpriteFrame, function (err, spriteFrame) {
        //     self.spriteScrollBarDown.spriteFrame = spriteFrame;
        // });
        // //-----------------------------------------------------------------
        var nodeEditor = cc.find("EditorSprite", this.node);    //管理
        // cc.find("HistoryIcon", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54));
        var fiEditor = nodeEditor.addComponent(FocusInfo);
        this._aFocusTargets[0]['to_editor_index'] = nodeEditor;
        fiEditor.init(
            null, true
        );

        var nodeIndex = cc.find("IndexSprite", this.node);    //首页
        // cc.find("HistoryIcon", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54));
        var fiIndex = nodeIndex.addComponent(FocusInfo);
        this._aFocusTargets[0]['to_first_index'] = nodeIndex;
        fiIndex.init(
            null, true
        );

        var nodeCollection = cc.find("CollectionIcon", this.node);    //我的收藏
        // cc.find("CollectionIcon", this.node).getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 142, 54));
        var fiCollection = nodeCollection.addComponent(FocusInfo);
        this._aFocusTargets[0]['to_collection_index'] = nodeCollection;
        fiCollection.init(
            '{"click": [{"action": "ChangeScene","parameters": {"sceneName":"sceneDiary","appId":"' + this._strAppId + '"}}]}', true
        );

        var nodeInitFocus = cc.find(this._oSceneContext.focusPath, this.node);
        var nodeFocus = new cc.Node('nodeFocus');
        this.node.addChild(nodeFocus, 10);
        this._cFocus = this.node.getChildByName('nodeFocus').addComponent(TVFocus);
        this._cFocus.init('focusContainer', this,
            nodeInitFocus.getComponent(FocusInfo),
            Common.SCREEN_WIDTH, Common.SCREEN_HEIGHT, 0, 0, 1.0);
        if (0 == nodeInitFocus.getName().indexOf('CollectionIcon')) {    //
            nodeInitFocus.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 64, 176, 64));
        }
        // if (0 == nodeInitFocus.name.indexOf('TypeListCell')) {
        //     let iIndex = parseInt(nodeInitFocus.name.replace("TypeListCell", ''));
        //     if (this._oType[iIndex]) {
        //         Network.loadImageInNativeRuntime(
        //             Common.TOPDRAW_IMAGE_SERVER + this._oType[iIndex].image[0].fileUrl,
        //             function (texture) {
        //                 let width = self._oType[iIndex].image[0].width;
        //                 let height = self._oType[iIndex].image[0].height;
        //                 nodeInitFocus.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height / 2, width, height / 2));
        //             }, null, this
        //         );
        //     }
        // }

        if (this._bBackStatus && 0 == nodeInitFocus.getName().indexOf('OtherListCell')) {    //显示收藏框框
            nodeInitFocus.getChildByName("CollectionBg").opacity = 255;
            nodeInitFocus.getComponent(ListCell).setUIWithFocus();
        }

        // if (this._bBackStatus && 0 == nodeInitFocus.getName().indexOf('CartoonListCell')) {    //显示收藏框框
        //     nodeInitFocus.getComponent(ListCell).setUIWithFocus();
        // }

        //处理焦点位于下方问题
        if (this._oSceneContext.typeListY) {
            this._nodeTypeList.y = this._oSceneContext.typeListY;
        }
    },

    onKeyDown: function (event) {
        this._super(event);
        // cc.log("当前列表:" + this._fiCurrentFocus.node.getName());
        var fiFocusTarget = null;
        var fiCurrentFocus = this._fiCurrentFocus;
        var oScrollParameter = null;
        let aCheckResult;
        //TODO:给ListView传值,使其可以让滑块跟随滚动
        let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
        // if (lvCategoryList) {
        //     lvCategoryList.setCurrentFocus(this._fiCurrentFocus);
        // }
        // this.lvCategoryList.setCurrentFocus(this._fiCurrentFocus);
        // this._oSceneContext.categoryRecordIndexOfFirstCell=lvCategoryList.getRecordIndexOfFirstCellInPageAdvance();
        if (event.keyCode == cc.macro.KEY.up || event.keyCode == Common.ANDROID_KEY.up) {
            // if (this._bIsCategoryItemMoving || this._bIsSongListMoving) {
            //     return;
            // }
            // if (0 == this._fiCurrentFocus.node.getName().indexOf('ScrollBarBlock')) { //如果滚动条
            //     let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
            //     if (lvCategoryList.scrollAPageUp()) {

            //     }
            //     return;
            // }
            if (0 == this._fiCurrentFocus.node.getName().indexOf('OtherListCell')) {
                var index = parseInt(this._fiCurrentFocus.node.getName().replace('OtherListCell', ''));
                // let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
                if (lvCategoryList.scrollARowUp(index)) {
                    return;
                }
            }
            // if (0 == this._fiCurrentFocus.node.getName().indexOf('CartoonListCell')) {
            //     var index = parseInt(this._fiCurrentFocus.node.getName().replace('CartoonListCell', ''));
            //     let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
            //     if (lvCategoryList.scrollARowUp(index)) {
            //         return;
            //     }
            // }
            fiFocusTarget = this._cFocus.findTarget(fiCurrentFocus, this._aFocusTargets, 0, Common.MOVE_DIRECTION_UP);
            if (!fiFocusTarget) { return; }
            aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter);
            fiFocusTarget = aCheckResult[0];
            oScrollParameter = aCheckResult[1];
            this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_UP, null, oScrollParameter);
        }
        if (event.keyCode == cc.macro.KEY.right || event.keyCode == Common.ANDROID_KEY.right) {
            fiFocusTarget = this._cFocus.findTarget(this._fiCurrentFocus, this._aFocusTargets, 0, Common.MOVE_DIRECTION_RIGHT);
            if (!fiFocusTarget) { return; }
            // if (0 == this._fiCurrentFocus.node.name.indexOf("OtherListCell")) {
            //     let index = this._fiCurrentFocus.node.name.replace("OtherListCell", '');
            //     // cc.find("DataContainerMask/DataContainer/EnglishListCell" + index + "/CollectionBg", this._nodeCategoryList).opacity=255;
            //     fiFocusTarget = cc.find("DataContainerMask/DataContainer/OtherListCell" + index + "/CollectionBg", this._nodeCategoryList).getComponent(FocusInfo);
            // }

            aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter);
            fiFocusTarget = aCheckResult[0];
            oScrollParameter = aCheckResult[1];
            this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_RIGHT, null, oScrollParameter);
        }
        if (event.keyCode == cc.macro.KEY.down || event.keyCode == Common.ANDROID_KEY.down) {
            // if (!this._iScrollGroupStatus) {
            if (this._bIsCategoryItemMoving || this._bIsSongListMoving) {
                return;
            }
            // if (0 == this._fiCurrentFocus.node.getName().indexOf('ScrollBarBlock')) { //如果是滚动条
            //     let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
            //     if (lvCategoryList.scrollAPageDown()) {

            //     }
            //     return;
            // }
            // if (0 == this._fiCurrentFocus.node.getName().indexOf('CartoonListCell')) {
            //     var index = parseInt(this._fiCurrentFocus.node.getName().replace('CartoonListCell', ''));
            //     let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
            //     if (lvCategoryList.scrollARowDown(null, index)) {
            //         // cc.log("line feed!");
            //         return;
            //     }
            // }
            if (0 == this._fiCurrentFocus.node.getName().indexOf('OtherListCell')) {
                var index = parseInt(this._fiCurrentFocus.node.getName().replace('OtherListCell', ''));
                // let lvCategoryList = this.node.getChildByName('CategoryList').getComponent(ListView);
                if (lvCategoryList.scrollARowDown(null, index)) {
                    // cc.log("line feed!");
                    return;
                }
            }
            fiFocusTarget = this._cFocus.findTarget(this._fiCurrentFocus, this._aFocusTargets, 0, Common.MOVE_DIRECTION_DOWN);
            if (!fiFocusTarget) { return; }
            aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter);
            fiFocusTarget = aCheckResult[0];
            oScrollParameter = aCheckResult[1];
            this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_DOWN, null, oScrollParameter);
            // }
        }
        if (event.keyCode == cc.macro.KEY.left || event.keyCode == Common.ANDROID_KEY.left) {
            fiFocusTarget = this._cFocus.findTarget(this._fiCurrentFocus, this._aFocusTargets, 0, Common.MOVE_DIRECTION_LEFT);
            if (!fiFocusTarget) { return; }
            aCheckResult = this.checkFocusTarget(fiFocusTarget, oScrollParameter);
            fiFocusTarget = aCheckResult[0];
            oScrollParameter = aCheckResult[1];
            this._cFocus.flyFocus(this._fiCurrentFocus, fiFocusTarget, Common.MOVE_DIRECTION_LEFT, null, oScrollParameter);
        }
        if (event.keyCode == cc.macro.KEY.enter || event.keyCode == Common.ANDROID_KEY.enter) {

            if (0 == this._fiCurrentFocus.node.name.indexOf("CollectionBg")) {  //收藏OR取消收藏
                let nodeId = this._fiCurrentFocus.node.parent.getComponent(ListCell).id;
                //数组转成字符串才能判断是否包含某串值(存在返回位置,不存在则返回-1)
                -1 != this._aCategoryAlreadyMediaId.toString().indexOf(nodeId) ? this.removeMedia2Collection() : this.AddMedia2Collection();
                return;
            }
            this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK);
        }
        if (event.keyCode == cc.macro.KEY.space) {
            // this.doCurrentFocusTVLinkAction(Common.TV_LINK_ACTION_CLICK);
        }
        if (event.keyCode == cc.macro.KEY.backspace || event.keyCode == Common.ANDROID_KEY.back) {
            this.backAScene();
        }

        //记录CategoryList滚动位置
        this._oSceneContext.categoryRecordIndexOfFirstCell = lvCategoryList.getRecordIndexOfFirstCellInPage();

    },
    checkFocusTarget: function (fiFocusTarget, oScrollParameter) {
        // if (0 == this._fiCurrentFocus.node.name.indexOf("TypeListCell") && 0 != fiFocusTarget.node.name.indexOf("TypeListCell")) {
        //     if (!this._bIsCategoryListDataInit) {
        //         return [null, oScrollParameter];
        //     }
        // }
        // if (fiFocusTarget && 0 == fiFocusTarget.node.name.indexOf("TypeListCell")) {
        //     if (0 != this._fiCurrentFocus.node.name.indexOf("TypeListCell")) {//如果不是TypeList之间跳转,则哪里来回哪里去
        //         fiFocusTarget = cc.find("TypeListCell" + this._oSceneContext._iCurrentTypeIndex, this._nodeTypeList).getComponent(FocusInfo);
        //     } else {
        //         let iIndex = parseInt(fiFocusTarget.node.name.replace(/TypeListCell/, ''));
        //         let iDirRate = null;
        //         if (-fiFocusTarget.node.y + fiFocusTarget.node.height / 2 - this._nodeTypeList.y >= this._nodeTypeListWrapper.height) {
        //             oScrollParameter = this._nodeTypeList.getComponent(TVScrollParameter);
        //             oScrollParameter.setHasRelation(true);
        //             oScrollParameter.setStep(-(-fiFocusTarget.node.y + fiFocusTarget.node.height / 2 + 1 - this._nodeTypeList.y) + this._nodeTypeListWrapper.height);
        //             oScrollParameter.setTargetPosition(this._nodeTypeList.y - oScrollParameter.getStep());
        //             this._oSceneContext.typeListY = this._nodeTypeList.y - oScrollParameter.getStep();
        //             iDirRate = 1;
        //         }
        //         if (-fiFocusTarget.node.y - this._nodeTypeList.y < 0) {
        //             oScrollParameter = this._nodeTypeList.getComponent(TVScrollParameter);
        //             oScrollParameter.setHasRelation(true);
        //             oScrollParameter.setStep(-fiFocusTarget.node.y - fiFocusTarget.node.height / 2 - this._nodeTypeList.y);
        //             oScrollParameter.setTargetPosition(this._nodeTypeList.y + oScrollParameter.getStep());
        //             this._oSceneContext.typeListY = this._nodeTypeList.y + oScrollParameter.getStep();
        //             iDirRate = -1;
        //         }
        //         if (iDirRate) {
        //             if (this._nodeTypeList.y + iDirRate * (this._nodeTypeHeight + 5) >= (this._aTypeAppId.length - this.TYPE_LIST_CELL_SIZE) * (this._nodeTypeHeight + 5) - 5) {//减5没有多大的意思,因为.y是有误差的
        //                 cc.find("TypeListArea/Down", this.node).opacity = 0;
        //             } else {
        //                 cc.find("TypeListArea/Down", this.node).opacity = 255;
        //             }
        //             if (this._nodeTypeList.y + iDirRate * (this._nodeTypeHeight + 1) <= 5) {
        //                 cc.find('TypeListArea/Up', this.node).opacity = 0;
        //             } else {
        //                 cc.find('TypeListArea/Up', this.node).opacity = 255;
        //             }
        //         }
        //     }
        // }

        return [fiFocusTarget, oScrollParameter];
    },

    onBeforeFocusChange: function (event) {
        this._super(event);
        let fiFrom = event.detail.from;
        let fiTo = event.detail.to;
        // if (0 == fiFrom.node.getName().indexOf('CartoonListCell')) {
        //     fiFrom.node.getComponent(ListCell).setUIWithoutFocus();
        // }

        // if (0 == fiFrom.node.getName().indexOf('TypeListCell') && 0 == fiTo.node.getName().indexOf('TypeListCell')) {
        //     // fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, fiFrom.node.width, fiFrom.node.height));
        //     var self = this;
        //     let iIndex = fiFrom.node.name.replace("TypeListCell", '');
        //     if (0 == fiTo.node.getName().indexOf('TypeListCell')) {
        //         if (this._oType[iIndex]) {
        //             let width = self._oType[iIndex].image[0].width;
        //             let height = self._oType[iIndex].image[0].height / 2;
        //             // Network.loadImageInNativeRuntime(
        //             //     Common.TOPDRAW_IMAGE_SERVER + self._oType[iIndex].image[0].fileUrl,
        //             //     function (texture) {
        //             //         fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height));
        //             //     }, null, this
        //             // );
        //             cc.loader.load(Common.TOPDRAW_IMAGE_SERVER + self._oType[iIndex].image[0].fileUrl, function (err, texture) {
        //                 fiFrom.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, width, height));
        //             });
        //         }
        //     }
        // }

        if (0 == fiFrom.node.getName().indexOf('CollectionIcon')) {
            // fiFrom.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 142, 54));
            cc.loader.loadRes('button/collection_button', cc.Texture2D, function (err, texture) {
                fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, 176, 64));
            });
        }

        // if (0 == fiFrom.node.getName().indexOf('OtherListCell')) {
        //     fiFrom.node.getChildByName("CollectionBg").opacity = 0;
        //     fiFrom.node.getComponent(ListCell).setUIWithoutFocus();
        // }

        // if (0 == fiFrom.node.getName().indexOf('CollectionBg')) { //TODO:解决收藏框框跳转某些不隐藏情况
        //     fiFrom.node.opacity = 0;
        //     // fiFrom.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 0, 53, 171));
        //     cc.loader.loadRes('texture/ui/collect_bg', cc.Texture2D, function (err, texture) {
        //         fiFrom.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 0, 53, 171));
        //     });
        // }
    },

    onAfterFocusChange: function (event) {
        this._super(event);
        let fiTo = event.detail.to;
        let fiFrom = event.detail.from;
        // if (0 == fiTo.node.getName().indexOf('CartoonListCell')) {
        //     fiTo.node.getComponent(ListCell).setUIWithFocus();
        // }

        // if (0 == fiTo.node.getName().indexOf('TypeListCell')) {
        //     let iIndex = fiTo.node.name.replace("TypeListCell", '');
        //     this._oSceneContext._iCurrentTypeIndex = iIndex;
        //     // fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, fiTo.node.height, fiTo.node.width, fiTo.node.height));
        //     var self = this;
        //     if (this._oType[this._oSceneContext._iCurrentTypeIndex]) {
        //         let width = self._oType[iIndex].image[0].width;
        //         let height = self._oType[iIndex].image[0].height / 2;
        //         // Network.loadImageInNativeRuntime(
        //         //     Common.TOPDRAW_IMAGE_SERVER + self._oType[iIndex].image[0].fileUrl,
        //         //     function (texture) {
        //         //         fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height));
        //         //     }, null, this
        //         // );
        //         cc.loader.load(Common.TOPDRAW_IMAGE_SERVER + self._oType[iIndex].image[0].fileUrl, function (err, texture) {
        //             fiTo.node.getChildByName('Bg').getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, height, width, height));
        //         });
        //     }

        //     if (0 == fiFrom.node.getName().indexOf('TypeListCell')) {   //正常状态返回回去不需要刷新
        //         this.scheduleOnce(this.getCollectionId, 0.3);
        //         this._bIsCategoryListDataInit = false;    //初始它
        //     }
        // }

        if (0 == fiTo.node.getName().indexOf('CollectionIcon')) {   //我的收藏按钮
            // fiTo.node.getComponent(cc.Sprite).spriteFrame.setRect(cc.rect(0, 54, 142, 54));
            cc.loader.loadRes('button/collection_button', cc.Texture2D, function (err, texture) {
                fiTo.node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 64, 176, 64));
            });
        }

        // if (0 == fiTo.node.getName().indexOf('OtherListCell')) {    //显示收藏框框
        //     fiTo.node.getChildByName("CollectionBg").opacity = 255;
        //     fiTo.node.getComponent(ListCell).setUIWithFocus();
        // }

        // if (0 == fiTo.node.getName().indexOf('CollectionBg')) {
        //     fiTo.node.opacity = 255;
        //     cc.loader.loadRes("texture/ui/collect_bg", cc.Texture2D, function (err, texture) {
        //         var spriteFrame = new cc.SpriteFrame(texture, cc.rect(0, 171, 53, 171));
        //         fiTo.node.getComponent(cc.Sprite).spriteFrame = spriteFrame;
        //     });
        // }
    },

    doCurrentFocusTVLinkAction: function (strAction) {
        let strTVLink = this._fiCurrentFocus.getTVLink();
        var joTVLink = null;
        try {
            joTVLink = JSON.parse(strTVLink);
            let jaOperationList = joTVLink.click;
            for (let i = 0; i < jaOperationList.length; i++) {
                switch (jaOperationList[i].action) {
                    default:
                        this.doTVLinkAction(jaOperationList[i]);
                        break;
                }
            }
        } catch (error) {
            cc.log("runTVLinkAction Exception..." + error);
        }
    },

    onListScrollStart: function () {
        this._bIsSongListMoving = true;
        cc.log("scroll start");
    },
    onListScrollEnd: function () {
        this._bIsSongListMoving = false;
        cc.log("scroll completed");
    },

    onDestroy: function () {
        cc.director.emit('stop_render');   //分发事件
    },

});