修改前端的验证码和登录相关的接口

This commit is contained in:
2025-07-12 21:33:22 +08:00
parent 59b4a5e8cf
commit 0a2091adbb
7 changed files with 25 additions and 34 deletions

View File

@ -49,8 +49,9 @@ const user = {
const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
console.log('登录接口返回的数据'+res.data)
setToken(res.data)
commit('SET_TOKEN', res.data)
resolve()
}).catch(error => {
reject(error)
@ -62,14 +63,14 @@ const user = {
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
const user = res.data.user
let avatar = user.avatar || ""
if (!isHttp(avatar)) {
avatar = (isEmpty(avatar)) ? defAva : process.env.VUE_APP_BASE_API + avatar
}
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.data.permissions)
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}

View File

@ -111,10 +111,10 @@ export default {
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.data.captchaEnabled
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img
this.loginForm.uuid = res.uuid
this.codeUrl = "data:image/gif;base64," + res.data.img
this.loginForm.uuid = res.data.uuid
}
})
},

View File

@ -117,8 +117,8 @@ export default {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img
this.registerForm.uuid = res.uuid
this.codeUrl = "data:image/gif;base64," + res.data.img
this.registerForm.uuid = res.data.uuid
}
})
},

View File

@ -9,7 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
const baseUrl = 'http://localhost:8080' // 后端接口
const baseUrl = 'http://localhost:8081' // 后端接口
const port = process.env.port || process.env.npm_config_port || 80 // 端口