/* Js for , Version=1769482581 */
 v.lang = {"confirmDelete":"\u60a8\u786e\u5b9a\u8981\u6267\u884c\u5220\u9664\u64cd\u4f5c\u5417\uff1f","deleteing":"\u5220\u9664\u4e2d","doing":"\u5904\u7406\u4e2d","loading":"\u52a0\u8f7d\u4e2d","updating":"\u66f4\u65b0\u4e2d...","timeout":"\u7f51\u7edc\u8d85\u65f6,\u8bf7\u91cd\u8bd5","errorThrown":"\u6267\u884c\u51fa\u9519\uff1a","continueShopping":"\u7ee7\u7eed\u8d2d\u7269","required":"\u5fc5\u586b","back":"\u8fd4\u56de","continue":"\u7ee7\u7eed","bindWechatTip":"\u53d1\u5e16\u529f\u80fd\u8bbe\u7f6e\u4e86\u7ed1\u5b9a\u5fae\u4fe1\u7684\u9650\u5236\uff0c\u8bf7\u5148\u7ed1\u5b9a\u5fae\u4fe1\u4f1a\u5458\u3002","importTip":"\u53ea\u5bfc\u5165\u4e3b\u9898\u7684\u98ce\u683c\u548c\u6837\u5f0f","fullImportTip":"\u5c06\u4f1a\u5bfc\u5165\u6d4b\u8bd5\u6570\u636e\u4ee5\u53ca\u66ff\u6362\u7ad9\u70b9\u6587\u7ae0\u3001\u4ea7\u54c1\u7b49\u6570\u636e"};;$('#block241').find('.slide-card').click(function(){
    location.href = $(this).data('url');
});;$('#block242').find('.slide-card').click(function(){
    location.href = $(this).data('url');
});;var oTimeAxiosFun = null;
		$(function () {
			var timeList = [
				// {name:'模具喷砂—— 离模性改善',time:'2019-11-01',value:123456},
				{name:'模具喷砂—— 离模性改善',time:'2019-11-01',value:26,},
				{name:'心血管支架——激光切割后圆弧改善',time:'2019-11-02',value:15},
				{name:'复杂刀具——丝锥与滚刀',time:'2019-11-03',value:20},
    				{name:'航空航天——减速机柔轮与叶片处理',time:'2019-11-14',value:19},
				{name:'齿科系列——牙螺钉酸蚀前处理喷砂',time:'2019-11-05',value:35},
				{name:'其他领域——定制型解决方案',time:'2019-11-06',value:34},
				// {name:'第七次',time:'2019-11-07',value:124},
				// {name:'第八次',time:'2019-11-08',value:122},
				// {name:'第九次',time:'2019-11-09',value:123},
			];//参数列表
			var param = {
				data: timeList, // 数据
				id: 'cxTime', //dom节点ID
				index: 0, // 选中时间节点
				sort: 'just', // 正序just，反序back, 其他表示不排序
				sortKey: 'time', //排序的参数key
				activeColor: 'rgba(255, 180, 255, 0.5)', // 选中颜色
				props: ['name','time','value'], //展示的key
				then: function (data) {
					console.log(data);
					let value = data.data('link')
					window.location.href=`http://saain.itwsw.cn/index.php/article/${value}.html`
					
				}, //点击事件回调方法
				// format: function (key, val) {
				// 	console.log(key, val);
				// 	return val
				// }, //数据格式化处理
			}
			oTimeAxiosFun = new oTimeAxios(param);
		})
		var defaults = {
		data: [], // 展示数据
		id: '', // 判定dom ID
		props: [], // 数据反显key
		index: 0, //默认当前选中
		sort: '', // 正序just，反序back, 其他表示不排序
		sortKey: '', //排序的参数key //为空时表示不排序
		
		activeColor: ' rgba(255, 180, 255, 0.5)', // 默认颜色
// 		activeColor: '#26a69a',
		

		then: function () {

		}
	};

	var TimeAxis = function (options) {
		this.options = Object.assign(defaults, options);
		this.props = this.options.props;
		this.id = this.options.id;
		this.init();
	};

	TimeAxis.prototype = {

		// 组件初始化
		init: function () {
			// 生成时间轴盒子html
			this.setTimeBox();
		},

		// 生成时间轴盒子html
		setTimeBox: function () {
			var id = "#" + this.id;
			var html = '<ul class="cx-time-box"></ul>';
			$(id).empty().append(html);
			// 生成时间轴html
			this.setTimeAxisHtml();

			var self = this;
		},

		// 时间排序
		sortTime () {
			var list = this.options.data || [];
			var sort = this.options.sort;
			var key = this.options.sortKey;

			var num = 1;
			if(sort == 'just' && key){
				num = 1;
			}else if (sort == 'back' && key){
				num = -1;
			}else {
				return list;
			}
			
			list.sort(function (before, after) {
				return before[key] > after[key] ? num: -num
			})
			return list
		},

		// 生成时间轴html
		setTimeAxisHtml: function () {
			var list = this.sortTime();
			var html = '';
			var self = this;
			$.each(list, function (index, item) {
				html += '<li>';
				html += '<div class="cx-main-box cx-main-box'+index+'" data-index="'+index+'" data-link="'+item.value+'">';
				$.each(self.props, function(i, key){
					if(item[key]){
						html += '<div>'+self.formatChange(key,item[key])+'</div>';
					}
				});
				html += '</div>';
				html += '</li>';
			});
			var cls = "#" + this.id + ' ul';
			$(cls).empty().append(html);

			// 节点绑定点击事件
			$(cls + ' .cx-main-box').click(function (res) {
			    
			    console.log($(this))
				// self.options.link = $(this).data('link');

				// // 点击事件回调
				// var data = list[self.options.link];
				self.options.then($(this));

				// 选择节点颜色
				self.activeColor();
			})

			// 选择节点颜色
			this.activeColor();
		},

		// 节点颜色
		activeColor () {
			var clsAll = '#' + this.id + ' .cx-main-box';
			$(clsAll).css({
				// 'background': '#b2dfdb',
				'background': 'rgba(255, 255, 255,  0.3)',
				
				'color': '#fff'
			});
			$(clsAll).removeClass('active');

			var cls = clsAll + this.options.index;
			
			$(cls).css({
				'background': this.options.activeColor,
				'color': '#fff'
			});
			$(cls).addClass('active');
		},


		//数据格式化事件
		formatChange: function (key, val) {
			// 判断是否包含format 方法
			if(typeof(this.options.format) == "function"){
				return this.options.format(key, val);
			}
			return val;
		}
	};
	window.oTimeAxios = TimeAxis;;$().ready(function() { $('#execIcon').tooltip({title:$('#execInfoBar').html(), html:true, placement:'right'}); }); ;$(document).ready(function()
{          
    // add "index" class to the body element.
    $('body').addClass('index');

    $('.nav-system-home:first').addClass('active');
    $('#navbar li.active').parents('li').addClass('active');
})

;
function loadCartInfo(twinkle)
{
    $('#siteNav').load(createLink('misc', 'printTopBar'),
        function()
        {
            if(twinkle) 
            {
                bootbox.dialog(
                {  
                    message: v.addToCartSuccess,  
                    buttons:
                    {  
                        back:
                        {  
                            label:     v.lang.continueShopping,
                            className: 'btn-primary',  
                            callback:  function(){location.reload();}  
                        },
                        cart:
                        {  
                            label:     v.gotoCart,  
                            className: 'btn-primary',  
                            callback:  function(){location.href = createLink('cart', 'browse');}  
                        }  
                    }  
                });
            }
        }
    );
}
