You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
|
1 year ago
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-mine-changePsw-index"],{2679:function(t,a,o){"use strict";o("7a82"),Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0,o("ac1f"),o("00b4"),o("498a");var e=getApp(),s={data:function(){return{type:1,disabled:1,getmsg:"获取验证码",btnColor:!0,tel:"",pop:0,popErrorMsg:"",newPsw:"",rePsw:""}},onLoad:function(t){t.type&&(console.log("app.globalData.loginUserInfo",e.globalData.loginUserInfo),this.setData({type:t.type,tel:e.globalData.loginUserInfo.tel}),1==t.type?uni.setNavigationBarTitle({title:"设置密码"}):uni.setNavigationBarTitle({title:"修改登录密码"}))},onReady:function(){},onShow:function(){},onHide:function(){},onUnload:function(){},onPullDownRefresh:function(){},onReachBottom:function(){},methods:{changeBtn:function(t){console.log(t),this.verifyTel(t.detail.value)?this.setData({disabled:"1",btnColor:!0,tel:t.detail.value}):this.setData({btnColor:!1,disabled:0})},verifyTel:function(t){console.log(t);return!!/^[1][3456789][0-9]{9}$/.test(t)},verify:function(t,a){return t==a},beforeFormSubmit:function(t){console.log(t),console.log(t.currentTarget.dataset.type),uni.showLoading({title:"提交中",mask:!0,success:function(t){}});var a=t.detail.value;if(1==t.currentTarget.dataset.type){if(a.tel=this.tel,""==a.tel||!this.verifyTel(a.tel))return e.globalData.hideLoad(),void e.globalData.showTips(this,"请输入正确手机号");if(""==a.code)return e.globalData.hideLoad(),void e.globalData.showTips(this,"验证码不能为空");if(""==a.newPsw.trim()||""==a.rePsw.trim())return e.globalData.hideLoad(),void(""==a.newPsw.trim()?e.globalData.showTips(this,"请输入新密码"):e.globalData.showTips(this,"请再次输入密码"));if(!this.verify(a.newPsw.trim(),a.rePsw.trim()))return e.globalData.hideLoad(),void e.globalData.showTips(this,"前后密码不一致");e.globalData.hideLoad(),this.formSubmit(a,1)}else{if(console.log(e.globalData.user),console.log(a),!a.oldPsw)return e.globalData.hideLoad(),console.log(this),void e.globalData.showTips(this,"请输入原密码");if(""==a.newPsw.trim()||""==a.rePsw.trim())return e.globalData.hideLoad(),void(""==a.newPsw.trim()?e.globalData.showTips(this,"请输入新密码"):e.globalData.showTips(this,"请再次输入密码"));if(!this.verify(a.newPsw.trim(),a.rePsw.trim()))return e.globalData.hideLoad(),void e.globalData.showTips(this,"前后密码不一致");this.formSubmit(a,2)}},formSubmit:function(t,a){var o=this;1==a?(console.log(t),uni.request({url:e.globalData.ip+"/yishoudan/updatePassword",data:{tel:t.tel,code:t.code,password:t.newPsw},header:e.globalData.headers,success:function(t){var a=t.data;console.log(a),200==a.status?(e.globalData.showTips(o,"修改成功"),setTimeout((function(){e.globalData.isLogin?uni.navigateBack({target:1,success:function(t){}}):uni.reLaunch({url:"/pages/login/index?type=psw",success:function(t){}})}),2e3)):e.globalData.showTips(o,a.msg)}})):uni.request({url:e.globalData.ip+"/yishoudan/updatePasswordByPwd",data:{tel:e.globalData.user.tel,oldPassword:t.oldPsw,password:t.newPsw},method:"post",header:e.globalData.headers,success:function(t){var a=t.data;console.log(a),200==a.status?(e.globalData.showTips(o,"修改成功"),setTimeout((function(){uni.reLaunch({url:"/pages/login/index?type=psw",success:function(t){}})}),2e3)):(e.globalData.hideLoad(),e.globalData.showTips(o,a.msg))}})},changeType:function(){this.setData({type:1}),uni.setNavigationBarTitle({title:"找回密码"})},sendMsg:function(){console.log(this.tel);var t=this;t.setData({btnColor:!1,disabled:0}),t.getCode();var a=1;if(1==a){a=0;var o=60,e=setInterval((function(){t.setData({getmsg:o+"s",btnColor:!1,disabled:0}),o--,o<0&&(a=1,clearInterval(e),t.setData({getmsg:"重新获取",btnColor:!0,disabled:1}))}),1e3)}},getCode:function(){var t=this;uni.request({url:e.globalData.ip+"/commons/sendMsgCode",data:{tel:t.tel},header:e.globalData.headers,method:"GET",success:function(a){console.log("发送短信验证码"),console.log(a),200==a.data.status?e.globalData.showTips(t,"验证码发送成功"):9999==a.
|