diff --git a/f/web-kboss/src/views/login/indexNew.vue b/f/web-kboss/src/views/login/indexNew.vue index c7dde2c..9f961ed 100644 --- a/f/web-kboss/src/views/login/indexNew.vue +++ b/f/web-kboss/src/views/login/indexNew.vue @@ -699,14 +699,14 @@ export default { // 获取手机登录验证码 getCode() { // 验证手机号格式 - if (!this.loginForm.username || !/^1[3-9]\d{9}$/.test(this.loginForm.username)) { + if (!this.loginForm.mobile || !/^1[3-9]\d{9}$/.test(this.loginForm.mobile)) { this.$message.error('请输入正确的手机号'); return; } // 使用新的API参数:mobile和action_type getCodeAPI({ - mobile: this.loginForm.username, + mobile: this.loginForm.mobile, action_type: 'login' }).then((res) => { console.log(res); @@ -815,45 +815,25 @@ export default { this.capsTooltip = key && key.length === 1 && key >= "A" && key <= "Z"; }, - // 处理登录 - 账号登录保持原逻辑不变 + // 处理登录 handleLogin(formName) { this.$refs[formName].validate((valid) => { if (valid) { - // 根据登录类型构建不同的API参数 - let apiOneIphone = { + const loginParams = { username: this.loginForm.username, domain_name: this.photosUrl?.domain_name ? this.photosUrl.domain_name : '', + password: this.passwordEncryption(this.loginForm.password), + mobile: this.loginForm.mobile, vcode: this.loginForm.vcode, codeid: this.loginForm.codeid, wechat_openid: this.wechat_openid } - let apiOne = { - username: this.loginForm.username, - domain_name: this.photosUrl?.domain_name ? this.photosUrl.domain_name : '', - password: this.passwordEncryption(this.loginForm.password), - wechat_openid: this.wechat_openid - } - - let apiTwoIphone = { - username: this.loginForm.username, - vcode: this.loginForm.vcode, - codeid: this.loginForm.codeid, - wechat_openid: this.wechat_openid - } - - let apiTwo = { - username: this.loginForm.username, - password: this.passwordEncryption(this.loginForm.password), - } - - // 根据登录类型调用不同的API - logintypeAPI(this.loginType === '0' ? apiOne : apiOneIphone).then(res => { + logintypeAPI(loginParams).then(res => { if (res.status == true) { this.loading = true; - // 执行登录 this.$store - .dispatch("user/login", this.loginType === '0' ? apiTwo : apiTwoIphone) + .dispatch("user/login", loginParams) .then((res) => { this.loading = false;