ajaxActivityTime.js 819 Bytes
/**
 * 获取奥莱活动时间
 * @author: wsl<shuiling.wang@yoho.cn>
 * @date: 2016/10/10
 */
var $ = require('yoho-jquery'),
    Countdown = require('../outlet/countdown'),
    tip = require('../../plugin/tip');

var $el = $('.cd-lite');

module.exports = function(params) {
    $.ajax({
        type: 'GET',
        url: '/product/outlet/activityTime',
        data: params,
        success: function(data) {
            if (data) {

                $el.each(function(key, item) {
                    $(item).attr('data-config', '{"leftTime": ' + data[key] + ' }');

                    new Countdown.Countdown({
                        el: $(item)
                    });
                });
            }
        },
        error: function() {
            tip.show('网络断开连接了~');
        }
    });
};