diff --git a/yudao-vue-ui/pages/auth/login.vue b/yudao-vue-ui/pages/auth/login.vue index 8667c0da1..f7dc0902f 100644 --- a/yudao-vue-ui/pages/auth/login.vue +++ b/yudao-vue-ui/pages/auth/login.vue @@ -1,52 +1,58 @@ @@ -78,58 +81,63 @@ import {checkStr} from '@/common/js/util' import loginMpWx from './mixin/login-mp-wx.js' import loginAppWx from './mixin/login-app-wx.js' - import loginApple from './mixin/login-apple.js' export default{ - mixins: [loginMpWx, loginAppWx, loginApple], + mixins: [loginMpWx, loginAppWx], data(){ return { - canUseAppleLogin: false, - agreement: true, - username: '', + loginType: 'code', // 登录方式,code 验证码;password 密码 + mobile: '', code: '', + password: '', + agreement: true, } }, onLoad() { - console.log(1); }, methods: { loginSuccessCallBack(data){ - this.$util.msg('登陆成功'); + this.$util.msg('登录成功'); this.$store.commit('setToken', data); setTimeout(()=>{ uni.navigateBack(); }, 1000) }, - //手机号登录 + // 手机号登录 async login(){ - if(!this.agreement){ + // 参数校验 + if (!this.agreement){ this.$util.msg('请阅读并同意用户服务及隐私协议'); this.$refs.confirmBtn.stop(); return; } - const {username, code} = this; - if(!checkStr(username, 'mobile')){ + const {mobile, code, password} = this; + if (!checkStr(mobile, 'mobile')){ this.$util.msg('请输入正确的手机号码'); this.$refs.confirmBtn.stop(); return; } - if(!checkStr(code, 'mobileCode')){ + if (!checkStr(code, 'mobileCode')) { this.$util.msg('验证码错误'); this.$refs.confirmBtn.stop(); return; } - const res = await this.$request('user', 'login', {username,code}); + + // 执行登陆 + const res = await this.$request('user', 'login', {mobile,code}); this.$refs.confirmBtn.stop(); - if(res.status === 1){ + if (res.status === 1){ this.loginSuccessCallBack(res.data); - }else{ + } else{ this.$util.msg(res.msg); } }, navBack(){ uni.navigateBack(); }, + setLoginType(loginType) { + this.loginType = loginType; + }, //同意协议 checkAgreement(){ this.agreement = !this.agreement; @@ -154,7 +162,7 @@ }