|
@@ -0,0 +1,149 @@
|
|
|
|
+var bindPage = new Vue({
|
|
|
|
+ el: "#bindPage",
|
|
|
|
+ data: {
|
|
|
|
+ loginLoading:false,
|
|
|
|
+ mobilCount:0,
|
|
|
|
+ mobileCodeText:'获取验证码',
|
|
|
|
+ mobilTime:null,
|
|
|
|
+ isMobileDisabled:false,
|
|
|
|
+ isCodeModel:false,
|
|
|
|
+ codeImagePath:'',
|
|
|
|
+ codeImageToken:'',
|
|
|
|
+ imageCode:'',
|
|
|
|
+ user: {
|
|
|
|
+ mobileOrEmail :'',
|
|
|
|
+ password : '',
|
|
|
|
+ mobile : '',
|
|
|
|
+ linkName :'',
|
|
|
|
+ verificationCode :'',
|
|
|
|
+ },
|
|
|
|
+ rule:{
|
|
|
|
+ mobileOrEmail: '(^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$)|(^\\d{6,12}$)',
|
|
|
|
+ name: '^[a-zA-Z\\u4e00-\\u9fa5]{2,}$',
|
|
|
|
+ phone: '^\\d{6,12}$',
|
|
|
|
+ code: '^\\d{6}$',
|
|
|
|
+ password: "^[^\\u4e00-\\u9fa5]{8,16}$"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ BindConfirmFn: function(){ //手机号找回密码
|
|
|
|
+ var _self = this;
|
|
|
|
+ var pass = verifyForm();
|
|
|
|
+ if (_self.loginLoading) { return false; }
|
|
|
|
+ if (!pass) {return false;}
|
|
|
|
+ _self.loginLoading = true;
|
|
|
|
+ UserApi.BindOrganization(_self.user,function (response) {
|
|
|
|
+ if(response.code === 0){
|
|
|
|
+ var _userIdentity = response.data.userIdentity;
|
|
|
|
+ CAIMEI.dialog('绑定成功!',true,true,function () {
|
|
|
|
+ _self.userData = {
|
|
|
|
+ account: response.data.account,
|
|
|
|
+ email: response.data.email,
|
|
|
|
+ phone: response.data.bindMobile,
|
|
|
|
+ name: response.data.name,
|
|
|
|
+ userName: response.data.userName,
|
|
|
|
+ userId: response.data.userID,
|
|
|
|
+ spId: response.data.serviceProviderID,
|
|
|
|
+ clubId: response.data.clubID,
|
|
|
|
+ shopId: response.data.shopID,
|
|
|
|
+ userIdentity: response.data.userIdentity,
|
|
|
|
+ permission: response.data.userPermission,
|
|
|
|
+ token: response.data.token
|
|
|
|
+ };
|
|
|
|
+ _self.setStorages( _self.userData);
|
|
|
|
+ _self.loginLoading = false;
|
|
|
|
+ // 绑定成功后跳转
|
|
|
|
+ if(_userIdentity == 4 || _userIdentity ==2){
|
|
|
|
+ window.location.href = '/user/dashboard.html';
|
|
|
|
+ }else if(_userIdentity == 3){
|
|
|
|
+ window.location.href = '/supplier/dashboard.html';
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
|
+ _self.loginLoading = false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ getMobileImage:function() {//获取图形验证码
|
|
|
|
+ var _self = this;
|
|
|
|
+ var mobile = verifyCheack('.mobileOrEmail');
|
|
|
|
+ var pass = verifyCheack('.massageBtn');
|
|
|
|
+ if (_self.isMobileDisabled) { return false; }
|
|
|
|
+ this.$nextTick(function() {
|
|
|
|
+ if (!mobile) { return false; }
|
|
|
|
+ if (!pass) { return false; }
|
|
|
|
+ PublicApi.getImgVerifyCode({platformType: 0},function(response){
|
|
|
|
+ if(response.code == 0){
|
|
|
|
+ _self.imageCode = '';
|
|
|
|
+ _self.codeImagePath = response.data.baseImage;
|
|
|
|
+ _self.codeImageToken = response.data.token;
|
|
|
|
+ _self.isCodeModel = true;
|
|
|
|
+ }else{
|
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getMobileCodeFn:function(){//机构注册获取注册短信验证码
|
|
|
|
+ var _self = this;
|
|
|
|
+ var params = {
|
|
|
|
+ mobileOrEmail: _self.user.mobileOrEmail,
|
|
|
|
+ mobile:_self.user.mobile,
|
|
|
|
+ imgCode:_self.imageCode,
|
|
|
|
+ token:_self.codeImageToken,
|
|
|
|
+ platformType:0
|
|
|
|
+ };
|
|
|
|
+ _self.isMobileDisabled = true;
|
|
|
|
+ UserApi.getNoteSMScode(params,function (response) {
|
|
|
|
+ if(response.code == 0){
|
|
|
|
+ _self.isCodeModel = false;
|
|
|
|
+ CAIMEI.dialog('验证短信已发送',false,function () {});
|
|
|
|
+ var TIME_COUNT = 60;
|
|
|
|
+ if (!_self.mobilTime) {
|
|
|
|
+ _self.mobilCount = TIME_COUNT;
|
|
|
|
+ _self.isMobileDisabled = true;
|
|
|
|
+ _self.mobilTime = setInterval(function(){
|
|
|
|
+ if (_self.mobilCount > 1 && _self.mobilCount <= TIME_COUNT) {
|
|
|
|
+ _self.mobilCount--;
|
|
|
|
+ _self.mobileCodeText = _self.mobilCount +'s重新发送';
|
|
|
|
+ } else {
|
|
|
|
+ _self.isMobileDisabled = false;
|
|
|
|
+ clearInterval(_self.mobilTime);
|
|
|
|
+ _self.mobilTime = null;
|
|
|
|
+ _self.mobileCodeText = '获取验证码';
|
|
|
|
+ }
|
|
|
|
+ },1000)
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ CAIMEI.Alert(response.msg,'确定',false);
|
|
|
|
+ _self.isMobileDisabled = false;
|
|
|
|
+ _self.isCodeModel = false;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ setStorages:function(data){//存储本地数据
|
|
|
|
+ localStorage.setItem('userInfo',JSON.stringify(data));
|
|
|
|
+ },
|
|
|
|
+ refreshCodeImage:function(){
|
|
|
|
+ this.getMobileImage()
|
|
|
|
+ },
|
|
|
|
+ closeCodeModel:function(){
|
|
|
|
+ this.isCodeModel = false;
|
|
|
|
+ },
|
|
|
|
+ blurHandle: function(event) { // 失去焦点校验
|
|
|
|
+ var el = event.currentTarget;
|
|
|
|
+ verifyHandle(el);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created: function () {
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ mounted: function () {
|
|
|
|
+ var _self = this;
|
|
|
|
+ }
|
|
|
|
+});
|