seaJS实例模板

<span style="font-family: Arial; line-height: 26px; color: rgb(204, 0, 0); font-size: 24px;">~_~一个程序员的淘宝店: </span><a target=_blank target="_blank" href="https://shop115850475.taobao.com/" style="color: rgb(106, 57, 6); text-decoration: none; font-family: Arial; line-height: 26px; font-size: 24px;">点击打开链接</a>

define(function (require, exports, module) {
    require('jquery');
    require('mustache');
    var step = {
        TempTypes: "",
        TempId:1,
        init: function () {
            //列表模板
            step.TempTypes = $("#itemType_Content").html();           
            step.GetServerType(0,1);
         
        },//点击类别背景色
        TypeBackColor: function () {           
            $(".l-body").bind("click", function () {
                $(this).addClass("l-selected");
                $(this).parent().siblings().find("div").removeClass("l-selected");
                //alert($(this).find("input").val());
                var gradFatherID = $(this).parent().parent().attr("id");
                switch (gradFatherID)
                {
                    case "sequenceList1": break;
                    case "sequenceList2": break;
                    case "sequenceList3": break;
                }
                alert(gradFatherID);
            });
        },
        GetServerType: function (tid,divID) {
            //绑定产品
            require.async("sit/product/addProductController", function (mod) {
                mod.GetServerTypes(tid, step.BanderTypeList, divID);
            });
        },
        BanderTypeList: function (serverData, divID) {
            alert(divID);
            var sequence = { "sequence": [] };
            $.each(serverData, function (index, item) {           
                sequence["sequence"].push(item);
            });        
            var output = Mustache.render("{{#sequence}}" + step.TempTypes+ "{{/sequence}}", sequence);
           
            $("#sequenceList1").html(output);
            $("#sequenceList1").show();
            step.TypeBackColor(); 
        }
    }
    return step;
});
define(function (require, exports, module) {
    require('jquery');  
    var step = {       
        GetServerTypes: function (TypeID, backFunction, divID) {
            //查询列表绑定
            var uri = "/product/GetProduct_Type";
            $.ajax({
                type: "post",
                url: uri,
                dataType: "json",
                async: true, //true 异步  false为同步请求 
                data: {
                    strID:TypeID
                },
                success: function (msg) {                  
                    backFunction(msg,divID)
                },
                error: function () {
                    alert("异常");
                },
            });
        }
    }
    return step;
});

~_~一个程序员的淘宝店:  点击打开链接

你可能感兴趣的:(seaJS实例模板)