From bdc4baad110ff46dd86b04c4477182e5257fe619 Mon Sep 17 00:00:00 2001 From: Cool <wx_2566250ef32d4fc38ff1e6e046296c67@git.code.tencent.com> Date: Sat, 3 Jul 2021 09:39:17 +0800 Subject: [PATCH] update --- public/assets/js/frontend/member.js | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+), 0 deletions(-) create mode 100644 public/assets/js/frontend/member.js diff --git a/public/assets/js/frontend/member.js b/public/assets/js/frontend/member.js new file mode 100644 index 0000000..a984fbd --- /dev/null +++ b/public/assets/js/frontend/member.js @@ -0,0 +1,73 @@ +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 -- libgit2 0.24.0