123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- ;
- var phonePage = new Vue({
- el: "#phonePage",
- data: {
- loginLoading:false,
- count: '', //倒计时
- newCount: '', //倒计时
- codeTime: null,
- codeTimeNew: null,
- mobileCodeText: '获取验证码',
- newMobileCodeText: '获取验证码',
- isMobileDisabled: false, //手机验证码按钮控制
- isNewMobileDisabled: false, //手机验证码按钮控制
- form:{
- mobile:'', //旧联系人手机号
- newMobile:'', //新联系人手机号
- smsCode:'', //原手机号验证码
- newSmsCode:'', //新手机号手机验证码
- userId:0
- },
- rule:{
- phone: '^\\d{6,12}$',
- code: '^\\d{6}$',
- }
- },
- computed: {
- },
- methods: {
- bindMobileCheck:function(){
- var _self = this;
- var pass = verifyForm();
- if (_self.loginLoading) { return false; }
- if (!pass) {return false;}
- _self.loginLoading = true;
- PublicApi.clubChangeMobile(_self.form,function (response) {
- if(response.code === 0){
- CAIMEI.dialog('修改成功~',true,function () {
- _self.loginLoading = false;
- CAIMEI.Storage.clear();
- window.location.href = '/login.html';
- });
- } else {
- CAIMEI.Alert(response.msg,'确定',false);
- _self.loginLoading = false;
- }
- });
- },
- getMobileCodeFn:function(){//获取旧手机号验证码
- var _self = this;
- var params = {
- mobile:_self.form.mobile,
- isCheckCaptcha:1,
- activateCodeType:4,
- platformType:0
- };
- _self.isMobileDisabled = true;
- UserApi.getRegisterMobileCode(params,function(response){
- if(response.code == 0){
- CAIMEI.dialog('验证短信已发送',false,function () {});
- var TIME_COUNT = 60;
- if (!_self.mobilTime) {
- _self.count = TIME_COUNT;
- _self.isMobileDisabled = true;
- _self.codeTime = setInterval(function(){
- if (_self.count > 1 && _self.count <= TIME_COUNT) {
- _self.count--;
- _self.mobileCodeText = _self.count +'s重新发送';
- } else {
- _self.isMobileDisabled = false;
- clearInterval(_self.codeTime);
- _self.codeTime = null;
- _self.mobileCodeText = '获取验证码';
- }
- },1000)
- }
- }else{
- CAIMEI.Alert(response.msg,'确定',false);
- _self.isMobileDisabled = false;
- }
- })
- },
- getNewMobileCodeFn:function(){//获取新手机号短信验证码
- var _self = this;
- var pass = verifyCheack('.massageBtn');
- if (!pass) { return false; }
- var params = {
- mobile:_self.form.newMobile,
- isCheckCaptcha:1,
- activateCodeType:5,
- platformType:0
- };
- _self.isNewMobileDisabled = true;
- UserApi.getRegisterMobileCode(params,function(response){
- if(response.code == 0){
- CAIMEI.dialog('验证短信已发送',false,function () {});
- var TIME_COUNT = 60;
- if (!_self.codeTimeNew) {
- _self.newCount = TIME_COUNT;
- _self.isNewMobileDisabled = true;
- _self.codeTimeNew = setInterval(function(){
- if (_self.newCount > 1 && _self.newCount <= TIME_COUNT) {
- _self.newCount--;
- _self.newMobileCodeText = _self.newCount +'s重新发送';
- } else {
- _self.isNewMobileDisabled = false;
- clearInterval(_self.codeTimeNew);
- _self.codeTimeNew = null;
- _self.newMobileCodeText = '获取验证码';
- }
- },1000)
- }
- }else{
- CAIMEI.Alert(response.msg,'确定',false);
- _self.isNewMobileDisabled = false;
- }
- })
- },
- blurHandle: function(event) { // 失去焦点校验
- var el = event.currentTarget;
- verifyHandle(el);
- }
- },
- created: function () {
- },
- mounted: function () {
- var _self = this;
- if(globalUserData){
- _self.form.mobile = globalUserData.phone;
- _self.form.userId = globalUserData.userId;
- }
- $('.navLayout').find('.navList').removeClass("on").find('.con').hide().find('a').removeClass("on");
- $('.navLayout').find('.navList').eq(2).addClass("on").find('.con').show().find('a').eq(1).addClass("on");
- }
- });
|