feat: 登录接口联调

This commit is contained in:
DEV_DSW
2025-12-23 10:49:04 +08:00
parent 5caa9a5a4b
commit a7ef9ec8ad
10 changed files with 180 additions and 598 deletions

View File

@@ -2,7 +2,7 @@ import axios from 'axios'
import cache from '@utils/cache'
import errorCode from '@constant/errorCode'
import { ElNotification , ElMessageBox, ElMessage } from 'element-plus'
import { getToken } from '@utils/auth'
import { Session } from '@renderer/utils/storage'
import { tansParams } from '@utils/tansParams'
// 获取.env中的服务地址
@@ -28,9 +28,12 @@ instance.interceptors.request.use(
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
const token = Session.getToken();
if (token && !isToken) {
config.headers['Authorization'] = `Bearer ${token}` // 让每个请求携带自定义token 请根据实际情况自行修改
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params)