var icount = 5; var overall = function () { var _self = this; var $header = $("#header"), $wrapper = $("#wrapper"), $container = $("#container"), $navbar = $("#navbar"), $menubar = $("#menubar"), $menupointer = $("#menu-pointer"), $navpointer = $("#nav-pointer"), $dropdown = $("[dropdown]"), $logo = $("#header .logo"); // 初始化侧栏界面 if(window.localstorage){ if(localstorage.getitem("jingshop_nav") == 1){ $navbar.addclass("navbar-mini"); $wrapper.addclass("wrapper-max"); //kushao 2015.11.18 $navbar.find(".sub-nav:visible").hide(); // console.log($navbar.find("a:after").attr("class")); $navbar.find(".nav").children("dd").children("a").children("i").hide(); // charlee 2015.12.5 $logo.addclass("logo-mini"); _self.tooltip(true); } } // 初始化侧栏结束 $navpointer.bind("click", function(){ if($navbar.hasclass("navbar-mini")){ $navbar.removeclass("navbar-mini"); $wrapper.removeclass("wrapper-max"); //kushao 2015.11.18 $navbar.find(".current").find(".sub-nav").show(); $navbar.find(".nav").children("dd").children("a").children("i").show(); // charlee 2015.12.5 $logo.removeclass("logo-mini"); localstorage.setitem("jingshop_nav", "0"); _self.tooltip(false); }else{ $navbar.addclass("navbar-mini"); $wrapper.addclass("wrapper-max"); //kushao 2015.11.18 $navbar.find(".sub-nav:visible").hide(); // console.log($navbar.find("a:after").attr("class")); $navbar.find(".nav").children("dd").children("a").children("i").hide(); // charlee 2015.12.5 $logo.addclass("logo-mini"); _self.tooltip(true); localstorage.setitem("jingshop_nav", "1"); } }); $('#navbar').on('click', '.j-root-menu', function () { $('#navbar .sub-nav').hide(); $(this).siblings('.sub-nav').show(); }); $menupointer.bind("click", function(){ if($menubar.hasclass("menubar-mini")){ $menubar.removeclass("menubar-mini"); $container.removeclass("container-max"); }else{ $menubar.addclass("menubar-mini"); $container.addclass("container-max"); } }); $dropdown.bind("click", function(){ if($(this).hasclass("current")){ $(this).removeclass("current"); }else{ $(this).addclass("current"); } }) this.ini(); } overall.prototype = { ini: function(){ // 超级链接虚线选择 $("a").focus(function(){ $(this).blur(); }); // 多子栏目展示 $(".classify-column .sub").bind("click", function(){ if($(this).hasclass("sub-show")){ $(this).attr({"class":"sub sub-hide"}); var $bind = $(this).parents("tr").attr("bind"); $("tr[ig-bind='"+ $bind +"']").removeattr("style"); }else if($(this).hasclass("sub-hide")){ $(this).attr({"class":"sub sub-show"}); var $bind = $(this).parents("tr").attr("bind"); $("tr[ig-bind='"+ $bind +"']").attr({"style":"display:none;"}); } }); $("#sub-showall").bind("click", function(){ $("tr[ig-bind").removeattr("style"); $(".sub-show").attr({"class":"sub sub-hide"}); }) $("#sub-hideall").bind("click", function(){ $("tr[ig-bind").attr({"style":"display:none;"}); $(".sub-hide").attr({"class":"sub sub-show"}); }) // 金额滚动加载 if($("#moneyscroller").length){ var $moneyscroller = $("#moneyscroller"); function moneypush(money){ var _html = "", _html2 = "", h = 68, arr = money.tostring().split("").reverse(), arr2; for(var i=0; i
0
1
2
3
4
5
6
7
8
9
"; } } $moneyscroller.html(_html2); settimeout(function(){ moneyscroller(money.tostring().length); }, 1000) } function moneyscroller(p){ $moneyscroller.children(".row").each(function(index, element){ $(this).addclass("d").find("dl").css({"top": -$(this).attr("sp"), "transition":"all "+ (2000-index*100) +"ms ease", "":"", "":"", "":""}); }); } $.ajax({ url: "data.json", datatype: "json", type: "post", cache: false, success: function(data){ moneypush(data.money); } }) $("#filter-date span").bind("click", function(){ $(this).addclass("cur").siblings().removeclass("cur"); $.ajax({ url: "data.json", datatype: "json", type: "post", cache: false, success: function(data){ moneypush(data.money); } }) }) } // 引导 //if(!localstorage.getitem("jingshop_step_2.1")){ // $('
').appendto("body"); // var size = $("#ig-step .row").length, // index = 0; // $("#ig-step-button").click(function(){ // if(index < size - 1){ // index ++; // $("#ig-step .row").eq(index).show().siblings(".row").hide(); // }else{ // $("#ig-step").fadeout(500); // settimeout(function(){ // $("ig-step").remove(); // localstorage.setitem("jingshop_step_2.1", "true"); // }, 500) // } // }); //} // 组件 this.plugin(); this.moniud(); this.relink(); this.igmax(); }, igmax: function(){ $('.page-content').on('keyup', '[ig-max-controller]', function () { var color = $(this).val().length > $(this).attr("maxlength") ? "#cc0000" : "#ff0000"; $(this).siblings("[size]").html(" / " + $(this).val().length + " "); }); }, // 2015.12.5 添加tip tooltip: function(bool){ if(bool){ $(".navbar .nav > dd > a").unbind().hover( function(){ $("#igtooltip").text($(this).attr("data-title")).css({"visibility":"visible", "top": ($(this).offset().top + 10), "-webkit-animation":"tooltipleft 0.2s ease both"}); }, function(){ $("#igtooltip").text("").css({"visibility":"hidden", "-webkit-animation":""}); } ) }else{ $(".navbar .nav > dd > a").unbind(); console.log(1); } }, plugin: function(){ // 组件 2015.12.21 $(".page-content").on('click', '.og-radio .item', function(){ if($(this).children('input').is(':checked')){ $(this).addclass('checked').siblings().removeclass('checked'); if($(this).attr('og-show')){ $('#'+ $(this).attr('og-show')).show(); }else if($(this).attr('og-hide')){ $('#'+ $(this).attr('og-hide')).hide(); } } }) $(".page-content").on('click', '.og-checkbox .item', function () { if($(this).children('input').is(':checked')){ $(this).addclass('checked') }else{ $(this).removeclass('checked'); } }) $('[og-tab]').bind('click', function(){ $(this).addclass('checked').siblings('[og-tab]').removeclass('checked'); $('[og-'+ $(this).attr('og-tab') +']').show().siblings().hide(); }) // 颜色色谱 $('.page-content').on('click', '#colpick', function () { var $colpick = $("#colpick"), $colpickval = $("#colpick input"); $colpick.colpick({ layout: "hex", submit: 0, onchange: function (hsb, hex, rgb, el, bysetcolor) { $(el).css("background-color", "#" + hex); if (!bysetcolor) { $colpickval.val("#" + hex); } } }); }); // 图表主题 if(typeof(highcharts) !== "undefined"){ highcharts.createelement('link', { href: '/admin/static/css/google.css', rel: 'stylesheet', type: 'text/css' }, null, document.getelementsbytagname('head')[0]); highcharts.theme = { colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798bf", "#aaeeee", "#ff0066", "#eeaaee", "#55bf3b", "#df5353", "#7798bf", "#aaeeee"], chart: { backgroundcolor: null, style: { fontfamily: "dosis, sans-serif" } }, title: { style: { fontsize: '16px', fontweight: 'bold', texttransform: 'uppercase' } }, tooltip: { borderwidth: 0, backgroundcolor: 'rgba(219,219,216,0.8)', shadow: false }, legend: { itemstyle: { fontweight: 'bold', fontsize: '13px' } }, xaxis: { gridlinewidth: 1, labels: { style: { fontsize: '12px' } } }, yaxis: { minortickinterval: 'auto', title: { style: { texttransform: 'uppercase' } }, labels: { style: { fontsize: '12px' } } }, plotoptions: { candlestick: { linecolor: '#404048' } }, background2: '#f0f0ea' }; highcharts.setoptions(highcharts.theme); } // 图标数据 if($("#chart-order").length){ $(".index-chart .tab dd").click(function(){ $(this).addclass("cur").siblings().removeclass("cur"); var sid = $(this).parent().next().attr("id"); $.ajax({ url: "data2.json", data: { tys: 2 }, datatype: "json", type: "post", success: function(data){ drawchart(data.arr, sid); } }) }); function drawchart(data, sid){ $("#" + sid).highcharts({ title: { text: "", x: -20 //center }, xaxis: { linewidth: 2, linecolor: "#f95348", categories: ['1', '', '3', '', '5', '', '7', '', '9', '', '11', '', '13', '', '15', '', '17', '', '19', '', '21', '', '23', '', '25', '', '27', '', '29', '', '31'], ticklength: 1 }, yaxis: { title: "", min: 0 }, tooltip: { valuesuffix: '' }, legend: { enabled: 0 }, credits: { enabled:0 }, series: [{ name: '订单量', data: data }] }); } // 模拟第一次数据加载 drawchart([70, 69, 95, 145, 182, 115, 252, 265, 233, 183, 319, 916, 916, 296, 196, 916, 710, 69, 95, 145, 182, 215, 252, 215, 233, 113, 139, 96, 96, 96, 96], "chart-order"); drawchart([0, 69, 95, 15, 12, 15, 22, 26, 23, 13, 11, 96, 96, 26, 16, 96, 70, 6, 95, 15, 12, 15, 22, 25, 23, 13, 19, 9, 9, 6, 9], "chart-user"); } // other }, moniud: function(){ // 多选模拟 $('.page-content').on('change', '.ig-checkbox input', function(){ if(this.checked){ $(this).parent().addclass("checked"); if($(this).attr("ig-bind") && $("input[ig-bind='"+ $(this).attr("ig-bind") +"']").length == $("input[ig-bind='"+ $(this).attr("ig-bind") +"']:checked").length){ $(".ig-checkbox .checkall[bind='"+ $(this).attr("ig-bind") +"']").attr({"checked": true}).parent().addclass("checked"); } }else{ $(this).parent().removeclass("checked"); if($(this).attr("ig-bind") && $("input[ig-bind='"+ $(this).attr("ig-bind") +"']").length != $("input[ig-bind='"+ $(this).attr("ig-bind") +"']:checked").length){ $(".ig-checkbox .checkall[bind='"+ $(this).attr("ig-bind") +"']").attr({"checked": false}).parent().removeclass("checked"); } } }); // 全选模拟 $('.page-content').on('change','.ig-checkbox .checkall', function(){ if(this.checked){ $(this).parent().addclass("checked"); $(".ig-checkbox input[ig-bind='"+ $(this).attr("bind") +"']").attr({"checked": true}).parent().addclass("checked"); }else{ $(this).parent().removeclass("checked"); $(".ig-checkbox input[ig-bind='"+ $(this).attr("bind") +"']").attr({"checked": false}).parent().removeclass("checked"); } }); // tab切换 $(".page-content").on('click', '#ig-tab .tab li', function () { $(this).addclass("cur").siblings().removeclass("cur"); $("#ig-tab > .main > .row").eq($(this).index()).show().siblings().hide(); }); $(".page-content").on('click', '#ig-tab-1 .tab li', function () { $(this).addclass("cur").siblings().removeclass("cur"); $("#ig-tab-1 > .main > .row").eq($(this).index()).show().siblings().hide(); }); }, relink: function(){ // 相关数据匹配 $(".form-relink .addall").bind("click", function(){ var _all = $(this).parents(".form-relink").children(".all"), _select = $(this).parents(".form-relink").children(".select"); _select.append(_all.html()); _all.html(""); }) $(".form-relink .delall").bind("click", function(){ var _all = $(this).parents(".form-relink").children(".all"), _select = $(this).parents(".form-relink").children(".select"); _all.append(_select.html()); _select.html(""); }) $(".form-relink .addone").bind("click", function(){ var _all = $(this).parents(".form-relink").children(".all"), _select = $(this).parents(".form-relink").children(".select"), _html = ""; _all.children("option:selected").each(function(index, element){ _html += ""; }); _select.append(_html); _all.children("option:selected").remove(); }) $(".form-relink .delone").bind("click", function(){ var _all = $(this).parents(".form-relink").children(".all"), _select = $(this).parents(".form-relink").children(".select"), _html = ""; _select.children("option:selected").each(function(index, element){ _html += ""; }); _all.append(_html); _select.children("option:selected").remove(); }) } } var overaller = new overall(); function hidediv() { $("#alertmsg").hide(); $("#mybg").hide(); icount = 0; } function showdiv() { $(".clock").html("(" + icount + "秒后自动关闭)"); if (icount > 0) { $("#alertmsg").show(); $("#mybg").show(); icount--; settimeout(function () { showdiv(); }, 1000) } else { hidediv(); } }