From 3ba5746381bdbc44aca0dbcdebcd65c4f707b988 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 24 Oct 2024 15:07:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=93=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 1 + src/layouts/navbar/index.vue | 3 +- src/pages/account/login/index.vue | 46 ++++++++++--------- src/pages/allocationReview/records/people.vue | 23 +++++++++- src/pages/expert/list/index.vue | 10 ++-- src/pages/setting/list/index.vue | 38 +++++++++++++-- 6 files changed, 86 insertions(+), 35 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 8317ca5..2b2821b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -4,6 +4,7 @@ const { apiBaseURL: host } = Setting export default { login: `/users/users/user/login`, verification: `${host}/users/users/user/captcha`, + getToken: `/users/users/user/getToken`, sendPhoneVerificationCode: `/users/users/user/sendPhoneVerificationCode`, forgotPassword: `/users/users/user/forgotPassword`, forgotPreVerification: `/users/users/user/forgotPreVerification`, diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index c2a6245..4c149b6 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -70,6 +70,8 @@ export default { this.active = '/myReview' } else if (path.includes('allocationReview/')) { this.active = '/allocationReview' + } else { + this.active = '/expert' } }, mounted () { @@ -89,7 +91,6 @@ export default { // 如果开启了动态路由,则取store里的路由匹配 if (Setting.dynamicRoute) { const { btns, defaultMenus: all } = this - console.log("🚀 ~ initMenu ~ btns:", btns) const menus = [all[0]] btns.find(e => e === '分配评阅任务') && menus.push(all[1]) btns.find(e => e === '专家管理') && menus.push(all[2]) diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index 2798b64..a58d1ac 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -201,20 +201,36 @@ export default { // 提交登录 submit () { if (!this.agreeCheck) return Util.errorMsg('请勾选同意,才可继续登录!') - this.$refs.form.validate(valid => { + this.$refs.form.validate(async (valid) => { if (valid) { - const form = JSON.parse(JSON.stringify(this.form)) - this.$post(this.api.login, form).then(({ status, data, message }) => { + const { form } = this + form.distinguish = this.active ? 2 : 1 + try { + const { status, data } = await this.$post(this.api.login, form) + let { userAccounts: accounts, token } = data if (status == 200) { - localStorage.setItem('expert_token', data.token) + // 假如有多个平台的账号 + 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}`) + if (res.data) token = res.data.token + } else { + return Util.errorMsg('请输入专家账号') + } + } else if (!data.isExpert) { + form.code = '' + return Util.errorMsg('专家评阅平台只允许专家账号登录,请重新输入') + } + localStorage.setItem('expert_token', token) Util.successMsg('登录成功') this.$router.replace(`/myReview`) } - }).catch(res => { + } catch (e) { form.code = '' this.getVerImg() - }) + } } }); }, @@ -366,21 +382,10 @@ export default { .agree { width: 500px; + height: 450px; padding-bottom: 20px; - background-color: #062c87; - - /deep/.el-checkbox { - color: #fff; - - .el-checkbox__label { - color: #fff; - } + background-color: #fff; - .el-checkbox__input.is-checked .el-checkbox__inner { - background-color: #cd4c01; - border-color: #cd4c01; - } - } } .agreement { @@ -392,11 +397,9 @@ export default { margin-bottom: 10px; font-size: 20px; font-weight: 600; - color: #fff; } .text { - color: #fff; line-height: 1.6; } @@ -439,6 +442,7 @@ export default { .form { width: 436px; + height: 450px; padding: 20px 38px 50px; border-radius: 6px; background-color: #fff; diff --git a/src/pages/allocationReview/records/people.vue b/src/pages/allocationReview/records/people.vue index 78464e8..6383f91 100644 --- a/src/pages/allocationReview/records/people.vue +++ b/src/pages/allocationReview/records/people.vue @@ -167,9 +167,14 @@ export default { }) }, // 端切换 - userTypeChange () { + userTypeChange (val) { const el = this.$refs.nakadais el && el.setCurrentKey(null) + if (val) { + this.getExpert() + } else { + this.getNakadaiUser() + } }, // 部门点击 depClick (data) { @@ -194,6 +199,22 @@ export default { this.users = list this.getDetail(init) }, + // 查询专家列表 + getExpert () { + this.$post(this.api.expertList, { + type: 1, + pageNum: 1, + pageSize: 1000 + }).then(({ page }) => { + const list = page.records + const { checked } = this + list.forEach(e => { + e.check = !!checked.find(n => n.accountId === e.accountId) + }) + this.users = list + this.getDetail(1) + }).catch(err => { }) + }, // 用户全选回调 userAllCheckChange (val) { diff --git a/src/pages/expert/list/index.vue b/src/pages/expert/list/index.vue index 8a2a93f..467235e 100644 --- a/src/pages/expert/list/index.vue +++ b/src/pages/expert/list/index.vue @@ -97,7 +97,7 @@