goods.js 19.7 KB
Newer Older
D
v1.2.0  
devil_gong 已提交
1
// 规格弹窗PC显示
D
Devil 已提交
2
function PoptitPcShow()
D
v1.2.0  
devil_gong 已提交
3 4 5 6 7 8 9
{
    $(document.body).css('position', 'static');
    $('.theme-signin-left').scrollTop(0);
    $('.theme-popover-mask').hide();
    $('.theme-popover').slideDown(0);
}
// 规格弹窗关闭
D
Devil 已提交
10
function PoptitClose()
D
v1.2.0  
devil_gong 已提交
11 12 13 14 15 16 17 18 19 20
{
    if($(window).width() < 1025)
    {
        $(document.body).css('position', 'static');
        $('.theme-signin-left').scrollTop(0);
        $('.theme-popover-mask').hide();
        $('.theme-popover').slideUp(100);
    }
}

G
gongfuxiang 已提交
21 22 23 24 25 26 27 28 29 30
/**
 * 评论记录ajax请求
 * @author   Devil
 * @blog     http://gong.gg/
 * @version  1.0.0
 * @datetime 2019-05-13T21:39:55+0800
 * @param    {[int]}                 page [分页值]
 */
function GoodsCommentsHtml(page)
{
D
devil_gong 已提交
31 32 33 34 35 36 37
    if((page || 1) <= 1)
    {
        $('.goods-page-no-data').removeClass('none');
        $('.goods-page-no-data span').text('加载中...');
    } else {
        $('.goods-page-no-data').addClass('none');
    }
G
gongfuxiang 已提交
38 39 40

    $.ajax({
        url: $('.goods-comment').data('url'),
41 42 43 44
        type: 'POST',
        data: {"goods_id": $('.goods-comment').data('goods-id'), "page": page || 1},
        dataType: 'json',
        success: function(result)
G
gongfuxiang 已提交
45
        {
D
devil_gong 已提交
46
            $('.goods-page-no-data').addClass('none');
G
gongfuxiang 已提交
47 48
            if(result.code == 0)
            {
D
devil_gong 已提交
49
                $('.goods-comment-content').html(result.data.data);
G
gongfuxiang 已提交
50 51 52 53 54 55 56
                $('.goods-page-container').html(PageLibrary(result.data.total, result.data.number, page, 2));
            }

            // 没有数据
            if($('.goods-comment-content article').length <= 0)
            {
                $('.goods-page-no-data').removeClass('none');
D
devil_gong 已提交
57
                $('.goods-page-no-data span').text('没有评论数据');
G
gongfuxiang 已提交
58
            }
D
devil_gong 已提交
59
        },
60
        error: function(xhr, type)
D
devil_gong 已提交
61 62
        {
            $('.goods-page-no-data').removeClass('none');
63
            $('.goods-page-no-data span').text(xhr.responseText || '请求出现错误,请稍后再试!');
G
gongfuxiang 已提交
64 65 66 67
        }
    });
}

D
v1.2.0  
devil_gong 已提交
68
/**
D
devil 已提交
69
 * 购买/加入购物车校验
D
v1.2.0  
devil_gong 已提交
70 71 72 73 74 75 76
 * @author   Devil
 * @blog    http://gong.gg/
 * @version 1.0.0
 * @date    2018-09-13
 * @desc    description
 * @param   {[object]}        e [当前标签对象]
 */
