| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, undefined, Frontend, Form, Template) {
- var Controller = {
- login: function () {
- //本地验证未通过时提示
- $("#login-form").data("validator-options", {
- invalid: function (form, errors) {
- $.each(errors, function (i, j) {
- Layer.alert(j);
- });
- },
- });
- //为表单绑定事件
- Form.api.bindevent($("#login-form"), function (data, ret) {
- setTimeout(function () {
- location.href = ret.url ? ret.url : "/";
- }, 1000);
- });
- Form.api.bindevent($("#resetpwd-form"), function (data) {
- Layer.closeAll();
- });
- $(document).on("click", ".btn-forgot", function () {
- var id = "resetpwdtpl";
- var content = Template(id, {});
- Layer.open({
- type: 1,
- title: "修改",
- area: ["450px", "auto"],
- content: content,
- success: function (layero) {
- Form.api.bindevent($("#resetpwd-form", layero), function (data) {
- Layer.closeAll();
- });
- }
- });
- });
- },
- register: function () {
- //本地验证未通过时提示
- $("#register-form").data("validator-options", {
- invalid: function (form, errors) {
- $.each(errors, function (i, j) {
- Layer.alert(j);
- });
- },
- });
- //为表单绑定事件
- Form.api.bindevent($("#register-form"), function (data, ret) {
- setTimeout(function () {
- location.href = ret.url ? ret.url : "/";
- }, 1000);
- });
- },
- changepwd: function () {
- //本地验证未通过时提示
- $("#resetpwd-form").data("validator-options", {
- invalid: function (form, errors) {
- $.each(errors, function (i, j) {
- Layer.alert(j);
- });
- },
- });
- //为表单绑定事件
- 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("上传成功!");
- });
- //为表单绑定事件
- Form.api.bindevent($("#profile-form"), function (data) {
- });
- Form.api.bindevent($("#email-form"), function (data) {
- Layer.closeAll();
- $("#basic-form #email").val($("#email").val());
- });
- Form.api.bindevent($("#mobile-form"), function (data) {
- Layer.closeAll();
- $("#basic-form #mobile").val($("#mobile").val());
- });
- $(document).on("click", ".btn-change", function () {
- var id = $(this).data("type") + "tpl";
- var content = Template(id, {});
- Layer.open({
- type: 1,
- title: "修改",
- area: ["450px", "auto"],
- content: content,
- });
- });
- }
- };
- return Controller;
- });
|