Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
9
91isoft_vue_manage
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨硕
91isoft_vue_manage
Commits
98d9fb76
Commit
98d9fb76
authored
Dec 28, 2020
by
Asjoker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
失敗的登錄
parent
70fdf3dd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
43 deletions
+52
-43
.env.development
.env.development
+2
-1
login.js
src/api/login.js
+11
-9
permission.js
src/permission.js
+1
-5
user.js
src/store/modules/user.js
+3
-3
request.js
src/utils/request.js
+3
-2
vue.config.js
vue.config.js
+32
-23
No files found.
.env.development
View file @
98d9fb76
# 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'
...
...
src/api/login.js
View file @
98d9fb76
...
@@ -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
:
'/auth
ority
/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'
})
})
}
}
src/permission.js
View file @
98d9fb76
...
@@ -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
()
...
...
src/store/modules/user.js
View file @
98d9fb76
...
@@ -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
()
...
...
src/utils/request.js
View file @
98d9fb76
...
@@ -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
)
...
...
vue.config.js
View file @
98d9fb76
...
@@ -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
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment