|
@@ -1,6 +1,6 @@
|
|
|
var loginPage = new Vue({
|
|
|
el: "#loginPage",
|
|
|
- mixins: [cmSysVitaMixins],
|
|
|
+ mixins: [cmSysVitaMixins,loginMixins],
|
|
|
data: {
|
|
|
maxtime:60,
|
|
|
loginLoading: false,
|
|
@@ -31,71 +31,34 @@ var loginPage = new Vue({
|
|
|
shopId: '',
|
|
|
token:'',
|
|
|
},
|
|
|
- accountParams: {// 账号密码登录
|
|
|
- mobileOrEmail: '', //用户登录账号
|
|
|
- password: '', //用户登录密码
|
|
|
- },
|
|
|
- codeParams:{// 验证码登录
|
|
|
- mobile:'',
|
|
|
- code:''
|
|
|
- },
|
|
|
- smsCodeParams:{// 获取手机短信验证码
|
|
|
- mobile: '', //用户登录手机号
|
|
|
- },
|
|
|
isWeChat: false,
|
|
|
text:'',
|
|
|
stautsfalse:false,
|
|
|
infofalse:false,
|
|
|
isSlideFinishState:true,
|
|
|
- loginTabs:1,
|
|
|
+ loginTabs:0,
|
|
|
mobilCount:0,
|
|
|
mobileCodeText:'获取验证码',
|
|
|
mobilTime:null,
|
|
|
isMobileDisabled:false,
|
|
|
+ slideVerify:null
|
|
|
},
|
|
|
computed: {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
handleTabsClick(index){
|
|
|
+ const _self = this;
|
|
|
this.loginTabs = index;
|
|
|
clearAllErrorTxt($('input'));
|
|
|
+ if(index === 1){
|
|
|
+ this.isSlideFinishState = true
|
|
|
+ this.initSlideVerify()
|
|
|
+ }
|
|
|
},
|
|
|
handleHideBg(){
|
|
|
this.stautsfalse=false;
|
|
|
},
|
|
|
- handleCodeMobileInput(e){// 监听输入手机号
|
|
|
- this.codeParams.mobile = this.smsCodeParams.mobile = e.target.value;
|
|
|
- },
|
|
|
- handleSubLogin(){// 点击登录
|
|
|
- if(this.loginTabs === 0){
|
|
|
- this.userPasswordLogin();
|
|
|
- }else{
|
|
|
- this.userCodeLogin();
|
|
|
- }
|
|
|
- },
|
|
|
- userCodeLogin(){// 短信验证码登录
|
|
|
- const _self = this;
|
|
|
- if (this.loginLoading) { return false; }
|
|
|
- this.$nextTick(function(){
|
|
|
- if (!verifyForm()) { return false; }
|
|
|
- _self.loginLoading = true;
|
|
|
- UserApi.userCodeLogin(_self.codeParams,function(response){
|
|
|
- _self.userUpdataeStatus(response)
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- userPasswordLogin(){// 账号登录
|
|
|
- const _self = this;
|
|
|
- if (this.loginLoading) { return false; }
|
|
|
- this.$nextTick(function(){
|
|
|
- if (!verifyForm()) { return false; }
|
|
|
- _self.loginLoading = true;
|
|
|
- UserApi.PostLoginAccount(_self.accountParams,function(response){
|
|
|
- _self.userUpdataeStatus(response)
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
userUpdataeStatus(response){// 更新登录
|
|
|
const _self = this;
|
|
|
_self.loginLoading = false;
|
|
@@ -146,37 +109,6 @@ var loginPage = new Vue({
|
|
|
CAIMEI.Alert(response.msg,'确定',false);
|
|
|
}
|
|
|
},
|
|
|
- handleMobileCode(){// 点击获取短信验证码
|
|
|
- const _self = this;
|
|
|
- if( this.isMobileDisabled){ return }
|
|
|
- this.$nextTick(function() {
|
|
|
- if (!verifyCheack('.massageBtn')) { return false; }
|
|
|
- UserApi.userLoginCode(_self.smsCodeParams,function (response) {
|
|
|
- if(response.code === 0){
|
|
|
- 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;
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
toQrCodeLogin(){//切换微信登录二维码
|
|
|
const _self = this;
|
|
|
let timeClock = null;
|
|
@@ -333,30 +265,35 @@ var loginPage = new Vue({
|
|
|
information(){
|
|
|
window.location.href='/supplier/information.html';
|
|
|
this.SetSoragesInfo( this.applyUse);
|
|
|
+ },
|
|
|
+ initSlideVerify(){
|
|
|
+ const _self = this
|
|
|
+ this.$nextTick(function (){
|
|
|
+ const SlideVerifyPlug = window.slideVerifyPlug;
|
|
|
+ $('#verify-wrap').html('')
|
|
|
+ const slideVerify = new SlideVerifyPlug('#verify-wrap', {
|
|
|
+ wrapWidth: '350',//设置 容器的宽度 ,不设置的话,会设置成100%,需要自己在外层包层div,设置宽度,这是为了适应方便点;
|
|
|
+ initText: '请向右滑动滑块', //设置 初始的 显示文字
|
|
|
+ sucessText: '验证通过',//设置 验证通过 显示的文字
|
|
|
+ getSuccessState: function (res) {
|
|
|
+ //当验证完成的时候 会 返回 res 值 true,只留了这个应该够用了
|
|
|
+ if (slideVerify.slideFinishState) {
|
|
|
+ $('.value').html(slideVerify.slideFinishState)
|
|
|
+ $('#resetBtn').removeClass('prohibit')
|
|
|
+ _self.isSlideFinishState = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
created: function () {
|
|
|
const userAgent = navigator.userAgent.toLowerCase();
|
|
|
this.isWeChat = userAgent.match(/MicroMessenger/i);
|
|
|
- // this.weChatAutoLogin();
|
|
|
+ this.initSlideVerify();
|
|
|
},
|
|
|
mounted: function () {
|
|
|
const _self = this;
|
|
|
- const SlideVerifyPlug = window.slideVerifyPlug;
|
|
|
- const slideVerify = new SlideVerifyPlug('#verify-wrap', {
|
|
|
- wrapWidth: '350',//设置 容器的宽度 ,不设置的话,会设置成100%,需要自己在外层包层div,设置宽度,这是为了适应方便点;
|
|
|
- initText: '请向右滑动滑块', //设置 初始的 显示文字
|
|
|
- sucessText: '验证通过',//设置 验证通过 显示的文字
|
|
|
- getSuccessState: function (res) {
|
|
|
- //当验证完成的时候 会 返回 res 值 true,只留了这个应该够用了
|
|
|
- console.log(res);
|
|
|
- if (slideVerify.slideFinishState) {
|
|
|
- $('.value').html(slideVerify.slideFinishState)
|
|
|
- $('#resetBtn').removeClass('prohibit')
|
|
|
- _self.isSlideFinishState = false;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
$('body').on("focus",'[needverify]:visible',function(){
|
|
|
$(this).siblings('.errTips').removeClass("show").siblings('.checked').removeClass("show");
|
|
|
});
|