Commit 98d9fb76 authored by Asjoker's avatar Asjoker

失敗的登錄

parent 70fdf3dd
# just a flag # just a flag
ENV = 'development' ENV = 'development'
# base api # base api
VUE_APP_BASE_API = '/dev-api' ZD_TEST = '/dev-api'
# workFlow链接地址 # workFlow链接地址
# VUE_APP_WORKFLOW = 'http://106.2.17.219:10180' # VUE_APP_WORKFLOW = 'http://106.2.17.219:10180'
VUE_APP_WORKFLOW = '/workFlow' VUE_APP_WORKFLOW = '/workFlow'
......
...@@ -4,15 +4,17 @@ import request from '@/utils/request' ...@@ -4,15 +4,17 @@ import request from '@/utils/request'
export function login(username, password, code, uuid) { export function login(username, password, code, uuid) {
const data = { const data = {
username, username,
password, password
code, // code,
uuid // uuid
} }
return request({ return request({
baseUrl: process.env['VUE_APP_BASE_API'], url: '/auth/login',
url: '/authority/login',
method: 'post', method: 'post',
data: data data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}) })
} }
// 刷新token // 刷新token
...@@ -26,7 +28,7 @@ export function refreshToken(params) { ...@@ -26,7 +28,7 @@ export function refreshToken(params) {
// 获取用户详细信息 // 获取用户详细信息
export function getInfo() { export function getInfo() {
return request({ return request({
url: '/authority/getInfo', url: '/auth/getInfo',
method: 'get' method: 'get'
}) })
} }
...@@ -34,7 +36,7 @@ export function getInfo() { ...@@ -34,7 +36,7 @@ export function getInfo() {
// 退出方法 // 退出方法
export function logout() { export function logout() {
return request({ return request({
url: '/authority/logout', url: '/logout',
method: 'post' method: 'post'
}) })
} }
...@@ -42,7 +44,7 @@ export function logout() { ...@@ -42,7 +44,7 @@ export function logout() {
// 获取验证码 // 获取验证码
export function getCodeImg() { export function getCodeImg() {
return request({ return request({
url: '/authority/captchaImage', url: '/captchaImage',
method: 'get' method: 'get'
}) })
} }
...@@ -12,7 +12,6 @@ const whiteList = ['/auth-redirect', '/bind', '/register'] ...@@ -12,7 +12,6 @@ const whiteList = ['/auth-redirect', '/bind', '/register']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start()
if (getToken()) { if (getToken()) {
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/login') {
...@@ -50,10 +49,7 @@ router.beforeEach((to, from, next) => { ...@@ -50,10 +49,7 @@ router.beforeEach((to, from, next) => {
} }
}) })
.catch(err => { .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 { } else {
next() next()
......
...@@ -38,10 +38,10 @@ const user = { ...@@ -38,10 +38,10 @@ const user = {
Login({ commit }, userInfo) { Login({ commit }, userInfo) {
const username = userInfo.username.trim() const username = userInfo.username.trim()
const password = userInfo.password const password = userInfo.password
const code = userInfo.code // const code = userInfo.code
const uuid = userInfo.uuid // const uuid = userInfo.uuid
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => { login(username, password).then(res => {
setToken(res.token) setToken(res.token)
commit('SET_TOKEN', res.token) commit('SET_TOKEN', res.token)
resolve() resolve()
......
...@@ -19,6 +19,7 @@ const service = axios.create({ ...@@ -19,6 +19,7 @@ const service = axios.create({
// let loadingInstance = '' // let loadingInstance = ''
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
debugger
// 请求开始 loading 开始 // 请求开始 loading 开始
/* const loadingCount = store.state.app.loadingCount /* const loadingCount = store.state.app.loadingCount
console.log(loadingCount) console.log(loadingCount)
...@@ -35,7 +36,7 @@ service.interceptors.request.use(config => { ...@@ -35,7 +36,7 @@ service.interceptors.request.use(config => {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 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) { if ((config.baseURL + config.url).indexOf('authority') < 0 && (config.baseURL + config.url).indexOf('internal') < 0) {
console.log(config.params || config.data) console.log(config.params || config.data)
if (config.params) { if (config.params) {
...@@ -48,7 +49,7 @@ service.interceptors.request.use(config => { ...@@ -48,7 +49,7 @@ service.interceptors.request.use(config => {
config.data = Qs.stringify(temp, { arrayFormat: 'indices', allowDots: true }) config.data = Qs.stringify(temp, { arrayFormat: 'indices', allowDots: true })
} }
} }
} }*/
return config return config
}, error => { }, error => {
console.log(error) console.log(error)
......
...@@ -51,33 +51,42 @@ module.exports = { ...@@ -51,33 +51,42 @@ module.exports = {
// }, // },
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { // [process.env.VUE_APP_BASE_API]: {
// target: `http://10.5.87.231:10010/`, // // target: `http://10.5.87.231:10010/`,
target: `http://zt.91isoft.com:10184/`, // target: `http://zt.91isoft.com:10184/`,
// target: 'http://192.168.1.17:10010/', // // 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, changeOrigin: true,
pathRewrite: { 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: { 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