From 4feaab090bf1f9b7f821abe6478e9c017f8e64d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=8A=B2=E9=BE=99?= <2860996570@qq.com> Date: Fri, 27 Oct 2023 11:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/myAPI/login.js | 4 ++-- src/main.js | 18 +++++++++--------- src/utils/request.js | 4 ++-- src/views/index.vue | 5 ++++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/api/myAPI/login.js b/src/api/myAPI/login.js index 438ebc8..7f5179b 100644 --- a/src/api/myAPI/login.js +++ b/src/api/myAPI/login.js @@ -1,9 +1,9 @@ import request from "@/utils/request"; // 本地 -// let api = "API" +let api = "API" // 线上 -let api = location.origin +// let api = location.origin export default { diff --git a/src/main.js b/src/main.js index da41388..565e3d1 100644 --- a/src/main.js +++ b/src/main.js @@ -71,15 +71,15 @@ DictData.install() import { setToken } from '@/utils/auth' // 临时获取token -// let token = async()=>{ -// let Authentication = await API.login.frimLogin(); -// localStorage.setItem( -// "MSSM-LIAONING__TOKEN", -// Authentication.data.result.userToken -// ); - -// } -// token() + let token = async()=>{ + let Authentication = await API.login.frimLogin(); + localStorage.setItem( + "MSSM-LIAONING__TOKEN", + Authentication.data.result.userToken + ); + + } + token() let infor = async()=>{ let response = await API.login.getuserinfo(); localStorage.setItem("userDto", JSON.stringify(response?.result.userDto)); diff --git a/src/utils/request.js b/src/utils/request.js index b881ccf..ba7ecc3 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -15,9 +15,9 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 创建axios实例 const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 - // baseURL: process.env.VUE_APP_BASE_API, + baseURL: process.env.VUE_APP_BASE_API, //!线上 - baseURL:location.origin, + // baseURL:location.origin, // 超时 timeout: 10000 }) diff --git a/src/views/index.vue b/src/views/index.vue index 3b8da63..ed0b268 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -28,7 +28,7 @@ 您好,{{ userName }} - + 退出登录 @@ -167,6 +167,9 @@ export default { } } }, + tuichudengl(){ + location.href = `${location.origin}/login`; + } }, computed: {} }