{
    template:'${tmpl}',
    data:function(){
        return {
            runTabKey: 1,
            show2: false,
            homeBackArr: [
                "background: url('/imgs/home/backgroundImg1.png') no-repeat;background-size: 100% 100%;",
            ],
            shareLeftArr: [
                {
                    icon:'/imgs/home/z1.png',
                    iconShow:'/imgs/home/z2.png',
                    name:'专利信息服务',
                    desc:'提供专利数据查询、API数据接口专利文献等信息'
                },{
                    icon:"/imgs/home/q1.png",
                    iconShow:'/imgs/home/q2.png',
                    name:'专利深度挖掘',
                    desc:'深度挖掘科技新闻、科技文献等信息'
                },{
                    icon:"/imgs/home/w11.png",
                    iconShow:'/imgs/home/w22.png',
                    name:'专利信息可视化',
                    desc:'各区域、产业、创新主体专利数据清晰查阅'
                }
            ],
            shareRightArr: [
                {
                    icon:"/imgs/home/b1.png",
                    iconShow:'/imgs/home/b2.png',
                    name:'全新在线分析报告',
                    desc:'提供多种分析报告、在线生成导出'
                },{
                    icon:"/imgs/home/v1.png",
                    iconShow:'/imgs/home/v2.png',
                    name:'专利交易信息',
                    desc:'专利转让、求购等信息一目了然'
                },{
                    icon:"/imgs/home/p1.png",
                    iconShow:'/imgs/home/p2.png',
                    name:'最新专利新闻推送',
                    desc:'根据用户浏览行为、推送最新专利新闻'
                }
            ],
            wisdomArr: [
                {
                    icon:'/imgs/home/w1.png',
                    name:'区域专利数据',
                    text:'有助于各级知识产权管理部门了解和掌握本地区专利情况'
                },{
                    icon:'/imgs/home/w2.png',
                    name:'产业专利数据',
                    text:'有助于提升区域专利的数量和质量、增强产业创新竞争力'
                },{
                    icon:'/imgs/home/w3.png',
                    name:'创新主体',
                    text:'有效利用各企业的技术优势和竞争优势，提高整个区域产业的发展创新能力'
                },{
                    icon:'/imgs/home/w4.png',
                    name:'专家信息',
                    text:'提供各发明人专利数据监测服务方便了解各发明人在行业内的贡献度'
                }
            ],
            runArr: [
                {},{},{},{},{},{},{}
            ],
            contentArr: [
                {
                    img:'background: url(/imgs/home/nav1.png) no-repeat;',
                    name:'热门专利'
                },{
                    img:'background: url(/imgs/home/nav2.jpg) no-repeat;',
                    name:'热门科技资讯'
                },{
                    img:'background: url(/imgs/home/nav3.jpg) no-repeat;',
                    name:'热门文献'
                },
            ],
            bannerTabsArr: [
                {
                    img:"/imgs/home/icon1.png",
                    name:'智能检索'
                },
                {
                    img:"/imgs/home/icon2.png",
                    name:'智能分析'
                },
                {
                    img:"/imgs/home/icon6.png",
                    name:'智能估价'
                },
                {
                    img:"/imgs/home/icon3.png",
                    name:'IP创新管理'
                },
                {
                    img:"/imgs/home/icon5.png",
                    name:'产业创新监测'
                },
                {
                    img:"/imgs/home/icon4.png",
                    name:'IP智慧城市'
                },
                {
                    img:"/imgs/home/icon7.png",
                    name:'创新人才发现'
                },
                {
                    img:"/imgs/home/icon8.png",
                    name:'知识产权运营'
                },
                {
                    img:"/imgs/home/icon9.png",
                    name:'创新资源共享'
                }
            ],
            tms:[],
            loopplays:[
            ],
            channels:[],
            keyIcon: null,
            keyIcon1: null,
            BannerHeight:''
        }
    },
    mounted:function(){
     this.fetchloopplay();
     this.fetchchannels();
     function autoScroll(obj){  
        $(obj).find("ul").animate({  
            marginTop : "-39px"  
        },500,function(){  
            $(this).css({marginTop : "0px"}).find("li:first").appendTo(this);  
        })  
    }  
    $(function(){  
        setInterval( () => {
            autoScroll(".run-item-article")
        },3000);
    });
    
    this.xingkong();
    var that = this;
    
    $(window).resize(function(){
        that.xingkong()
    })
    /*$('.home-banner').starfield({
        starDensity: 2.0,
        mouseScale: 0.5,
        seedMovement: true
    });*/
    },
    created:function(){
        console.log(this.$root.pushx,"----------------------------------------------");
        var that = this;
        this.BannerHeight = window.innerHeight;
       
        $(window).resize(function(){
            that.BannerHeight = window.innerHeight; 
        });
        this.$root.typeHome = true;
    },
    methods:{
        show2enter() {
            this.show2 = true;
        },
        show2leave() {
            this.show2 = false;
        },
        xingkong() {     
            var canvas = document.getElementById('canvas'),
            ctx = canvas.getContext('2d');
            ctx.clearRect(0,0,canvas.width,canvas.height),
            ctx.beginPath(),
            w = canvas.width = window.innerWidth,
            h = canvas.height = window.innerHeight,
            

            hue = 217,
            stars = [],
            count = 0,
            maxStars = 1300;

            var canvas2 = document.createElement('canvas'),
            ctx2 = canvas2.getContext('2d');
            ctx2.clearRect(0,0,canvas2.width,canvas2.height),
            ctx2.beginPath(),
            canvas2.width = 100;
            canvas2.height = 100;
            var half = canvas2.width / 2,
            gradient2 = ctx2.createRadialGradient(half, half, 0, half, half, half);
            gradient2.addColorStop(0.025, '#CCC');
            gradient2.addColorStop(0.1, 'hsl(' + hue + ', 61%, 33%)');
            gradient2.addColorStop(0.25, 'hsl(' + hue + ', 64%, 6%)');
            gradient2.addColorStop(1, 'transparent');

            ctx2.fillStyle = gradient2;
            ctx2.beginPath();
            ctx2.arc(half, half, half, 0, Math.PI * 2);
            ctx2.fill();


            function random(min, max) {
            if (arguments.length < 2) {
                max = min;
                min = 0;
            };

            if (min > max) {
                var hold = max;
                max = min;
                min = hold;
            };

            return Math.floor(Math.random() * (max - min + 1)) + min;
            };

            function maxOrbit(x, y) {
            var max = Math.max(x, y),
                diameter = Math.round(Math.sqrt(max * max + max * max));
            return diameter / 2;
            };

            var Star = function() {

            this.orbitRadius = random(maxOrbit(w, h));

            this.radius = random(60, this.orbitRadius) / 8; 

            this.orbitX = w / 2;
            this.orbitY = h / 2;
            this.timePassed = random(0, maxStars);
            this.speed = random(this.orbitRadius) / 50000; 
            this.alpha = random(2, 10) / 10;

            count++;
            stars[count] = this;
            };

            Star.prototype.draw = function() {
            var x = Math.sin(this.timePassed) * this.orbitRadius + this.orbitX,
                y = Math.cos(this.timePassed) * this.orbitRadius + this.orbitY,
                twinkle = random(10);

            if (twinkle === 1 && this.alpha > 0) {
                this.alpha -= 0.05;
            } else if (twinkle === 2 && this.alpha < 1) {
                this.alpha += 0.05;
            };

            ctx.globalAlpha = this.alpha;
            ctx.drawImage(canvas2, x - this.radius / 2, y - this.radius / 2, this.radius, this.radius);
            this.timePassed += this.speed;
            };

            for (var i = 0; i < maxStars; i++) {
            new Star();
            };

            function animation() {
            ctx.globalCompositeOperation = 'source-over';
            ctx.globalAlpha = 0.5;
            ctx.fillStyle = 'hsla(' + hue + ', 64%, 6%, 2)';
            ctx.fillRect(0, 0, w, h);

            ctx.globalCompositeOperation = 'lighter';
            for (var i = 1, l = stars.length; i < l; i++) {
                stars[i].draw();
            };

            window.requestAnimationFrame(animation);
            };
            animation();
        },
        enter (key) {
            this.keyIcon = key;
        },
        leave () {
            this.keyIcon = null;
        },
        entertwo (key) {
            this.keyIcon1 = key;
        },
        leavetwo () {
            this.keyIcon1 = null;
        },
        navRoute (name) {
            console.log(name);
            this.$root.NavIndexRoute(name);
        },
       fetchloopplay:function(){
           var self=this;
            self.$root.postReq("/web/loopplayCtl/findAll",{}).then(function(d){
                if(d.status==0){
                    self.loopplays=d.data;
                }
            });
       },
       fetchchannels(){
        var self=this;
        self.$root.postReq("/web/newschannelCtl/findPrev5",{}).then(function(d){
            if(d.status==0){
                self.channels=d.data;
            }
        });
       },
     moreclick:function(id){
        console.log("more............",id);
          /*修改路由条目*/
          Object.keys(this.$router.mapRouterEntry).map((k)=>{
            if(k.indexOf(":id")>0){
                var tmparray=k.split(":");
                var routerviewname=tmparray[0]+id;
                console.log("==============================");
                console.log(k,routerviewname);
                var entryValue=this.$router.mapRouterEntry[k];
                var curcom=entryValue.components[k];
                entryValue.components[routerviewname]=curcom;
                console.log("==============================");
            }
        });
        this.$root.pushx({
            title:"更多文章",
            name:"/channelquery/"+id
        });
      },
      rowclick:function(r){
        console.log("----------------------------------articledetail--------------------------------------");
        console.log(r);
        /*修改路由条目*/
        Object.keys(this.$router.mapRouterEntry).map((k)=>{
            if(k.indexOf(":id")>0){
                var tmparray=k.split(":");
                var routerviewname=tmparray[0]+r.id;
                console.log("==============================");
                console.log(k,routerviewname);
                var entryValue=this.$router.mapRouterEntry[k];
                var curcom=entryValue.components[k];
                entryValue.components[routerviewname]=curcom;
                console.log("==============================");
            }
        });
        this.$root.pushx({
            title:r.title,
            name:"/articledetail/"+r.id
        });
      },
    },
    vname:"gsb-home"
}
