// JavaScript Document

var data={//全局变量
	_vw:$(window).width(),
	_vh:$(window).height(),
    shu:window.matchMedia("(orientation: portrait)").matches,
    homeBanner:null,
    _nav:$('.pc-nav'),
    _other:$('#main > .other')
};
var page={
    _home:$('#home'),
    _jue:$('#jue'),
    _pro:$('#pro'),
    _about:$('#about'),
    _join:$('#join'),
    _contact:$('#contact'),
};

var init=function(){
    var _pop = $('.pop'),
        _m = _pop.find('.img'),
        _c = _pop.find('.close');
    $('.goPop').on('click',function () {
        _m.attr('src',$(this).attr('data-src'));
        _pop.addClass('on');
    });
    _c.on('click',function () {
        _pop.removeClass('on');
        setTimeout(function () {
            _m.attr('src','');
        },500);
    });
};

$(document).ready(function(){
    new alan.scrollAnimate();

	init();

	if(page._home.length>0){
        homeFn.load();
	    homeFn.init();
	    homeFn.move();
	    homeFn.r5Move();

	    let swVp = 'auto',swB = 35,swG = 3;
        if ($(window).width() <= 640) {

            swVp = 1 ;swB = 0;swG = 1;
        } else if ($(window).width() <= 1024){
            swVp = 3 ;swB = 0;

        }
        var mySwiper = new Swiper('#sw1', {
            autoplay: false,//可选选项，自动滑动
            slidesPerView: swVp,
            slidesPerGroup : swG,
            spaceBetween : swB,
            navigation: {
                nextEl: '.f-next',
                prevEl: '.f-prev',
            },
        });
	    // homeFn.swiper();
	    homeFn.clock();

        // var stor = JSON.parse(sessionStorage.getItem('key')),
        //     info ={call:null};//对网站浏览次数存储
        // if(stor==null){
        //     info.call=1;
        //     homeFn.load();
        //     sessionStorage.setItem('key',JSON.stringify(info));
        // }else{
        //     info.call=stor.call+1;
        //     $('.loading').hide();
        //     setTimeout(function () {
        //         $('#r1Alan').addClass('on');
        //         $('#r1').addClass('del');
        //         $('#firstMsg').removeClass('first');
        //         data.homeBanner.go();
        //         homeFn.roll_();
        //     },10);
        //     sessionStorage.setItem('key',JSON.stringify(info));
        // }
    }
    if(page._jue.length>0){
        setTimeout(function () {
            $('#r1Alan').addClass('on');
        },10);
        homeFn.move();
    }
    if(page._pro.length>0){
        proFn.init();
    }
    if(page._about.length>0){
        aboutFn.init();
        aboutFn.sw();
        aboutFn.fn3();
    }
    if(page._join.length>0){
        aboutFn.init();
        joinFn.hoverInit();
    }
    if(page._contact.length>0){
        aboutFn.init();
        contactFn.map();
    }
});

$(window).bind("scroll",function(){
    var _wTop = _winScroll = windowPos = $(window).scrollTop(),
        docHeight = $(document).height(),
        windowHeight = $(window).height(),
        completion = windowPos / (docHeight - windowHeight) * window.winheight;
    //$('.progress').height(completion);
    if (!$('body').hasClass('text_body')){


    if(_wTop<(data._vh*0.7-50)){
        $(".pc-nav").removeClass('down');
    }else{
        $(".pc-nav").addClass('down');
    }
    }
    _delayTop = _wTop;
});

var initFn = {

};