D
devil 已提交
77
function BuyCartCheck(e)
D
v1.2.0  
devil_gong 已提交
78 79
{
    // 参数
D
devil_gong 已提交
80 81 82 83 84 85
    var stock = parseInt($('#text_box').val()) || 1;
    var inventory = parseInt($('.stock-tips .stock').text());
    var min = $('.stock-tips .stock').data('min-limit') || 1;
    var max = $('.stock-tips .stock').data('max-limit') || 0;
    var unit = $('.stock-tips .stock').data('unit') || '';
    if(stock < min)
D
v1.2.0  
devil_gong 已提交
86
    {
D
devil 已提交
87
        Prompt('最低起购数量'+min+unit);
D
devil_gong 已提交
88 89 90 91
        return false;
    }
    if(max > 0 && stock > max)
    {
D
devil 已提交
92
        Prompt('最大限购数量'+max+unit);
D
devil_gong 已提交
93 94 95 96
        return false;
    }
    if(stock > inventory)
    {
D
devil 已提交
97
        Prompt('库存数量'+inventory+unit);
D
v1.2.0  
devil_gong 已提交
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
        return false;
    }

    // 规格
    var spec = [];
    var sku_count = $('.sku-items').length;
    if(sku_count > 0)
    {
        var spec_count = $('.sku-line.selected').length;
        if(spec_count < sku_count)
        {
            $('.sku-items').each(function(k, v)
            {
                if($(this).find('.sku-line.selected').length == 0)
                {
D
devil 已提交
113
                    $(this).addClass('sku-not-active');
D
v1.2.0  
devil_gong 已提交
114 115
                }
            });
D
devil 已提交
116
            Prompt('请选择规格');
D
v1.2.0  
devil_gong 已提交
117 118
            return false;
        } else {
D
devil 已提交
119
            $('.iteminfo_parameter .sku-items').removeClass('sku-not-active');
D
v1.2.0  
devil_gong 已提交
120 121 122 123 124 125
            $('.theme-signin-left .sku-items li.selected').each(function(k, v)
            {
                spec.push({"type": $(this).data('type-value'), "value": $(this).data('value')})
            });
        }
    }
D
devil 已提交
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    return {
        "stock": stock,
        "spec": spec,
        "type": e.attr('data-type')
    };
}

/**
 * 购买/加入购物车处理
 * @author   Devil
 * @blog    http://gong.gg/
 * @version 1.0.0
 * @date    2018-09-13
 * @desc    description
 * @param   {[object]}        e [当前标签对象]
 */
function BuyCartHandle(e)
{
    // 参数
    var params = BuyCartCheck(e);
    if(params === false)
    {
        return false;
    }
D
v1.2.0  
devil_gong 已提交
150 151

    // 操作类型
D
devil 已提交
152
    switch(params.type)
D
v1.2.0  
devil_gong 已提交
153 154 155
    {
        // 立即购买
        case 'buy' :
D
devil 已提交
156 157 158 159
            var $form = $('form.buy-form');
            $form.find('input[name="spec"]').val(JSON.stringify(params.spec));
            $form.find('input[name="stock"]').val(params.stock);
            $form.find('button[type="submit"]').trigger('click');
D
v1.2.0  
devil_gong 已提交
160 161 162 163
            break;

        // 加入购物车
        case 'cart' :
D
devil 已提交
164 165 166 167
            var $form = $('form.cart-form');
            $form.find('input[name="spec"]').val(JSON.stringify(params.spec));
            $form.find('input[name="stock"]').val(params.stock);
            $form.find('button[type="submit"]').trigger('click');
D
Devil 已提交
168
            PoptitClose();
D
v1.2.0  
devil_gong 已提交
169 170 171 172
            break;

        // 默认
        default :
D
devil 已提交
173
            Prompt('操作参数配置有误');
D
v1.2.0  
devil_gong 已提交
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
    }
    return true;
}

/**
 * 获取规格详情
 * @author   Devil
 * @blog    http://gong.gg/
 * @version 1.0.0
 * @date    2018-12-14
 * @desc    description
 */
