define("tools/eIndex_dialog", function(require, exports, module) { require("widget/dialog/1.0.0/cube.dialog"); function indexDialog(obj) { this.init.call(this,obj); } indexDialog.prototype = { init: function(obj) { obj=obj?obj:{} this.submitLock = true; this.parent = obj; this.s=new Cube.dialog({ element: this.parent }); if(obj &&Object.prototype.toString.call(obj)=="[object Object]" &&obj[0] &&obj[0].id=="noRepeatDialog")return this.bindEvent(); }, bindEvent: function() { var self = this, p = self.parent, form =p.find("form"), input = form.find("input"), jump=p.find("span"), v, submitBtn = form.find("[node-type=submit]"); input.on("keyup", function(){ v = $.trim(input.val()); if(!v.length) { submitBtn.addClass("disabled"); self.submitLock = true; }else{ submitBtn.removeClass("disabled"); self.submitLock = false; } }); submitBtn.on("click", function(){ if(self.submitLock) return false; self._post(); }); jump.on("click",function(){ //new indexDialog($("#noRepeatDialog")); //location.href="addOrder.html" var _this=this; self.s.close(); new indexDialog($("#noRepeatDialog")); $.ajax({ url:$(_this).attr("action"), data:"", type:"get", dataType:"json", success:function(json){ /*if(json.code==200||true){ self.s.close() new indexDialog($("#noRepeatDialog")); } else if (false){ location.href="addOrder.html" //实名中心 }else{ location.href="addOrder.html" } */ } }); }) }, _post:function(){ var self =this, p = self.parent, form =p.find("form"); $.ajax({ url:form.attr("action"), data:decodeURIComponent(form.serialize()), type:"post", dataType:"json", success:function(t){ if(!t.code){ window.location.href = '/'; }else if(t.code === 302){ window.location.href = t.url; }else if( t.code === 400){ Cube.alert({ title: '合作验证码有误', yesText: "\u91cd\u65b0\u8f93\u5165", content2:'如有疑问请咨询京东金融客服', content:'抱歉,您输入的合作验证码有误。
您可以从京东金融的合作涉农企业处获得合作验证码。', modal: !1 }) }else{ Cube.alert({ title: "提示", content: t.msg }) } } }); } }; module.exports = indexDialog; });