From 07fe12483a19bb80ff9fa76dd086562dbde9a9f6 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 25 Nov 2021 09:58:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E9=99=86=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E7=99=BB=E9=99=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-vue-ui/pages/auth/login.vue | 223 ++++++++++--------- yudao-vue-ui/pages/auth/mixin/login-apple.js | 83 ------- 2 files changed, 117 insertions(+), 189 deletions(-) delete mode 100644 yudao-vue-ui/pages/auth/mixin/login-apple.js 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 @@ }