1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var httpUtils = require("HttpUtils");
- cc.Class({
- extends: require("Base"),
- properties: {
- label_title: {
- default: null,
- type: cc.Label
- },
- sprite_back: {
- default: null,
- type: cc.Sprite
- },
- sprite_catalog: {
- default: null,
- type: cc.Sprite
- },
- courseware_prefab: {
- default: null,
- type: cc.Prefab
- },
- view_scroll: {
- default: null,
- type: cc.ScrollView
- },
- view_layout: {
- default: null,
- type: cc.Layout
- }
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad() {
- setViewTouch(
- this.sprite_back,
- null,
- function() {
- this.node.destroy();
- },
- null,
- this
- );
- this.initView(null);
- },
- start() {
- this.view_scroll.scrollToTop(0);
- },
- lateUpdate: function(dt) {
- setScaleX(this.root_view);
- },
- update(dt) {},
- initView: function(data) {
- var a = 33;
- if (a <= 4) {
- this.view_layout.node.setPosition(0, 171);
- } else {
- this.view_layout.node.setPosition(0, 0);
- }
- for (let i = 0; i < a; i++) {
- var courseware = cc.instantiate(this.courseware_prefab);
- courseware.getComponent("课件icon").kejian = this;
- var temp = this;
- courseware.getComponent("课件icon").setClickFunction(function() {
- // alert("position:" + i);
- temp.showShare();
- });
- this.view_layout.node.addChild(courseware);
- }
- },
- setTitle: function(title) {
- this.label_title.string = title;
- },
- showShare: function() {
- console.log(this)
- // cc.instantiate(this.detail_prefab).getComponent("popup").curriculum_window = this;
- this.curriculum_window.showShare();
- }
- });
|