From c4efebdba5e00e5e5240a3749887ff9f6aaa920f Mon Sep 17 00:00:00 2001 From: dengbw Date: Fri, 16 Sep 2022 12:00:13 +0800 Subject: [PATCH] market_api_916 --- .env | 2 +- src/api/login/index.js | 2 +- src/api/system/login-record/index.js | 4 ++-- src/api/system/operation-record/index.js | 4 ++-- src/api/system/role/index.js | 4 ++-- src/config/setting.js | 3 ++- src/views/login/index.vue | 25 +++++++++++------------- 7 files changed, 21 insertions(+), 23 deletions(-) diff --git a/.env b/.env index c6f2eea..ee8a3b8 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -VUE_APP_NAME=Ele Admin +VUE_APP_NAME=Market VUE_APP_API_BASE_URL=https://v2.eleadmin.com/api diff --git a/src/api/login/index.js b/src/api/login/index.js index e356f2e..999d07e 100644 --- a/src/api/login/index.js +++ b/src/api/login/index.js @@ -5,7 +5,7 @@ import { setToken } from '@/utils/token-util'; * 登录 */ export async function login(data) { - data.tenantId = 1; // 租户id + //data.tenantId = 1; // 租户id const res = await request.post('/login', data); if (res.data.code === 0) { setToken(res.data.data.access_token, data.remember); diff --git a/src/api/system/login-record/index.js b/src/api/system/login-record/index.js index 3b37e35..9b7f743 100644 --- a/src/api/system/login-record/index.js +++ b/src/api/system/login-record/index.js @@ -5,7 +5,7 @@ import request from '@/utils/request'; * @param params 查询条件 */ export async function pageLoginRecords(params) { - const res = await request.get('/system/login-record/page', { + const res = await request.get('/system/loginRecord/page', { params }); if (res.data.code === 0) { @@ -19,7 +19,7 @@ export async function pageLoginRecords(params) { * @param params 查询条件 */ export async function listLoginRecords(params) { - const res = await request.get('/system/login-record', { + const res = await request.get('/system/loginRecord', { params }); if (res.data.code === 0) { diff --git a/src/api/system/operation-record/index.js b/src/api/system/operation-record/index.js index ba730b0..f0c90ba 100644 --- a/src/api/system/operation-record/index.js +++ b/src/api/system/operation-record/index.js @@ -5,7 +5,7 @@ import request from '@/utils/request'; * @param params 查询条件 */ export async function pageOperationRecords(params) { - const res = await request.get('/system/operation-record/page', { + const res = await request.get('/system/operationRecord/page', { params }); if (res.data.code === 0) { @@ -19,7 +19,7 @@ export async function pageOperationRecords(params) { * @param params 查询条件 */ export async function listOperationRecords(params) { - const res = await request.get('/system/operation-record', { + const res = await request.get('/system/operationRecord', { params }); if (res.data.code === 0) { diff --git a/src/api/system/role/index.js b/src/api/system/role/index.js index 626bee0..c28e2ce 100644 --- a/src/api/system/role/index.js +++ b/src/api/system/role/index.js @@ -83,7 +83,7 @@ export async function removeRoles(data) { * @param roleId 角色id */ export async function listRoleMenus(roleId) { - const res = await request.get('/system/role-menu/' + roleId); + const res = await request.get('/system/roleMenu/' + roleId); if (res.data.code === 0) { return res.data.data; } @@ -96,7 +96,7 @@ export async function listRoleMenus(roleId) { * @param data 菜单id集合 */ export async function updateRoleMenus(roleId, data) { - const res = await request.put('/system/role-menu/' + roleId, data); + const res = await request.put('/system/roleMenu/' + roleId, data); if (res.data.code === 0) { return res.data.message; } diff --git a/src/config/setting.js b/src/config/setting.js index e6e0f1b..f8d2ce8 100644 --- a/src/config/setting.js +++ b/src/config/setting.js @@ -1,5 +1,6 @@ // 接口地址 -export const API_BASE_URL = process.env.VUE_APP_API_BASE_URL; +//export const API_BASE_URL = process.env.VUE_APP_API_BASE_URL; +export const API_BASE_URL = 'http://market.dev.liche.cn/api'; // 项目名称 export const PROJECT_NAME = process.env.VUE_APP_NAME; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index ed70530..e311bb7 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -47,6 +47,11 @@ /> +
{{ $t('login.remember') }} @@ -123,15 +128,14 @@ loading: false, // 表单数据 form: { - username: 'admin', - password: 'admin', + username: '', + password: '', remember: true, - code: '' + code: '', + code_key: '' }, // 验证码base64数据 - captcha: '', - // 验证码内容, 实际项目去掉 - text: '' + captcha: '' }; }, computed: { @@ -171,10 +175,6 @@ if (!valid) { return false; } - if (this.form.code.toLowerCase() !== this.text) { - this.$message.error('验证码错误'); - return; - } this.loading = true; login(this.form) .then((msg) => { @@ -198,10 +198,7 @@ getCaptcha() .then((data) => { this.captcha = data.base64; - // 实际项目后端一般会返回验证码的key而不是直接返回验证码的内容, 登录用key去验证, 可以根据自己后端接口修改 - this.text = data.text; - // 自动回填验证码, 实际项目去掉这个 - this.form.code = this.text; + this.form.code_key = data.code_key; this.$refs?.form?.clearValidate(); }) .catch((e) => {