var homeFn = {
    init:function(){
        var _r4 = $('#r4'),
            _r4Cur = null,
            _r4Bg = _r4.find('.bg'),
            _r4Return = _r4.find('.return'),
            _r4Btn = _r4.find('#btnR4'),
            _r4Btm = _r4.find('#btmR4'),
            _r4Fn = _r4.find('#fnR4'),
            sbt=35,
            spv=5;
        if ($(window).width() <= 640){
            sbt = 10;
            spv = 3;
        }
        _r4Btm.find('.box').each(function () {
            var _n = $(this).index();
            var str = '.b'+(_n+1);
            new Swiper(str+' .swiper', {
                autoplay: false,//可选选项，自动滑动
                slidesPerView:spv,
                slidesPerGroup : 1,
                spaceBetween : sbt,
                navigation: {
                    nextEl: str+' .next_',
                    prevEl: str+' .prev_',
                },
            });
        });
        _r4Return.on('click',function () {
            _r4Bg.removeClass('on').removeClass(_r4Cur);
        });
        _r4Btn.find('li').on('click',function () {
            var _n = $(this).index();
            _on($(this));
            _on(_r4Btm.find('.box').eq(_n));
            _r4Bg.removeClass(_r4Cur);
            _r4Cur = 'mask_'+_n;
            _r4Bg.addClass(_r4Cur);
            _r4Fn.find('li').eq(_n).addClass('on').siblings('li').removeClass('on');
        });

        _r4Fn.find('li').on('click',function () {
            var _n = $(this).index();
            $(this).addClass('on').siblings('li').removeClass('on');
            _on(_r4Btn.find('li').eq(_n));
            _on(_r4Btm.find('.box').eq(_n));
            _r4Cur = 'mask_'+_n;
            _r4Bg.addClass('on').addClass(_r4Cur);
        })
    },
    load:function(){
        var _box = $('.loading'),
            _mask = _box.find('.mask'),
            _dot = _box.find('.dot');
        _dot.find('li').each(function () {
            var _n = $(this).index(),
                ptr = '#cls'+(_n+1),
                str = '#d'+(_n+1);
            var path = anime.path(ptr+' path');
            anime({
                targets: str,
                translateX: path('x'),
                translateY: path('y'),
                rotate: path('angle'),
                easing: 'linear',
                duration: 1500,
                begin:function(){
                    $(str).css('opacity',1);
                    $(ptr).css('opacity',1);
                },
                complete:function () {
                    $(str).fadeOut();
                    _mask.addClass('on');
                    setTimeout(function () {
                        $('#r1Alan').addClass('on');
                        $('#r1').addClass('del');
                        $('#firstMsg').removeClass('first');
                        _box.hide();
                        data.homeBanner.go();
                        homeFn.roll_();
                    },2500);
                }
            });
            anime({
                targets: ptr+' path',
                strokeDashoffset: [anime.setDashoffset, 0],
                easing: 'linear',
                duration: 1500,
                complete:function () {
                    $(ptr+' path').addClass('on');
                    setTimeout(function () {
                        _box.find('.txt').fadeOut();
                    },1000);
                }
            });
        });
    },
    roll_:function () {
        var _box = $('#roll'),
            _btn = $('.pager_btn'),
            _dot = $('#page-dot'),
            _row = _box.find('.row');
        function Fn(option) {
            this.parent = option.el;
            this.row = option.page;
            this.call = option.callback;
            this.dot = option.dot;
            this.btn = option.pBtn;
            this.len = this.row.length+1;
            this.cur = 0;
            this.wheel  = 0;
            this.ani = false;
            this.wid = data._vw;
            this.hei = data._vh;
            this.isStop = false;
            this.stopFn = option.stopFn;
        }
        Fn.prototype={
            init:function () {
                var self = this;
                if(window.orientation!=0){
                    self.mouser();
                }else{
                    var home_next = function () {
                        if( self.ani){}else{
                            if( !(self.cur === (self.len-1)) ){
                                self.ani = true;
                                self.next_();
                            }
                        }
                    };
                    var home_prev = function () {
                        if( self.ani){}else{
                            if( !(self.cur === 0) ){
                                self.ani = true;
                                self.prev_();
                            }
                        }
                    };
                    base.touchMove(self.parent,null,null,home_prev,home_next);
                }
                self.dot.on('click',function () {
                    var _n = $(this).index();
                    self.num_(_n);
                });
                self.btn.on('click',function () {
                    var _this = $(this),
                        _type = parseInt(_this.attr('data-type'));
                    if(_type==1){
                        self.next_();
                    }else if(_type<0){
                        self.prev_();
                    }
                })
            },
            mouser:function(){
                var self = this;
                var oldDate = new Date();
                var scrollPos = 0;
                if(base.IEnum==null){
                    $('#bloc').on("mousewheel",{ debounce: { leading: true, trailing: false, maxDelay: 100 } },function (event) {
                        mouseHandle(event);
                    });
                }else{
                    $('#bloc')[0].addEventListener("mousewheel",function(event){
                        if( self.ani){}else{
                            if(event.wheelDelta < 0){
                                if( !(self.cur === (self.len-1)) ){
                                    self.ani = true;
                                    self.next_();
                                }
                            }
                            else if(event.deltaY > 0){
                                if( !(self.cur === 0) ){
                                    self.ani = true;
                                    self.prev_();
                                }
                            }
                        }
                    });
                }
                // self.parent.on("mousewheel",{ debounce: { leading: true, trailing: false, maxDelay: 100 } },function (event) {
                //     mouseHandle(event);
                // });
                function mouseHandle(event) {
                    var newDate = new Date();
                    var scrollAllowed = true;
                    if( self.wheel < 10 && (newDate.getTime()-oldDate.getTime()) < 100 ) {
                        scrollPos -= event.deltaY*(10-self.wheel);
                        self.wheel++;
                    }
                    else {
                        if( (newDate.getTime()-oldDate.getTime()) > 100 ) {
                            self.wheel = 0;
                            scrollPos -= event.deltaY*60;
                        }
                        else {
                            scrollAllowed = false;
                        }
                    }
                    oldDate = new Date();
                    if( scrollAllowed ) {
                        if( self.ani){
                            if(self.isStop){
                                self.stopFn();
                            }
                        }else{
                            if(event.deltaY === 1){
                                if( !(self.cur === (self.len-1)) ){
                                    self.ani = true;
                                    self.next_();
                                }
                            }
                            else if(event.deltaY === -1){
                                if( !(self.cur === 0) ){
                                    self.ani = true;
                                    self.prev_();
                                }
                            }
                        }
                    }
                }
            },
            prev_:function () {
                var self = this;
                if(self.cur===(self.len-1)){
                    self.cur = self.cur > 0 ? self.cur - 1 : 0;
                    $('#bloc').removeClass('on');
                    self.call(-1,self.cur);
                    setTimeout(function () {
                        self.ani = false;
                    },800);
                }
                else if(self.cur>0){
                    var _that = self.row.eq(self.cur);
                    self.cur = self.cur > 0 ? self.cur - 1 : 0;
                    var _this = self.row.eq(self.cur);
                    _on(self.dot.eq(self.cur));
                    _this.addClass('del');
                    _that.removeClass('del').addClass('out');
                    self.call(-1,self.cur);
                    base.onEndAnimation(_that[0],function () {
                        _this.addClass('on').removeClass('out');
                        _that.removeClass('on').removeClass('out');
                        // self.call(-1,self.cur);
                        self.ani = false;
                    })
                }
            },
            next_:function () {
                var self = this;
                if(self.cur===(self.len-2)){
                    self.cur = self.cur < self.len-1 ? self.cur + 1 : (self.len-1);
                    $('#bloc').addClass('on');
                    self.call(1,self.cur);
                    setTimeout(function () {
                        self.ani = false;
                    },800);
                }
                else if(self.cur<(self.len-2)){
                    var _that = self.row.eq(self.cur);
                    self.cur = self.cur < self.len-1 ? self.cur + 1 : (self.len-1);
                    var _this = self.row.eq(self.cur);
                    _on(self.dot.eq(self.cur));
                    _that.addClass('over').removeClass('del');
                    _this.addClass('in del');
                    self.call(1,self.cur);
                    base.onEndAnimation(_this[0],function () {
                        _that.removeClass('on in over');
                        _this.addClass('on').removeClass('in');
                        // self.call(1,self.cur);
                        self.ani = false;
                    })
                }
            },
            stop:function(){
                this.isStop = true;
                this.ani = true;
            },
            start:function(){
                var self = this;
                this.isStop = false;
                setTimeout(function () {
                    self.ani = false;
                },1000);
            },
            num_:function (n) {
                var self = this;
                var _that = self.row.eq(self.cur);
                self.cur = n;
                var _this = self.row.eq(self.cur);
                _on(self.dot.eq(self.cur));
                _that.addClass('over').removeClass('del');
                _this.addClass('in del');
                self.call(1,self.cur);
                base.onEndAnimation(_this[0],function () {
                    _that.removeClass('on in over');
                    _this.addClass('on').removeClass('in');
                    self.ani = false;
                })
            }
        };
        data.f1 = new Fn({
            el:_box,
            page:_row,
            dot:_dot.find('li'),
            pBtn:_btn,
            stopFn:function(){},
            callback:function (detal,index) {
                console.log(index);
                if(index===0){
                    $('#r1Alan').addClass('on');
                    data._nav.removeClass('bc alonav');
                    data._other.removeClass('bc');
                    _dot.removeClass('on');
                }
                if(index===1){
                    $('#r1Alan').removeClass('on');
                    data._nav.addClass('bc alonav');
                    data._other.addClass('bc');
                    data._other.fadeIn();
                    _dot.addClass('on').removeClass('wc');
                    setTimeout(function () {
                        $('.run_num_box').children('[data-to]').addClass('timer');
                        $(document).runInit();
                    },1000);
                }
                if(index===2){
                    data._nav.removeClass('bc alonav');
                    data._other.removeClass('bc');
                    _dot.addClass('wc');
                    data._other.fadeIn();
                }
                if(index===3){
                    data._nav.addClass('bc');
                    data._other.addClass('bc');
                    _dot.removeClass('wc');
                    data._other.fadeIn();
                }
                // if(index===4){
                //     data._nav.removeClass('bc');
                //     data._other.removeClass('bc');
                //     _dot.addClass('wc');
                //     data._other.fadeIn();
                // }
                if(index===5){
                    data._nav.addClass('bc');
                    data._other.addClass('bc');
                    _dot.addClass('on').removeClass('wc');
                    data._other.fadeOut();
                }
                if(index===6){
                    _dot.removeClass('on');
                }
            }
        });
        data.f1.init();
    },
    move:function () {
        var fn_ = $('#fn1');
        var Loop = function (opts) {
            this.$parent = opts.el;
            this.nextEl = this.$parent.find(opts.next);
            this.prevEl = this.$parent.find(opts.prev);
            this.dotEl  = this.$parent.find(opts.dot);
            this.msg    = this.$parent.find(opts.msg);
            this.photo  = this.$parent.find(opts.pic);
            this.ad  = this.$parent.find(opts.ad);
            this.cur = 0;
            this.len = this.dotEl.length;
            this.isAni = false;
            this.picTn = null;//图片动画
            this.curPic = null;
            this.nextPic = null;
            this.msgTn = null;//描述动画
            this.curMsg = null;
            this.nextMsg = null;
            this.adTn = null;//额外动画
            this.curAd = null;
            this.nextAd = null;
            this.timer = null;
        };
        Loop.prototype={
            init:function () {
                var self = this;
                this.nextEl.on('click',function () {
                    if(self.isAni) return false;
                    clearTimeout(self.timer);
                    var next = self.nextCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                });
                this.prevEl.on('click',function () {
                    if(self.isAni) return false;
                    clearTimeout(self.timer);
                    var next = self.prevCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                });
                this.dotEl.on('click',function () {
                    console.log(self.isAni);
                    if(self.isAni) return false;
                    self.isAni = true;
                    clearTimeout(self.timer);
                    var next = $(this).index();
                    clearTimeout(self.timer);
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on($(this));
                });
                var leftFn = function(){
                    if(self.isAni) return false;
                    var next = self.nextCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                };
                var rightFn = function(){
                    if(self.isAni) return false;
                    var next = self.prevCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                };
                // touchMove($('#r2').find('.mid'),leftFn,rightFn);
            },
            nextCur:function (cur) {
                return cur<(this.len-1)?(cur+1):0;
            },
            prevCur:function (cur) {
                return cur>0?(cur-1):(this.len-1);
            },
            picMove:function (cur,next) {
                var self = this;
                this.curPic = this.photo.eq(cur);
                this.nextPic = this.photo.eq(next);
                new TimelineMax({
                    onStart:()=>{

                    },
                    onComplete:()=>{
                        self.nextPic.addClass('on');
                    }
                })
                    .addLabel('start')
                    .add(new TimelineMax().staggerFromTo(this.curPic,0.7,{autoAlpha:1,scale:1},{autoAlpha:0,scale:1.1,ease:Sine.easeInOut}))
                    .add(new TimelineMax().staggerFromTo(this.nextPic,0.7,{autoAlpha:0,scale:1.1},{autoAlpha:1,scale:1,ease:Sine.easeInOut}),"start+=0.1")
                    .addLabel('end')
            },
            msgMove:function (cur,next) {
                var self = this;
                this.curMsg = this.msg.eq(cur);
                this.nextMsg = this.msg.eq(next);
                new TimelineMax({
                    onStart:()=>{
                        self.nextMsg.addClass('next');
                    },
                    onComplete:()=>{
                        self.curMsg.removeClass('on');
                        self.nextMsg.addClass('on');
                        self.go();
                        self.isAni = false;
                    }
                })
                    .addLabel('start')
                    .add(new TimelineMax().staggerFromTo(this.curMsg.find('.move'),0.6,{autoAlpha:1,y:0},{autoAlpha:0,y:-30,ease:Sine.easeInOut},0.1))
                    .add(new TimelineMax().staggerFromTo(this.nextMsg.find('.move'),0.6,{autoAlpha:0,y:30},{autoAlpha:1,y:0,ease:Sine.easeInOut},0.1))
                    .addLabel('end')
            },
            adMove:function (cur,next) {
                var self = this;
                this.curAd = this.ad.eq(cur);
                this.nextAd = this.ad.eq(next);
                new TimelineMax({
                    onStart:()=>{
                        self.nextAd.addClass('next');
                    },
                    onComplete:()=>{
                        self.curAd.removeClass('on');
                        self.nextAd.addClass('on');
                    }
                })
                    .addLabel('start')
                    .add(new TimelineMax().staggerFromTo(this.curAd,0.7,{autoAlpha:1,x:0},{autoAlpha:0,x:-10,ease:Sine.easeInOut}))
                    .add(new TimelineMax().staggerFromTo(this.nextAd,0.7,{autoAlpha:0,x:10},{autoAlpha:1,x:0,ease:Sine.easeInOut}))
                    .addLabel('end')
            },
            go:function () {
                var self = this;
                this.timer = setTimeout(function () {
                    if(self.isAni) return false;
                    var next = self.nextCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                },5000);
            },
            stop:function () {
                var self = this;
                clearTimeout(self.timer);
            }

        };
        data.homeBanner = new Loop({
            el:fn_,
            next:'.next',
            prev:'.prev',
            dot:'.timer-list',
            msg:'.msgList',
            pic:'.pic',
            ad:'.adList'
        });
        data.homeBanner.init();
    },
    clock:function () {
        var parent = $('#fn2'),
            clock = $('#clock'),
            msgBox = parent.find('.msg-box'),
            msg = msgBox.find('.time-note').find('li'),
            cur_msg = msgBox.find('.time-note').find('li').eq(0),
            msg2  = $('#fn2Bg').find('.pic'),
            msg3  = $('#fnDot').find('li'),
            next  = $('.scene-nav--next'),
            _cur  = $('.scene-nav--cur'),
            cir   = clock.find('.time-cir'),
            box   = clock.find('.time-move');
        // var _w    = (box.width()-10)*window.devicePixelRatio+5,
        //     _h    = (box.height()-10)*window.devicePixelRatio+5;
        var  _w    = (box.width()-10) +5,
            _h    = (box.height()-10)+5,
            r     = _w/2 - 3;

        console.log(box);
        console.log(_h);
        var cv = document.createElement('canvas'),
            ctx = cv.getContext('2d');
        ctx.imageSmoothingEnabled = true;
        cv.width=_w;
        cv.height=_h;
        box.append(cv);
        var rad = Math.PI*2/540,
            ani = false,
            isclick = true,
            index = 1,
            m1 = 0,
            m2 = 0,
            v1 = 0.4,
            v2 = 2;
        var once = true;
        var once2 = true;

        cir.find('li').on('click',function () {
            if(ani) return false;
            var cur = index%6,
                len = $(this).index();

            _cur.attr('data-nav',len);
            isclick = false;
            var a = (cur-len)>0 ? (6-(cur-len)) : (len-cur);
            if(a!=0){
                index = index+a;
            }
            v1=(v1*(20+5*a));
            v2=(v2*(a+1));
        });
        $('#fnDot').find('li').on('click',function () {
            if(ani) return false;
            var cur = index%6,
                len = $(this).index();

            _cur.attr('data-nav',len);
            isclick = false;
            var a = (cur-len)>0 ? (6-(cur-len)) : (len-cur);
            if(a!=0){
                index = index+a;
            }
            v1=(v1*(20+5*a));
            v2=(v2*(a+1));
        });

        //绘制运动圆环
        function foregroundCircle(n,m){
            ctx.save();
            ctx.translate(_w/2,_h/2);
            ctx.strokeStyle = 'rgba(0,144,250,1)';
            ctx.lineWidth = 6;
            ctx.lineCap = "round";
            ctx.beginPath();
            ctx.arc(0, 0, r , -Math.PI/6 +m*rad, -Math.PI/6 +n*rad, false); //用于绘制圆弧context.arc(x坐标，y坐标，半径，起始角度，终止角度，顺时针/逆时针)
            ctx.stroke();
            ctx.closePath();
            ctx.restore();
        }
        //8段动画
        function move() {
            m1+=v1;
            if(once&&m1>=(50+90*(index-1))){
                once = false;
            }
            if(m1>=(90*index)){
                m1 = 90*index;
                cir.find('li').eq(index%6).addClass('on').siblings().removeClass('on');
                var next_1 = msg.eq(index%6);
                var next_2 = msg2.eq(index%6);
                var next_3 = msg3.eq(index%6);
                // msg_move(cur_msg,next_1);
                _on(next_1);
                _on(next_2);
                _on(next_3);
                if(isclick){
                    if(once2){
                        next.click();
                        once2 = false;
                    }
                }else{
                    _cur.click();
                }
                ani = true;
                m2 +=v2;
                if(m2>=m1){
                    m2 = 90*index;
                    once=true;ani = false;isclick = true;once2=true;
                    v1 = 0.4;
                    v2 = 2;
                    index++;
                }
            }
            foregroundCircle(m1,m2);
        }
        function msg_move(cur,next) {
            // cur.addClass('out');
            // next.addClass('in on');
            // setTimeout(function () {
            //     next.removeClass('in');
            //     cur.removeClass('out on');
            //     cur_msg = next;
            // },1200);
            new TimelineMax({
                onStart:()=>{
                    next.addClass('on');
                },
                onComplete:()=>{
                    cur_msg = next;
                }
            })
                .addLabel('start')
                .add(new TimelineMax().staggerFromTo(cur.find('.move'),0.4,{autoAlpha:1,y:0},{autoAlpha:0,y:-12,ease:Sine.easeInOut},0.1))
                .add(new TimelineMax().staggerFromTo(next.find('.move'),0.4,{autoAlpha:0,y:12},{autoAlpha:1,y:0,ease:Sine.easeInOut},0.1))
                .addLabel('end')
        }
        function drawFrame(){
            window.requestAnimationFrame(drawFrame,cv);
            ctx.clearRect(0,0,cv.width,cv.height);
            move();
        }
        drawFrame();
    },
    r5Move:function () {
        var fn_ = $('#r5');
        var Loop = function (opts) {
            this.$parent = opts.el;
            this.nextEl = this.$parent.find(opts.next);
            this.prevEl = this.$parent.find(opts.prev);
            this.dotEl  = this.$parent.find(opts.dot);
            this.msg    = this.$parent.find(opts.msg);
            this.photo  = this.$parent.find(opts.pic);
            this.ad  = this.$parent.find(opts.ad);
            this.sum  = this.$parent.find(opts.sum);
            this.cur = 0;
            this.len = this.dotEl.length;
            this.isAni = false;
            this.picTn = null;//图片动画
            this.curPic = null;
            this.nextPic = null;
            this.msgTn = null;//描述动画
            this.curMsg = null;
            this.nextMsg = null;
            this.adTn = null;//额外动画
            this.curAd = null;
            this.nextAd = null;
        };
        Loop.prototype={
            init:function () {
                var self = this;
                this.nextEl.on('click',function () {
                    if(self.isAni) return false;
                    var next = self.nextCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                });
                this.prevEl.on('click',function () {
                    if(self.isAni) return false;
                    var next = self.prevCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                });
                this.dotEl.on('click',function () {
                    var next = $(this).index();
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on($(this));
                });
                var leftFn = function(){
                    if(self.isAni) return false;
                    var next = self.nextCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                };
                var rightFn = function(){
                    if(self.isAni) return false;
                    var next = self.prevCur(self.cur);
                    self.isAni = true;
                    self.picMove(self.cur,next);
                    self.msgMove(self.cur,next);
                    self.adMove(self.cur,next);
                    self.cur = next;
                    _on(self.dotEl.eq(self.cur));
                };
                // touchMove($('#r2').find('.mid'),leftFn,rightFn);
            },
            nextCur:function (cur) {
                return cur<(this.len-1)?(cur+1):0;
            },
            prevCur:function (cur) {
                return cur>0?(cur-1):(this.len-1);
            },
            picMove:function (cur,next) {
                var self = this;
                this.curPic = this.photo.eq(cur);
                this.nextPic = this.photo.eq(next);
                new TimelineMax({
                    onStart:()=>{
                        self.sum.text('0'+(next+1));
                    },
                    onComplete:()=>{
                        self.nextPic.addClass('on');
                    }
                })
                    .addLabel('start')
                    .add(new TimelineMax().staggerFromTo(this.curPic,0.7,{autoAlpha:1,scale:1},{autoAlpha:0,scale:1.1,ease:Sine.easeInOut}))
                    .add(new TimelineMax().staggerFromTo(this.nextPic,0.7,{autoAlpha:0,scale:1.1},{autoAlpha:1,scale:1,ease:Sine.easeInOut}),"start+=0.1")
                    .addLabel('end')
            },
            msgMove:function (cur,next) {
                var self = this;
                this.curMsg = this.msg.eq(cur);
                this.nextMsg = this.msg.eq(next);
                new TimelineMax({
                    onStart:()=>{
                        self.nextMsg.addClass('next');
                        _on($('#r5').find('.bg').find('.pic').eq(next))
                    },
                    onComplete:()=>{
                        self.curMsg.removeClass('on');
                        self.nextMsg.addClass('on');
                        self.isAni = false;
                    }
                })
                    .addLabel('start')
                    .add(new TimelineMax().staggerFromTo(this.curMsg.find('.move'),0.6,{autoAlpha:1,y:0},{autoAlpha:0,y:-20,ease:Sine.easeInOut},0.1))
                    .add(new TimelineMax().staggerFromTo(this.nextMsg.find('.move'),0.6,{autoAlpha:0,y:20},{autoAlpha:1,y:0,ease:Sine.easeInOut},0.1))
                    .addLabel('end')
            },
            adMove:function (cur,next) {
                var self = this;
                this.curAd = this.ad.eq(cur);
                this.nextAd = this.ad.eq(next);
                new TimelineMax({
                    onStart:()=>{
                        self.nextAd.addClass('next');
                    },
                    onComplete:()=>{
                        self.curAd.removeClass('on');
                        self.nextAd.addClass('on');
                    }
                })
                    .addLabel('start')
                    .add(new TimelineMax().staggerFromTo(this.curAd,0.7,{autoAlpha:1,x:0},{autoAlpha:0,x:-10,ease:Sine.easeInOut}))
                    .add(new TimelineMax().staggerFromTo(this.nextAd,0.7,{autoAlpha:0,x:10},{autoAlpha:1,x:0,ease:Sine.easeInOut}))
                    .addLabel('end')
            }

        };
        new Loop({
            el:fn_,
            next:'.next_',
            prev:'.prev_',
            dot:'.timer-list',
            msg:'.msgList',
            pic:'.picList',
            sum:'.sum',
            ad:'.adList'
        }).init();
    },
    swiper : function () {
        var el = $('.loop');
        var loop = function (opts) {
            var parent  = opts.parent,
                prev    = opts.prev,
                next    = opts.next,
                msg     = opts.msg,
                item    = parent.find('.swiper-item'),
                _box_   = parent.find('.num-box'),
                _num    = _box_.find('.num_'),
                _sum    = _box_.find('.all_'),
                cur     = 0,
                num     = parent.find('.sum'),
                isAni   = false,
                list    = item.find('li'),
                wid     = 0,
                length  = list.length - 1;
            var islast_prev = false;
            var islast_next = true;
            var _ran = 6;
            var that_msg = msg.eq(cur);
            var _this_pic = null;
            wid = (window.innerWidth+18)/_ran - 18;
            var n1 = (length+1)<10 ? ('0'+(length+1)) : length+1;
            _sum.text(n1);
            if(window.innerWidth<=1366&&window.innerWidth>800){
                _ran = 5;
                wid = (window.innerWidth*0.9+18)/_ran - 18;
            }else if(window.innerWidth<=800){
                _ran = 2;
                wid = (window.innerWidth*1.2+18)/_ran - 18;
            }
            list.css({
                'width': (wid)+'px',
                'opacity':'1',
                'margin-right':'18px'
            });
            list.each(function (index) {
                var _this = $(this);
                if(index<(_ran)){
                    _this.css('opacity','1');
                    if(index>=1){
                        _this.velocity({
                            'scale':0.9
                        },{duration:10})
                    }else{
                        if(window.innerWidth>800){
                            _this.css('margin-right','28px');
                        }
                    }
                }
                if(window.innerWidth<700){
                    if(index>=1){
                        _this.velocity({
                            'scale':0.9
                        },{duration:10})
                    }
                }
                if(window.innerWidth<1025){
                    _this.on('click',function () {
                        if(!(_this_pic==null)){
                            _this_pic.find('.pic').removeClass('on');
                        }
                        _this.find('.pic').addClass('on');
                        _this_pic = _this;
                    });
                }
            });
            parent.css('height',(wid*1.36)+'px');
            item.css('width',(wid+32)*(length+1)+'px')
            parent.parent().css('height',(wid*1.36)+'px');
            prev.on('click',function () {
                if(islast_prev){
                    swiper_go(cur,'prev');
                }
            });
            next.on('click',function () {
                if(islast_next){
                    swiper_go(cur,'next');
                }
            });
            function swiper_go(index,type) {
                if(isAni) return false;
                isAni = true;
                var left = 0;
                if(type == 'prev'){
                    islast_next = true;
                    next.removeClass('active');
                    var _that_list = list.eq(cur);
                    _that_list.velocity({
                        opacity:1,
                        scale:0.9
                    },{
                        duration:450
                    });
                    cur = index>0 ? (index-1) : 0;
                    var cur_list = list.eq(cur);
                    cur_list.velocity({
                        opacity:1,
                        scale:1
                    },{
                        duration:450
                    });
                    item.velocity({
                        left:-(wid+18)*cur
                    },{
                        duration:450
                    });
                    if(cur == 0){
                        prev.addClass('active');
                        islast_prev = false;
                    }else{
                        prev.removeClass('active');
                        islast_prev = true;
                    }
                }
                if(type == 'next'){
                    islast_prev = true;
                    prev.removeClass('active');
                    var cur_list = list.eq(cur);
                    if(cur < length){
                        cur_list.velocity({
                            opacity:0,
                            scale:0.8
                        },{
                            duration:450
                        });
                    }
                    cur = index<length ? (index+1) : length;
                    list.eq(cur).velocity({
                        opacity:1,
                        scale:1
                    },{
                        duration:450
                    });
                    if(cur < length){
                        next.removeClass('active');islast_next = true;
                    }else{
                        next.addClass('active');islast_next = false;
                    }
                    item.velocity({
                        left:-(wid+18)*cur
                    },{
                        duration:450
                    });
                }
                if(cur>9){
                    num.text(cur+1);
                }else{
                    num.text('0'+(cur+1));
                }
                // item.css('transform','translateX(-'+left+'px)');
                var n2 = (cur+1)<10 ? ('0'+(cur+1)) : cur+1;
                _num.text(n2);
                list.eq(cur).addClass('on').siblings().removeClass('on');
                that_msg.velocity({
                    opacity:0
                },{
                    duration:500,
                    complete:function () {
                        msg.eq(cur).addClass('on').siblings().removeClass('on');
                        that_msg.css('opacity',1);
                        that_msg = msg.eq(cur);
                    }
                });
                setTimeout(function () {
                    isAni = false;
                },600);
            }
            if(!base.isPc){
                base.touchMove(parent,function () {
                    next[0].click();
                },function () {
                    prev[0].click();
                });
            }
        };
        el.each(function () {
            var _this = $(this),
                msg   = _this.find('.con').find('.msg'),
                prev  = _this.find('.f-prev'),
                next  = _this.find('.f-next');
            new loop({
                parent : _this,
                msg    : msg,
                prev   : prev,
                next   : next
            })
        });
    }
};
var proFn={
    init:function () {
        var timer = null;
        setTimeout(function () {
            $('#r1Alan').addClass('on');
        },10);
        $('.box').find('.col-2').find('li').each(function () {
           $(this).on('click',function () {
               if($(this).hasClass('goPop')) return false;
               clearTimeout(timer);
               $('.tip').addClass('on');
               timer = setTimeout(function () {
                   $('.tip').removeClass('on');
               },2000);
           })
        });
    }
};
var aboutFn={
    init:function () {
        var timer = null;
        setTimeout(function () {
            $('#r1Alan').addClass('on');
        },10);
        var $box = $('#fn2'),
            cur = 0,
            $dot = $box.find('.dot'),
            $li = $box.find('.list'),
            len = $li.length,
            timer = null;
            $prev = $box.find('#prev_'),
            $next = $box.find('#next_');
        $dot.on('mouseenter',function () {
            var that = $(this);
            cur = $(this).index();
            timer = setTimeout(function () {
                _on(that);
                _on($li.eq(cur));
            },300)
        });
        $dot.on('mouseleave',function () {
            clearTimeout(timer);
        })
        $prev.on('click',function () {
            cur>0?(cur-1):(len-1);
            _on($li.eq(cur));
        });
        $next.on('click',function () {
            cur = cur<(len-1)?(cur+1):0;
            _on($li.eq(cur));
        });
    },
    sw:function () {
        if(data.shu){
            // var mySwiper = new Swiper('#sw1', {
            //     // autoplay:true,
            //     loop: true,
            //     slidesPerView :'auto',
            //     centeredSlides: true,
            //     speed: 1000,
            //     navigation: {
            //         nextEl: '#sw_next',
            //         prevEl: '#sw_prev',
            //     },
            // });
            var mySwiper2 = new Swiper('#sw2', {
                // autoplay:true,
                loop: true,
                slidesPerView :'auto',
                spaceBetween : 10,
                centeredSlides: true,
                speed: 1000,
                parallax : true,
                navigation: {
                    nextEl: '#sw2_next',
                    prevEl: '#sw2_prev',
                },
                pagination: {
                    el: '.swiper-pagination',
                },
            });
        }else{
            // var mySwiper = new Swiper('#sw1', {
            //     // autoplay:true,
            //     loop: true,
            //     slidesPerView :'auto',
            //     centeredSlides: true,
            //     parallax : true,
            //     speed: 1000,
            //     navigation: {
            //         nextEl: '#sw_next',
            //         prevEl: '#sw_prev',
            //     },
            // });

        }
    },
    fn3:function () {
        var _box = $("#fn3"),
            items = _box.find('.box'),
            pic = _box.find('.pic');
        items.hover(function () {
            var _this = $(this),
                key = _this.index();
            _on($(this));
            _on(pic.eq(key));
        },function () {})
    }
};
var joinFn={
    hoverInit:function () {
        $('.list').hover(function(){
            var $this = $(this);
            _on($this);
            TweenMax.to($this.find('.main_company_morph_init'),0.6,{morphSVG:$this.find('.main_company_morph_hover'),ease:Power3.easeOut});
        },function(){
            var $this = $(this);
            $this.removeClass('on');
            TweenMax.to($this.find('.main_company_morph_init'),0.6,{morphSVG:$this.find('.main_company_morph_init'),ease:Power3.easeOut});
        })
    }
}
var contactFn={
    map:function () {
        var map = new BMap.Map("map");
        var point = new BMap.Point(121.308395,31.196207);
        map.centerAndZoom(point, 15);
        map.enableScrollWheelZoom(true);
        map.setMapStyle({styleJson: [{
                "featureType": "water",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "color": "#d1d6dbff"
                }
            }, {
                "featureType": "green",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "color": "#d1d6dbff"
                }
            }, {
                "featureType": "building",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "building",
                "elementType": "geometry.topfill",
                "stylers": {
                    "color": "#d1d6dbff"
                }
            }, {
                "featureType": "building",
                "elementType": "geometry.sidefill",
                "stylers": {
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "building",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#d1d6dbff"
                }
            }, {
                "featureType": "subwaystation",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "color": "#888fa0ff"
                }
            }, {
                "featureType": "education",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "color": "#e1e7e7ff"
                }
            }, {
                "featureType": "medical",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "scenicspots",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "highway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "weight": "4"
                }
            }, {
                "featureType": "highway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "highway",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "arterial",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "weight": "2"
                }
            }, {
                "featureType": "arterial",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "arterial",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "arterial",
                "elementType": "labels",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "arterial",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "arterial",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "local",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "on",
                    "weight": "1"
                }
            }, {
                "featureType": "local",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "local",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "local",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "local",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "local",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "railway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "weight": "1"
                }
            }, {
                "featureType": "railway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#9494941a"
                }
            }, {
                "featureType": "railway",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#ffffff1a"
                }
            }, {
                "featureType": "subway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "weight": "1"
                }
            }, {
                "featureType": "subway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#c3bed433"
                }
            }, {
                "featureType": "subway",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#ffffff33"
                }
            }, {
                "featureType": "subway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "subway",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#979c9aff"
                }
            }, {
                "featureType": "subway",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "continent",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "continent",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "continent",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#333333ff"
                }
            }, {
                "featureType": "continent",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "city",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "city",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "city",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#454d50ff"
                }
            }, {
                "featureType": "city",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "town",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "on"
                }
            }, {
                "featureType": "town",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "town",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#454d50ff"
                }
            }, {
                "featureType": "town",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "road",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "road",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "poilabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "districtlabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "poilabel",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "districtlabel",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#888fa0ff"
                }
            }, {
                "featureType": "transportation",
                "elementType": "geometry",
                "stylers": {
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "companylabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "restaurantlabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "lifeservicelabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "carservicelabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "financelabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "otherlabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "village",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "district",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "land",
                "elementType": "geometry",
                "stylers": {
                    "color": "#edf3f3ff"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "provincialway",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "road",
                "elementType": "geometry.stroke",
                "stylers": {
                    "color": "#cacfcfff"
                }
            }, {
                "featureType": "subwaylabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "subwaylabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "tertiarywaysign",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "tertiarywaysign",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "provincialwaysign",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "provincialwaysign",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "nationalwaysign",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "nationalwaysign",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "highwaysign",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "highwaysign",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "provincialway",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "highway",
                "stylers": {
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "stylers": {
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "stylers": {
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "highway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "stylers": {
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "stylers": {
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "stylers": {
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "nationalway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "provincialway",
                "stylers": {
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "8-8"
                }
            }, {
                "featureType": "provincialway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "8-8"
                }
            }, {
                "featureType": "provincialway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "8-8"
                }
            }, {
                "featureType": "cityhighway",
                "stylers": {
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "stylers": {
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "stylers": {
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "6",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "7",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off",
                    "level": "8",
                    "curZoomRegionId": "0",
                    "curZoomRegion": "6-8"
                }
            }, {
                "featureType": "cityhighway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "water",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#8f5a33ff"
                }
            }, {
                "featureType": "water",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "country",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#8f5a33ff"
                }
            }, {
                "featureType": "country",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "country",
                "elementType": "labels.text",
                "stylers": {
                    "fontsize": "28"
                }
            }, {
                "featureType": "manmade",
                "elementType": "geometry",
                "stylers": {
                    "color": "#d1d6dbff"
                }
            }, {
                "featureType": "provincialway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "tertiaryway",
                "elementType": "geometry.fill",
                "stylers": {
                    "color": "#fbfffeff"
                }
            }, {
                "featureType": "manmade",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#b8b8b8ff"
                }
            }, {
                "featureType": "manmade",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "scenicspots",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "scenicspots",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "airportlabel",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "airportlabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "scenicspotslabel",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "scenicspotslabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "educationlabel",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "educationlabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "medicallabel",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "medicallabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "companylabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "restaurantlabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "hotellabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "hotellabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "shoppinglabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "shoppinglabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "lifeservicelabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "carservicelabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "transportationlabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "transportationlabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "financelabel",
                "elementType": "labels.icon",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "entertainment",
                "elementType": "geometry",
                "stylers": {
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "estate",
                "elementType": "geometry",
                "stylers": {
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "shopping",
                "elementType": "geometry",
                "stylers": {
                    "color": "#d1dbdbff"
                }
            }, {
                "featureType": "education",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "education",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "medical",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "medical",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "transportation",
                "elementType": "labels.text.fill",
                "stylers": {
                    "color": "#999999ff"
                }
            }, {
                "featureType": "transportation",
                "elementType": "labels.text.stroke",
                "stylers": {
                    "color": "#ffffffff"
                }
            }, {
                "featureType": "districtlabel",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "boundary",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "country",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "island",
                "elementType": "labels",
                "stylers": {
                    "visibility": "off"
                }
            }, {
                "featureType": "road",
                "elementType": "geometry",
                "stylers": {
                    "visibility": "off"
                }
            }]});
        // 用经纬度设置地图中心点
        var theLocation = function (x, y, name) {
            map.clearOverlays();
            var new_point = new BMap.Point(x, y);
            var myIcon = new BMap.Icon("/templates/dist/img/j6.png", new BMap.Size(225, 203), {
                anchor: new BMap.Size(50, 85)
                // imageOffset: new BMap.Size(16, 0 - 10 * 25)
            });
            var marker = new BMap.Marker(new_point, {icon: myIcon});  // 创建标注
            map.addOverlay(marker);              // 将标注添加到地图中
            map.panTo(new_point);
            map.disableScrollWheelZoom()

            // var content = name;
            // var label = new BMap.Label(content, {       // 创建文本标注
            //     offset: new BMap.Size(25, 39)
            // });
            // marker.setLabel(label);                        // 将标注添加到地图中
            // label.setStyle({                              // 设置label的样式
            //     color: '#3b4048',
            //     fontSize: '.3rem',
            //     fontWeight: '700',
            //     background: 'none',
            //     border: '2px solid transparent'
            // })


        };
        theLocation(121.308395,31.196207);
    }
}
var jueFn = {

};


//ts手机视频封装
var Vfn = function () {
    this.arr_p = [];
    this.arr_src = [];
    this.arr_ori = [];
    this.arr_cv = [];
    this.that = [];
    this.stop=[];
    this.isP = null;
    this.first = true;
    this.app = !data.shu;
}
Vfn.prototype={
    init:function () {
        var self = this;
        var _parent = $('.video-parent');
        if(_parent.length<=0) return false;
        _parent.each(function () {
            var _this = $(this),
                _src  = _this.attr('data-src'),
                _url  = _this.attr('data-original'),
                _s    = _this.attr('data-stop')||0,
                _cv   = _this.find('.cv')[0];
            self.arr_src.push(_src);
            self.arr_ori.push(_url);
            self.arr_cv.push(_cv);
            self.stop.push(_s);
            self.that.push(_this);
        });
    },
    v_in:function (index) {
        var self = this;
        if(!data.shu) return false;
        self.isP = (self.arr_p[index] === undefined);
        if(self.isP){
            var player = new JSMpeg.Player(self.arr_src[index],{
                canvas: self.arr_cv[index],
                autoplay:false,
                loop:false,
                progressive:false,
                audio:false,
                onSourceCompleted:function(source){
                    if(page._plan.length>0){
                        player.play();
                    }
                },
                onVideoDecode:function(){
                    if(self.first){
                        $(self.arr_cv[index]).addClass('on');
                        if(page._plan.length>0){
                            player.play();
                        }
                        self.first = false;
                    }
                },
                onEnded:function () {
                    self.that[index].css('background-image','url('+self.arr_ori[index]+')');
                    var img = new Image();
                    img.onload=function(){
                        self.that[index].next().addClass('on');
                        $(self.arr_cv[index]).removeClass('on');
                        self.that[index].find('.pic_').addClass('on');
                    }
                    img.src = self.arr_ori[index];
                }
            });
            self.arr_p[index] = player;
        }
    },
    v_pause:function (index) {
        var self = this;
        if(!data.shu) return false;
        self.isP = (self.arr_p[index] === undefined);
        if(self.isP){}else{
            if(!self.arr_p[index].paused){
                self.arr_p[index].stop();
                $(self.arr_cv[index]).removeClass('on');
            }
        }
    },
    v_play:function (index) {
        var self = this;
        if(!data.shu) return false;
        self.isP = (self.arr_p[index] === undefined);
        if(self.isP){}else{
            if(self.arr_p[index].paused){
                self.arr_p[index].play();
            }
        }
    }
}
window.vfn = new Vfn();

var mo=function(e){e.preventDefault();};
function stop(){
    document.body.style.overflow='hidden';
    document.addEventListener("touchmove",mo,false);
}
function move(){
    document.body.style.overflow='';
    document.removeEventListener("touchmove",mo,false);
}
function _on(el) {
    el.addClass('on').siblings().removeClass('on');
}
function log(e) { console.log(e); }


//分段加载

var picload = function () {
    this.cur = 0;
    this.scrload = false;
    this.offset=0;
    this.v = 1;
    this.target = null;
    this.Varr=[];
    this.imgArr=[];
};
picload.prototype={
    init:function (opts) {
        var self = this;
        this.target = $(opts.el);
        this.scrload = opts.scrload||false;
        this.offset = opts.offset||0;
        this.getData();
        if(this.scrload){
            self.scrollEvent = self.scrollEvent.bind(this);
            self.scrollEvent();
            var _scrollEvent = self.throttlePro(self.scrollEvent,100,300);
            document.addEventListener('scroll',_scrollEvent,false);
        }
    },
    getData:function(){
        var self = this;
        this.target.each(function (index) {
            var arr_ = {done:false};
            var _src = $(this).attr('data-load');
            var _type = $(this).prop("tagName");
            if(_type==='VIDEO'){
                self.v++;
                arr_.el=$(this);arr_.top=($(this).offset().top);
                arr_.src= _src;arr_.type= _type;self.Varr.push(arr_);
            }
            else{
                arr_.el=$(this);arr_.top=($(this).offset().top-self.offset);
                arr_.src= _src;arr_.type= _type;self.imgArr.push(arr_);
            }
            if(index==self.target.length-self.v&&(!self.scrload)){
                self.load(self.imgArr,true);
            }
        });
    },
    load:function (arr,type) {
        var self = this;
        var img = new Image();
        var that = arr[self.cur];
        if(that.done) return false;
        img.onload=function(){
            if(that.type==='DIV'){
                that.el.css('background-image','url('+that.src+')');
            }else if(that.type==='IMG'){
                that.el.attr('src',that.src);
            }
            self.cur++;
            if(self.cur<arr.length&&type){
                self.load(arr,true);
            }else{
                console.log('done');
            }
        };
        img.src = arr[self.cur].src;
    },
    scrollEvent:function () {
        var self = this;
    },
    throttlePro:function(fn, delay, mustRunDelay){
        var timer = null;
        var t_start;
        return function(){
            var context = this, args = arguments, t_curr = +new Date();
            clearTimeout(timer);
            if(!t_start){
                t_start = t_curr;
            }
            if(t_curr - t_start >= mustRunDelay){
                fn.apply(context, args);
                t_start = t_curr;
            }
            else {
                timer = setTimeout(function(){
                    fn.apply(context, args);
                }, delay);
            }
        };
    }
};
$(function () {
    new picload().init({
        el:".loader"
    });

    // window.getSelection().empty()//消文字的选中状态


    $('.nav__trigger').on('click',function () {
        if ($(this).hasClass('on')){
            $(this).removeClass('on');
            $('header').removeClass('on')
        }else {
            $(this).addClass('on');
            $('header').addClass('on')
        }
    });
    if ($(window).width() <= 1024){
        $('#fnR4 li').eq(0).click();

        $('.m_nav_box .ani').on('click',function () {
           $(this).addClass('m_on').siblings('.ani').removeClass('m_on');
        });



    }

    if($('body').hasClass('new_body')){


        var newSwiper = new Swiper ('.new_timer .swiper-container', {
            slidesPerView :'auto',
            navigation: {
                nextEl: '.new_timer .swiper-button-next',
                prevEl: '.new_timer .swiper-button-prev',
            },


        })
    }


    if ($(window).width()<=1024){
        let winH = $(window).height();

       let topH = $('#home #main #roll  #r2  .top ').outerHeight(true);
       let bottomHl = $('#home #main #roll #r2 .rowMain .con .mid .col-2 ').outerHeight(true);

        let tH = winH - topH - bottomHl;
        $(' #home #main #roll #r2 .rowMain .con .mid .col-1').css('height',tH +'px');



        let topH5 = $('#home #main #roll  #r5   .top ').outerHeight(true)+ $('#home #main #roll #r5 .rowMain .con .mid ').css('margin-top') * 2 + $('#home #main #roll #r5 .rowMain .con').css('padding-top');
        let bottomHl5 = $('#home #main #roll #r5  .rowMain .con .mid .col-2 ').outerHeight(true) + $('#home #main #roll #r5  .rowMain .con .mid .col-2 .msgList ').outerHeight(true);

        let tH5 = winH - topH - bottomHl;
        $(' #home #main #roll #r5  .rowMain .con .mid .col-1').css('height',tH +'')

    }



    // if ($(window).width() / $(window).height() > 1){
        if($('body').hasClass('text_body')){
            $('.pc-nav').addClass('down')
        }
    // }
    });












