Commit 98d9fb76 authored by Asjoker's avatar Asjoker

失敗的登錄

parent 70fdf3dd
# just a flag
ENV = 'development'
# base api
VUE_APP_BASE_API = '/dev-api'
ZD_TEST = '/dev-api'
# workFlow链接地址
# VUE_APP_WORKFLOW = 'http://106.2.17.219:10180'
VUE_APP_WORKFLOW = '/workFlow'
......
......@@ -4,15 +4,17 @@ import request from '@/utils/request'
export function login(username, password, code, uuid) {
const data = {
username,
password,
code,
uuid
password
// code,
// uuid
}
return request({
baseUrl: process.env['VUE_APP_BASE_API'],
url: '/authority/login',
url: '/auth/login',
method: 'post',
data: data
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
}
// 刷新token
......@@ -26,7 +28,7 @@ export function refreshToken(params) {
// 获取用户详细信息
export function getInfo() {
return request({
url: '/authority/getInfo',
url: '/auth/getInfo',
method: 'get'
})
}
......@@ -34,7 +36,7 @@ export function getInfo() {
// 退出方法
export function logout() {
return request({
url: '/authority/logout',
url: '/logout',
method: 'post'
})
}
......@@ -42,7 +44,7 @@ export function logout() {
// 获取验证码
export function getCodeImg() {
return request({
url: '/authority/captchaImage',
url: '/captchaImage',
method: 'get'
})
}
......@@ -12,7 +12,6 @@ const whiteList = ['/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
/* has token*/
if (to.path === '/login') {
......@@ -50,10 +49,7 @@ router.beforeEach((to, from, next) => {
}
})
.catch(err => {
store.dispatch('FedLogOut').then(() => {
Message.error(err)
window.location.href = `${process.env.VUE_APP_LOGIN}?redirect=${to.fullPath}&reLocation=${process.env.VUE_APP_NQ}`
})
})
} else {
next()
......
......@@ -38,10 +38,10 @@ const user = {
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
// const code = userInfo.code
// const uuid = userInfo.uuid
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
login(username, password).then(res => {
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
......
......@@ -19,6 +19,7 @@ const service = axios.create({
// let loadingInstance = ''
// request拦截器
service.interceptors.request.use(config => {
debugger
// 请求开始 loading 开始
/* const loadingCount = store.state.app.loadingCount
console.log(loadingCount)
......@@ -35,7 +36,7 @@ service.interceptors.request.use(config => {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
// 参数发出前统一进行加密 白名单内的不进行加密
console.log(config)
/* console.log(config)
if ((config.baseURL + config.url).indexOf('authority') < 0 && (config.baseURL + config.url).indexOf('internal') < 0) {
console.log(config.params || config.data)
if (config.params) {
......@@ -48,7 +49,7 @@ service.interceptors.request.use(config => {
config.data = Qs.stringify(temp, { arrayFormat: 'indices', allowDots: true })
}
}
}
}*/
return config
}, error => {
console.log(error)
......
......@@ -51,33 +51,42 @@ module.exports = {
// },
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
// target: `http://10.5.87.231:10010/`,
target: `http://zt.91isoft.com:10184/`,
// target: 'http://192.168.1.17:10010/',
// [process.env.VUE_APP_BASE_API]: {
// // target: `http://10.5.87.231:10010/`,
// target: `http://zt.91isoft.com:10184/`,
// // target: 'http://192.168.1.17:10010/',
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_BASE_API]: ''
// }
// },
// [process.env.VUE_APP_WORKFLOW]: {
// target: 'http://zt.91isoft.com:10184/workFlow/',
// // target: 'http://192.168.1.17:10010/workFlow/',
// // target: 'http://10.5.87.231:10010/workFlow/',
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_WORKFLOW]: ''
// }
// },
// [process.env.VUE_APP_INTERNAL]: {
// target: 'http://zt.91isoft.com:10184/internal/',
// // target: 'http://192.168.1.17:10010/internal/',
// // target: 'http://10.5.87.231:10010/internal/',
// changeOrigin: true,
// pathRewrite: {
// ['^' + process.env.VUE_APP_INTERNAL]: ''
// }
// },
[process.env.ZD_TEST]: {
// target: `http://192.168.1.17:10010/internal`,
// target: `http://10.5.87.231:10010/internal`,
target: `http://localhost:8082/`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
['^' + process.env.ZD_TEST]: ''
}
},
[process.env.VUE_APP_WORKFLOW]: {
target: 'http://zt.91isoft.com:10184/workFlow/',
// target: 'http://192.168.1.17:10010/workFlow/',
// target: 'http://10.5.87.231:10010/workFlow/',
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_WORKFLOW]: ''
}
},
[process.env.VUE_APP_INTERNAL]: {
target: 'http://zt.91isoft.com:10184/internal/',
// target: 'http://192.168.1.17:10010/internal/',
// target: 'http://10.5.87.231:10010/internal/',
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_INTERNAL]: ''
}
}
}
},
configureWebpack: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment