From c2648e42f37b7ec24d41bcf00561df4200cd75da Mon Sep 17 00:00:00 2001 From: nyoung <12190070+nyoungo@user.noreply.gitee.com> Date: Thu, 22 Aug 2024 20:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 12 ++++++++-- api/login.js | 35 ++++++++++++++++++++++++---- config.js | 4 ++-- pages/login/login.vue | 54 ++++++++++++++++++++++--------------------- utils/auth.js | 9 +++++++- utils/request.js | 10 ++++++-- 6 files changed, 86 insertions(+), 38 deletions(-) diff --git a/App.vue b/App.vue index acb50b3..e2bfc31 100644 --- a/App.vue +++ b/App.vue @@ -2,14 +2,22 @@ import config from '@/config' import request from './utils/request'; import { - getToken + getToken, + setTenantId } from '@/utils/auth' + import { + getTenantIdByWebsite + } from '@/api/login.js' export default { onLaunch: function() { /*#ifdef MP*/ return /*#endif*/ + + + + if (!getToken()) { return } @@ -106,4 +114,4 @@ body { height: 100%; } - \ No newline at end of file + diff --git a/api/login.js b/api/login.js index ef9d46b..edb5040 100644 --- a/api/login.js +++ b/api/login.js @@ -9,7 +9,7 @@ export function login(username, password, code, uuid) { uuid } return request({ - 'url': '/login', + 'url': '/rescue/login', headers: { isToken: false }, @@ -21,7 +21,7 @@ export function login(username, password, code, uuid) { // 获取用户详细信息 export function getInfo() { return request({ - 'url': '/getInfo', + 'url': '/rescue/getInfo', 'method': 'get' }) } @@ -29,7 +29,7 @@ export function getInfo() { // 退出方法 export function logout() { return request({ - 'url': '/logout', + 'url': '/rescue/logout', 'method': 'post' }) } @@ -37,11 +37,36 @@ export function logout() { // 获取验证码 export function getCodeImg() { return request({ - 'url': '/captchaImage', + 'url': '/rescue/captchaImage', headers: { - isToken: false + isToken: false, }, method: 'get', timeout: 20000 }) } + + +// 获取验证码 +export function loginApp(data) { + return request({ + 'url': '/rescue/loginApp', + headers: { + isToken: false + }, + method: 'post', + timeout: 20000, + data + }) +} + +// 使用租户域名(标识),获得租户编号 +export function getTenantIdByWebsite(website) { + return request({ + url: '/system/tenant/get-by-website', + method: 'get', + params: { + website + } + }) +} \ No newline at end of file diff --git a/config.js b/config.js index 77f6b60..b48b109 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ // 应用全局配置 module.exports = { - baseUrl: 'http://192.168.1.8:48080/admin-api', + baseUrl: 'http://localhost:48080/admin-api', // baseUrl: 'http://47.95.206.185:8011/rescue', //baseUrl: 'http://47.95.206.185:8011/rescue', imagesUrl: 'http://shequ.0315e.com/static/images/pages/', @@ -26,4 +26,4 @@ module.exports = { } ] } -} \ No newline at end of file +} diff --git a/pages/login/login.vue b/pages/login/login.vue index 789357f..37956f8 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -80,12 +80,16 @@