作者 Cool
1 个管道 的构建 通过 耗费 11 秒

update

define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, undefined, Frontend, Form, Template) {
var validatoroptions = {
invalid: function (form, errors) {
$.each(errors, function (i, j) {
Layer.msg(j);
});
}
};
var Controller = {
index: function () {
Controller.api.nav();
},
register: function () {
//本地验证未通过时提示
$("#register-form").data("validator-options", validatoroptions);
//为表单绑定事件
Form.api.bindevent($("#register-form"), function (data, ret) {
setTimeout(function () {
location.href = ret.url ? ret.url : "/";
}, 1000);
}, function (data) {
$("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
});
},
changepwd: function () {
//本地验证未通过时提示
$("#changepwd-form").data("validator-options", validatoroptions);
//为表单绑定事件
Form.api.bindevent($("#changepwd-form"), function (data, ret) {
setTimeout(function () {
location.href = ret.url ? ret.url : "/";
}, 1000);
});
},
profile: function () {
// 给上传按钮添加上传成功事件
$("#plupload-avatar").data("upload-success", function (data) {
var url = Fast.api.cdnurl(data.url);
$(".profile-user-img").prop("src", url);
Toastr.success(__('Upload successful'));
});
Form.api.bindevent($("#profile-form"));
$(document).on("click", ".btn-change", function () {
var that = this;
var id = $(this).data("type") + "tpl";
var content = Template(id, {});
Layer.open({
type: 1,
title: "修改",
area: ["400px", "250px"],
content: content,
success: function (layero) {
var form = $("form", layero);
Form.api.bindevent(form, function (data) {
location.reload();
Layer.closeAll();
});
}
});
});
},
api: {
nav: function () {
$('#basicInforTab').find('li').click(function () {
window.location.href = $(this).data('href');
});
}
}
};
return Controller;
});
\ No newline at end of file
... ...