|
- /*
- * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:陈彬彬
- * 日 期:2024.07.12
- * 描 述:解绑微信
- */
-
- var bootstrap = function ($, learun) {
- "use strict";
- var codeType = 'unbindwx', hasSendCode = false, time = 0, timeT = '', isSending = false;
- var lrPage = {
- init: function () {
- lrPage.bind();
- },
- bind: function () {
- // 确认按钮
- $("#confirmUpdate").on('click', function () {
- lrPage.confirmUpdate();
- });
-
- // 发送验证码事件
- $("#sendCode").on('click', function () {
- lrPage.sendCode();
- });
- },
- updating: function (isShow) {
- if (isShow) {
- $('#updatepwBox input').attr('disabled', 'disabled');
- $("#confirmUpdate").addClass('active').attr('disabled', 'disabled').find('span').hide();
- $("#confirmUpdate").css('background', '#eeecec url(/Content/images/Login/loading.gif) no-repeat center 10px');
- }
- else {
- $('#updatepwBox input').removeAttr('disabled');
- $("#confirmUpdate").removeClass('active').removeAttr('disabled').find('span').show();
- $("#confirmUpdate").css('background', '#268fe2');
- }
- },
- sendCode: function () {
- if (isSending || hasSendCode) return;
- $('#updatepwBox .error_info').hide()
- isSending = true
- $.ajax({
- url: top.$.rootUrl + "/Home/Sendcode",
- data: { codeType },
- dataType: 'json',
- type: "post",
- success: (res) => {
- isSending = false;
- if (res.code == 200) {
- $('#updatepwBox .error_info span').text('短信已发送')
- $('#updatepwBox .error_info').show()
-
- hasSendCode = true
- time = 60
- $('#sendCode').text(`重新发送(${time}s)`)
- timeT = setInterval(() => {
- time--
- if (time == 0) {
- hasSendCode = false
- clearInterval(timeT)
- timeT = ''
- }
- $('#sendCode').text(`重新发送${time ? '(' + time + 's' + ')' : ''}`)
- }, 1000);
- } else {
- $('#updatepwBox .error_info span').text(res.info)
- $('#updatepwBox .error_info').show()
- }
- }
- });
- },
- confirmUpdate: async function () {
- let verifycode = $('#verifycode').val()
-
- if (!verifycode) {
- $('#updatepwBox .error_info span').text('请输入验证码')
- $('#updatepwBox .error_info').show()
- return
- }
-
- $('#updatepwBox .error_info').hide()
- lrPage.updating(true);
- $.ajax({
- url: top.$.rootUrl + '/Home/CancelWeiXinBind',
- data: { verifycode, codeType },
- dataType: 'json',
- type: "post",
- success: (res) => {
- if (res.code == 200) {
- $('#updatepwBox .error_info span').text('解绑成功')
- $('#updatepwBox .error_info').show()
- setTimeout(() => {
- learun.layerClose('CancelWeiXinBindForm', '');
- }, 1500)
- } else {
- lrPage.updating(false);
- $('#updatepwBox .error_info span').text(res.info)
- $('#updatepwBox .error_info').show()
- }
- }
- });
- }
- };
- $(function () {
- lrPage.init();
- });
- }
|