Ejemplo n.º 1
0
			.done(function(jsonData){
				if(jsonData.code == 1){
					artTemplate.compile('tip-success' , jsonData);	
					var html = artTemplate('tip-success' , jsonData);
					$('#tip').prepend(html);
				}else{
					artTemplate.compile('tip-error' , jsonData);	
					var html = artTemplate('tip-error' , jsonData);
					$('#tip').prepend(html);
					
				}
				setTimeout(function(){
					$('.tip-information').remove();	
				} , 1000);
			})
Ejemplo n.º 2
0
			.done(function(data){
				if(data.code == 0){
					layer.allowScroll();
					layer.closeLayer();
				}
				artTemplate.compile('shaidan_with_wangyi' , data);	
				var html = artTemplate('shaidan_with_wangyi' , data);
				$('body').append(html);
			})
Ejemplo n.º 3
0
			.fail(function(){
				var jsonData = {
					'msg': '请求错误'
				}
				artTemplate.compile('tip-error' , jsonData);	
				var html = artTemplate('tip-error' , jsonData);
				$('#tip').prepend(html);
				setTimeout(function(){
					$('.tip-information').remove();	
				} , 1000);
			});
Ejemplo n.º 4
0
        init: function(){
            var me = this,
                ele = $("#"+me.ele),
                qele = $("#"+me.qele),
                eleP = ele.parent(),
                serviceId = eleP.find(".serviceId"),
                questionTxt = eleP.find('.questionTxt'),
                childId = eleP.find(".childId");
            var render = template.compile(tpl);
            //产品分类改变的时候要清空已经选择的问题分类
            qele.bind('change',function(){
                serviceId.val('');
                childId.val('');
                questionTxt.html('');
            });
            if(!me._ChoiceD){
                me._ChoiceD = new Dialog({
                    trigger:"#" + me.ele,
                    width:500,
                    height:450,
                    zIndex:100000,
                });
            }
            me._ChoiceD.before('show',function(){
                var _d = this;
                    _d.set('content', "正在加载问题分类..."),
                    _html = "",
                    curProductId = qele.val(),
                    curProductText = qele.find("option:selected").text();
                    $.ajax({
                        type: "get",
                        dataType : "json",
                        url: "/category/json/popup.json",
                        data:{
                            productId : curProductId
                        },
                        success:function(data){
                            if(data.success){
                                arr = data.data;
                                if(arr.length === 0){
                                    _html = '<div class="catetory-i"><h3 class="title"><b>当前选择的产品:</b><span>'+curProductText+'</span></h3>';
                                    _html += '<p>该产品下暂无问题分类</p></div>';
                                    _d.set('content', _html);
                                    return;
                                }
                                data.productName = curProductText;
                                _html = render(data);
                                _d.set('content', _html);
                                _d.element.find(".catetory-i").niceScroll({cursorborder:"",cursorcolor:"#a4c6ef",boxzoom:false});
                                _d.element.find(".catetory-menu").menuAim({
                                    activate: activateSubmenu,
                                    deactivate: deactivateSubmenu
                                });
                            }
                        },
                        error:function(){
                            _d.set('content', "加载问题分类有误,请重试");
                        }
                    });
            })
        var activateSubmenu =function(row) {
            var $row = $(row),
                submenuId = $row.data("submenuId"),
                $submenu = $row.find('.popover'),
                height = $submenu.outerHeight();
                width = 130;
              $submenu.css({
                display: "block",
                //top: -1,
                left: width + 10,
                height:height
            });
            $row.find("a.stlink").addClass("maintainHover");
        }

        var deactivateSubmenu = function(row) {
            var $row = $(row),
               // submenuId = $row.data("submenuId"),
                $submenu = $row.find('.popover');
            $submenu.css("display", "none");
            $row.find("a.stlink").removeClass("maintainHover");
        }
 
        me._ChoiceD.contentElement.delegate('a','click',function(e){
            e.preventDefault();
            var $this = $(this),
                cid = $this.attr("data-id"),
                pid = $this.attr("data-pid"),
                txt = $this.attr("data-value");
                questionTxt.html(txt);
                me._ChoiceD.hide();
                //给hidden赋值
                serviceId.val(pid);
                childId.val(cid);
                me.serviceVal = pid;
                me.childId = cid;
                if(me.callback){
                   me.callback(pid,cid); 
                }
        });

        }