function GoodsSpecDetail()
{
    // 是否全部选中
    var sku_count = $('.theme-signin-left .sku-items').length;
    var active_count = $('.theme-signin-left .sku-items li.selected').length;
    if(active_count < sku_count)
    {
        return false;
    }

    // 获取规格值
    var spec = [];
    $('.theme-signin-left .sku-items li.selected').each(function(k, v)
    {
        spec.push({"type": $(this).data('type-value'), "value": $(this).data('value')})
    });

    // 开启进度条
    $.AMUI.progress.start();

    // ajax请求
    $.ajax({
        url: $('.goods-detail').data('spec-detail-ajax-url'),
        type: 'post',
        dataType: "json",
        timeout: 10000,
        data: {"id": $('.goods-detail').data('id'), "spec": spec},
        success: function(result)
        {
            $.AMUI.progress.done();
            if(result.code == 0)
            {
D
devil 已提交
218
                $('.text-info .price-now').text(__currency_symbol__+result.data.spec_base.price);
D
devil_gong 已提交
219 220 221 222
                $('.goods-price').text(result.data.spec_base.price);
                $('.number-tag input[type="number"]').attr('max', result.data.spec_base.inventory);
                $('.stock-tips .stock').text(result.data.spec_base.inventory);
                if(result.data.spec_base.original_price > 0)
D
v1.2.0  
devil_gong 已提交
223
                {
D
devil 已提交
224
                    $('.goods-original-price').text(__currency_symbol__+result.data.spec_base.original_price);
D
devil_gong 已提交
225
                    $('.goods-original-price').parents('.items').show();
D
v1.2.0  
devil_gong 已提交
226
                } else {
D
devil_gong 已提交
227
                    $('.goods-original-price').parents('.items').hide();
D
devil_gong 已提交
228 229 230 231 232 233 234 235 236 237 238 239 240
                }

                // 扩展数据处理
                var extends_element = result.data.extends_element || [];
                if(extends_element.length > 0)
                {
                    for(var i in extends_element)
                    {
                        if((extends_element[i]['element'] || null) != null && extends_element[i]['content'] !== null)
                        {
                            $(extends_element[i]['element']).html(extends_element[i]['content']);
                        }
                    }
D
v1.2.0  
devil_gong 已提交
241 242
                }
            } else {
D
devil 已提交
243
                Prompt(result.msg);
D
v1.2.0  
devil_gong 已提交
244 245 246 247 248
            }
        },
        error: function(xhr, type)
        {
            $.AMUI.progress.done();
D
Devil 已提交
249
            Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
D
v1.2.0  
devil_gong 已提交
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
        }
    });
}

/**
 * 获取规格类型
 * @author   Devil
 * @blog    http://gong.gg/
 * @version 1.0.0
 * @date    2018-12-14
 * @desc    description
 */
function GoodsSpecType()
{
    // 是否全部选中
    var sku_count = $('.theme-signin-left .sku-items').length;
    var active_count = $('.theme-signin-left .sku-items li.selected').length;
    if(active_count <= 0 || active_count >= sku_count)
    {
        return false;
    }

    // 获取规格值
    var spec = [];
    $('.theme-signin-left .sku-items li.selected').each(function(k, v)
    {
        spec.push({"type": $(this).data('type-value'), "value": $(this).data('value')})
    });

    // 开启进度条
    $.AMUI.progress.start();

    // ajax请求
    $.ajax({
        url: $('.goods-detail').data('spec-type-ajax-url'),
        type: 'post',
        dataType: "json",
        timeout: 10000,
        data: {"id": $('.goods-detail').data('id'), "spec": spec},
        success: function(result)
        {
            $.AMUI.progress.done();
            if(result.code == 0)
            {
                var spec_count = spec.length;
                var index = (spec_count > 0) ? spec_count : 0;
                if(index < sku_count)
                {
                    $('.theme-signin-left .sku-items').eq(index).find('li').each(function(k, v)
                    {
                        $(this).removeClass('sku-dont-choose');
301
                        var value = $(this).data('value').toString();
D
devil_gong 已提交
302
                        if(result.data.spec_type.indexOf(value) == -1)
D
v1.2.0  
devil_gong 已提交
303 304 305 306 307 308 309
                        {
                            $(this).addClass('sku-items-disabled');
                        } else {
                            $(this).removeClass('sku-items-disabled');
                        }
                    });
                }
D
devil_gong 已提交
310 311 312 313 314 315 316 317 318 319 320 321 322

                // 扩展数据处理
                var extends_element = result.data.extends_element || [];
                if(extends_element.length > 0)
                {
                    for(var i in extends_element)
                    {
                        if((extends_element[i]['element'] || null) != null && extends_element[i]['content'] !== null)
                        {
                            $(extends_element[i]['element']).html(extends_element[i]['content']);
                        }
                    }
                }
D
v1.2.0  
devil_gong 已提交
323
            } else {
D
devil 已提交
324
                Prompt(result.msg);
D
v1.2.0  
devil_gong 已提交
325 326 327 328 329
            }
        },
        error: function(xhr, type)
        {
            $.AMUI.progress.done();
D
Devil 已提交
330
            Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
D
v1.2.0  
devil_gong 已提交
331 332 333 334 335 336 337 338 339 340 341 342 343 344
        }
    });
}

