From d857e59090c61b9a785ffee84aa18f6f349cdf52 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 25 Oct 2024 14:50:17 +0800 Subject: [PATCH] fix --- src/pages/account/login/index.vue | 48 ++++---- src/pages/allocationReview/records/people.vue | 21 ++-- src/pages/expert/list/index.vue | 4 +- src/pages/setting/list/index.vue | 103 +++++++++--------- src/setting.js | 2 +- 5 files changed, 97 insertions(+), 81 deletions(-) diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index a58d1ac..7de1848 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -9,7 +9,7 @@ - @@ -119,18 +119,17 @@ export default { phoneReg: /^1[3456789]\d{9}$/, mailReg: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, verificationIMG: '', - platform: 4, form: { workNumber: '', account: '', // 手机号验证码模式用这个字段 password: '', code: '', // 验证码 random: '', // 随机数 - platform: 4, + platform: Setting.platformId, distinguish: 1, }, rules: { - account: [{ required: true, message: "请输入手机号", trigger: "blur" }], + account: [{ required: true, message: "请输入手机号/邮箱", trigger: "blur" }], password: [{ required: true, message: "请输入密码", trigger: "blur" }], code: [{ required: true, message: "请输入验证码", trigger: "blur" }] }, @@ -213,7 +212,7 @@ export default { if (accounts && accounts.length) { const expert = accounts.find(e => e.isExpert) // 专家 if (expert && expert.isEnable) { - const res = await this.$post(`${this.api.getToken}?id=${expert.id}&platform=${this.platform}`) + const res = await this.$post(`${this.api.getToken}?id=${expert.id}&platform=${Setting.platformId}`) if (res.data) token = res.data.token } else { return Util.errorMsg('请输入专家账号') @@ -237,7 +236,7 @@ export default { // 验证手机号 verifyPhone (phone) { if (!phone) { - this.$message.error("请输入手机号") + this.$message.error("请输入手机号/邮箱") return false } if (!this.phoneReg.test(phone) && !this.mailReg.test(phone)) { @@ -264,7 +263,7 @@ export default { async sendCodePw () { const { phoneOrEmail } = this.pwForm if (!this.verifyPhone(phoneOrEmail)) return false - const { message } = await this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phoneOrEmail}&loginOrBind=1&platform=${this.platform}`) + const { message } = await this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phoneOrEmail}&loginOrBind=1&platform=${Setting.platformId}`) Util.successMsg(message) this.phoneCountdown() }, @@ -274,7 +273,7 @@ export default { if (valid) { const form = this.pwForm if (form.password !== form.rePassword) return Util.errorMsg('两次输入的密码不一致,请重新输入!') - form.platform = this.platform + form.platform = Setting.platformId this.$post(this.api.forgotPassword, form).then(res => { this.resetPwVisible = false Util.successMsg('密码重置成功!请重新登录。') @@ -285,21 +284,26 @@ export default { // 手机号输入完回调。有账号才能继续操作。type:0手机验证码登录,1重置密码 async checkAccountByPhone (val, type) { - if (!this.phoneReg.test(val) && !this.mailReg.test(val)) { - this.$refs[type ? 'diaPhoneItem' : 'phoneItem'].clearValidate() - this.diaClientMsg = '请输入正确的手机号' - this[type ? 'diaClientExist' : 'verFormEnable'] = false - return false - } + if (val) { + if (!this.phoneReg.test(val) && !this.mailReg.test(val)) { + this.$refs[type ? 'diaPhoneItem' : 'phoneItem'].clearValidate() + this.diaClientMsg = '请输入正确的手机号/邮箱' + this[type ? 'diaClientExist' : 'verFormEnable'] = false + return false + } - try { - const { message } = await this.$get(`${this.api.forgotPreVerification}?phoneOrEmail=${val}&platform=${this.platform}`) - const exist = message === 'success' // 用户已存在 - this[type ? 'diaClientExist' : 'verFormEnable'] = exist - this.diaClientMsg = exist ? '' : message - } catch (e) { + try { + const { message } = await this.$get(`${this.api.forgotPreVerification}?phoneOrEmail=${val}&platform=${Setting.platformId}`) + const exist = message === 'success' // 用户已存在 + this[type ? 'diaClientExist' : 'verFormEnable'] = exist + this.diaClientMsg = exist ? '' : message + } catch (e) { + this[type ? 'diaClientExist' : 'verFormEnable'] = false + this.diaClientMsg = e.message + } + } else { + this.diaClientMsg = '' this[type ? 'diaClientExist' : 'verFormEnable'] = false - this.diaClientMsg = e.message } }, @@ -325,7 +329,7 @@ export default { sendPhoneCodeLogin () { const phone = this.form.account if (!this.verifyPhone(phone)) return false - this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}&loginOrBind=0&platform=${this.platform}`).then(({ message }) => { + this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}&loginOrBind=0&platform=${Setting.platformId}`).then(({ message }) => { Util.successMsg(message) this.phoneCountdownLogin() }).catch(res => { }) diff --git a/src/pages/allocationReview/records/people.vue b/src/pages/allocationReview/records/people.vue index 6383f91..7ab837b 100644 --- a/src/pages/allocationReview/records/people.vue +++ b/src/pages/allocationReview/records/people.vue @@ -27,16 +27,16 @@ @@ -57,15 +57,18 @@