define("tools/index_dialog", function(require, t, e) { function n() { this.init() } require("widget/dialog/1.0.0/cube.dialog"); n.prototype = { init: function() { this.submitLock = !0; this.parent = $("#applyDialog"); new Cube.dialog({ element: this.parent }); $('#codeInp').val(''); this.bindEvent() }, bindEvent: function() { var t, e = this, n = e.parent, i = n.find("form"), o = i.find("input"), a = i.find("[node-type=submit]"); o.on("keyup", function() { t = $.trim(o.val()); t.length ? (a.removeClass("disabled"), e.submitLock = !1) : (a.addClass("disabled"), e.submitLock = !0) }); a.on("click", function() { return e.submitLock ? !1 : (e._post(), void 0) }); o.on('keydown',function(e){ if(e.keyCode === 13){ $(this).blur(); a.trigger('click'); } }); o.on('input propertychange',function(){ o.trigger('keyup') }) }, _post: function() { var t = this , e = t.parent , n = e.find("form") , a = n.find("[node-type=submit]"); a.addClass('disabled'); t.submitLock = !0; var _trim = n.serialize().replace(/\+/g,''); $.ajax({ url: n.attr("action"), data: decodeURIComponent(_trim), type: "post", 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 }) } } }) } }; e.exports = n });