/**
 * 商品基础数据恢复
 * @author   Devil
 * @blog    http://gong.gg/
 * @version 1.0.0
 * @date    2018-12-25
 * @desc    description
 */
function GoodsBaseRestore()
{
D
devil 已提交
345
    $('.text-info .price-now').text(__currency_symbol__+$('.text-info .price-now').data('original-price'));
D
devil_gong 已提交
346
    $('.goods-price').text($('.goods-price').data('original-price'));
D
v1.2.0  
devil_gong 已提交
347 348
    $('.number-tag input[type="number"]').attr('max', $('.number-tag input[type="number"]').data('original-max'));
    $('.stock-tips .stock').text($('.stock-tips .stock').data('original-stock'));
D
devil_gong 已提交
349 350 351 352 353 354 355 356 357

    // 价格处理
    if($('.tb-detail-price .original-price-value').length > 0)
    {
        $('.tb-detail-price .original-price-value').each(function(k, v)
        {
            var price = $(this).data('original-price');
            if(price !== undefined)
            {
D
devil 已提交
358
                $(this).text(__currency_symbol__+price);
D
devil_gong 已提交
359 360 361
            }
        });
    }
D
v1.2.0  
devil_gong 已提交
362 363
}

D
devil 已提交
364 365 366 367 368 369 370 371
/**
 * 规格选择显示
 * @author  Devil
 * @blog    http://gong.gg/
 * @version 1.0.0
 * @date    2020-08-16
 * @desc    description
 */
D
devil 已提交
372
function SpecPopupShow(e)
D
devil 已提交
373
{
D
devil 已提交
374
    $(document.body).css({"position":"fixed", "width":"100%"});
D
devil 已提交
375 376
    $('.theme-popover-mask').show();
    $('.theme-popover').slideDown(200);
D
devil 已提交
377
    $('.theme-popover .confirm').attr('data-type', e.data('type') || 'buy');    
D
devil 已提交
378 379
}

D
v1.2.0  
devil_gong 已提交
380
$(function() {
D
devil 已提交
381 382 383
    // 购物车表单初始化
    FromInit('form.cart-form');

D
v1.2.0  
devil_gong 已提交
384 385 386 387 388
    // 商品规格选择
    $('.theme-options').each(function()
    {
        $(this).find('ul>li').on('click', function()
        {
389
            // 切换规格购买数量清空
D
devil_gong 已提交
390
            $('#text_box').val($('.stock-tips .stock').data('min-limit') || 1);
391 392
            
            // 规格处理
D
v1.2.0  
devil_gong 已提交
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
            var length = $('.theme-signin-left .sku-items').length;
            var index = $(this).parents('.sku-items').index();

            if($(this).hasClass('selected'))
            {
                $(this).removeClass('selected');

                // 去掉元素之后的禁止
                $('.theme-signin-left .sku-items').each(function(k, v)
                {
                    if(k > index)
                    {
                        $(this).find('li').removeClass('sku-items-disabled').removeClass('selected').addClass('sku-dont-choose');
                    }
                });

                // 数据还原
                GoodsBaseRestore();

            } else {
                if($(this).hasClass('sku-items-disabled') || $(this).hasClass('sku-dont-choose'))
                {
                    return false;
                }
                $(this).addClass('selected').siblings('li').removeClass('selected');
D
devil 已提交
418
                $(this).parents('.sku-items').removeClass('sku-not-active');
D
v1.2.0  
devil_gong 已提交
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457

                // 去掉元素之后的禁止
                if(index < length)
                {
                    $('.theme-signin-left .sku-items').each(function(k, v)
                    {
                        if(k > index)
                        {
                            $(this).find('li').removeClass('sku-items-disabled').removeClass('selected').addClass('sku-dont-choose');
                        }
                    });
                }

                // 是否存在规格图片
                var spec_images = $(this).data('type-images') || null;
                if(spec_images != null)
                {
                    $('.jqzoom').attr('src', spec_images);
                    $('.jqzoom').attr('rel', spec_images);
                    $('.img-info img').attr('src', spec_images);
                }

                // 后面是否还有未选择的规格
                if(index < length-1)
                {
                    // 数据还原
                    GoodsBaseRestore();
                }

                // 获取下一个规格类型
                GoodsSpecType();

                // 获取规格详情
                GoodsSpecDetail();
            }
        });
    });

    // 放大镜初始化
G
gongfuxiang 已提交
458 459 460
    $('.jqzoom').imagezoom({
        yzoom: 398
    });
D
v1.2.0  
devil_gong 已提交
461 462 463 464 465 466
    $('#thumblist li a').on('mouseover', function() {
        $(this).parents('li').addClass('tb-selected').siblings().removeClass('tb-selected');
        $('.jqzoom').attr('src', $(this).find('img').attr('mid'));
        $('.jqzoom').attr('rel', $(this).find('img').attr('big'));
    });

D
devil 已提交
467 468 469
    // 规格选择显示事件
    $('.mini-spec-event').on('click', function()
    {
D
devil 已提交
470
        SpecPopupShow($(this));
D
devil 已提交
471 472
    });

D
v1.2.0  
devil_gong 已提交
473 474 475 476 477 478
    //弹出规格选择
    $('.buy-event').on('click', function() {
        if($(window).width() < 1025) {
            // 是否登录
            if(__user_id__ != 0)
            {
D
devil 已提交
479
                SpecPopupShow($(this));
D
v1.2.0  
devil_gong 已提交
480 481
            }
        } else {
D
Devil 已提交
482
            PoptitPcShow();
D
v1.2.0  
devil_gong 已提交
483 484 485
        }
    });
    $('.theme-poptit .close, .btn-op .close').on('click', function() {
D
Devil 已提交
486
        PoptitClose();
D
v1.2.0  
devil_gong 已提交
487 488 489 490 491 492 493 494 495 496
    });

    // 购买
    $('.buy-submit, .cart-submit').on('click', function()
    {
        // 是否登录
        if(__user_id__ != 0)
        {
            if($(window).width() >= 1025)
            {
D
devil 已提交
497
                BuyCartHandle($(this));
D
v1.2.0  
devil_gong 已提交
498 499 500 501 502 503 504 505 506 507
            }
        }
    });
    $('.theme-popover .confirm').on('click', function()
    {
        // 是否登录
        if(__user_id__ != 0)
        {
            if($(window).width() < 1025)
            {
D
devil 已提交
508
                BuyCartHandle($(this));
D
v1.2.0  
devil_gong 已提交
509 510 511 512 513 514 515 516 517 518 519 520 521
            }
        }
    });

    // 收藏
    $('.favor-submit').on('click', function()
    {
        // 是否登录
        if(__user_id__ != 0)
        {
            var $this = $(this);

            // ajax请求
522
            $.AMUI.progress.start();
D
v1.2.0  
devil_gong 已提交
523 524 525 526 527 528 529 530 531
            $.ajax({
                url: $(this).data('ajax-url'),
                type: 'post',
                dataType: "json",
                timeout: 10000,
                data: {"id": $('.goods-detail').data('id')},
                success: function(result)
                {
                    $.AMUI.progress.done();
532
                    PoptitClose();
D
v1.2.0  
devil_gong 已提交
533 534 535 536 537 538 539 540 541 542 543

                    if(result.code == 0)
                    {
                        $this.find('.goods-favor-text').text(result.data.text);
                        $this.find('.goods-favor-count').text('('+result.data.count+')');
                        if(result.data.status == 1)
                        {
                            $this.addClass('text-active');
                        } else {
                            $this.removeClass('text-active');
                        }
D
devil 已提交
544
                        Prompt(result.msg, 'success');
D
v1.2.0  
devil_gong 已提交
545
                    } else {
D
devil 已提交
546
                        Prompt(result.msg);
D
v1.2.0  
devil_gong 已提交
547 548 549 550 551
                    }
                },
                error: function(xhr, type)
                {
                    $.AMUI.progress.done();
552
                    PoptitClose();
D
Devil 已提交
553
                    Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
D
v1.2.0  
devil_gong 已提交
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
                }
            });
        }
    });

    // 视频
    $('.goods-video-submit-start').on('click', function()
    {
        $('.goods-video-container').removeClass('none').trigger('play');
        $('.goods-video-submit-close').removeClass('none');
        $('.goods-video-submit-start').addClass('none');
    });
    $('.goods-video-submit-close').on('click', function()
    {
        $('.goods-video-container').addClass('none').trigger('pause');
        $('.goods-video-submit-close').addClass('none');
        $('.goods-video-submit-start').removeClass('none');
    });

    //获得文本框对象
D
devil_gong 已提交
574 575 576 577
    var $sotck = $('#text_box');
    var min = $('.stock-tips .stock').data('min-limit') || 1;
    var max = $('.stock-tips .stock').data('max-limit') || 0;
    var unit = $('.stock-tips .stock').data('unit') || '';
D
v1.2.0  
devil_gong 已提交
578

G
gongfuxiang 已提交
579 580 581 582 583 584 585 586 587
    // 手动输入
    $sotck.on('blur', function()
    {
        var number = parseInt($(this).val());
        var inventory = parseInt($('.stock-tips .stock').text());
        if(number > inventory)
        {
            number = inventory;
        }
D
devil 已提交
588
        if(number <= 1 || isNaN(number))
G
gongfuxiang 已提交
589
        {
D
devil 已提交
590
            number = min;
G
gongfuxiang 已提交
591 592 593 594
        }
        $sotck.val(number);
    });

D
v1.2.0  
devil_gong 已提交
595
    //数量增加操作
D
devil_gong 已提交
596 597 598 599 600
    $('#add').on('click', function()
    {
        var inventory = parseInt($('.stock-tips .stock').text());
        var number = parseInt($sotck.val())+1;
        if(max > 0 && number > max)
D
v1.2.0  
devil_gong 已提交
601
        {
D
devil_gong 已提交
602 603 604 605 606 607 608
            Prompt('最大限购数量'+max+unit);
            return false;
        }
        if(number > inventory)
        {
            Prompt('库存数量'+inventory+unit);
            return false;
D
v1.2.0  
devil_gong 已提交
609
        }
D
devil_gong 已提交
610
        $sotck.val(number);
D
v1.2.0  
devil_gong 已提交
611 612
    });
    //数量减少操作
D
devil_gong 已提交
613 614
    $('#min').on('click', function()
    {
D
devil_gong 已提交
615
        var value = parseInt($sotck.val())-1 || 1;
D
devil_gong 已提交
616 617 618 619 620 621
        if(value < min)
        {
            Prompt('最低起购数量'+min+unit);
            return false;
        }
        $sotck.val(value);
D
devil_gong 已提交
622 623
    });

G
gongfuxiang 已提交
624 625 626 627 628 629 630 631 632 633 634
    // 评论
    GoodsCommentsHtml(1);
    $(document).on('click', '.goods-page-container .pagelibrary a', function()
    {
        var page = $(this).data('page') || null;
        if(page != null)
        {
            // 获取数据
            GoodsCommentsHtml(page);

            // 回到评论顶部位置
D
devil_gong 已提交
635
            $(window).smoothScroll({position: $('.introduce-main').offset().top});
G
gongfuxiang 已提交
636 637 638 639 640 641
        }
    });

    // 累计评价点击事件
    $('.tm-ind-panel .ind-panel-comment').on('click', function()
    {
D
devil_gong 已提交
642
        $(window).smoothScroll({position: $('.introduce-main').offset().top});
G
gongfuxiang 已提交
643 644 645
        $('.introduce-main .am-tabs').tabs('open', 1);
    });

D
devil_gong 已提交
646 647 648
    // tab事件
    $('.introduce-main .am-tabs li').on('click', function()
    {
D
devil_gong 已提交
649
        $(window).smoothScroll({position: $('.introduce-main').offset().top});
D
devil_gong 已提交
650 651
    });

D
devil_gong 已提交
652
});
D
v1.2.0  
devil_gong 已提交
653

D
devil_gong 已提交
654 655 656
// 浏览器窗口实时事件
$(window).resize(function()
{
D
Devil 已提交
657 658 659
    var name = document.activeElement.tagName;
    var arr = ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'];
    if(arr.indexOf(name) == -1)
D
devil_gong 已提交
660
    {
661 662 663 664 665 666 667
        // 规格显示/隐藏处理
        if($(window).width() < 1025)
        {
            PoptitClose();
        } else {
            PoptitPcShow();
        }
D
devil_gong 已提交
668
    }
D
v1.2.0  
devil_gong 已提交
669
});