Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
ka-op-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
ka-op-ui
Commits
1a89b596
Commit
1a89b596
authored
Sep 18, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加多环境选择
parent
6050bc89
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
83 additions
and
15 deletions
+83
-15
dev.env.js
config/dev.env.js
+2
-2
prod.env.js
config/prod.env.js
+2
-1
k8s.js
src/api/k8s.js
+8
-0
order.js
src/api/order.js
+1
-1
index.js
src/router/index.js
+1
-1
getters.js
src/store/getters.js
+2
-1
index.js
src/store/index.js
+3
-1
env.js
src/store/modules/env.js
+18
-0
request.js
src/utils/request.js
+5
-2
index.vue
src/views/login/index.vue
+37
-3
index.vue
src/views/order/index.vue
+4
-3
No files found.
config/dev.env.js
View file @
1a89b596
...
@@ -4,6 +4,6 @@ const prodEnv = require('./prod.env')
...
@@ -4,6 +4,6 @@ const prodEnv = require('./prod.env')
module
.
exports
=
{
module
.
exports
=
{
NODE_ENV
:
'
"development"
'
,
NODE_ENV
:
'
"development"
'
,
BASE_API
:
'
"http://boss-
ka2.liangkebang.net"
'
,
BASE_API
:
'
"http://boss-
namespace.liangkebang.net"
'
,
// BASE_API: '"http://yapi.quantgroups
.com"',
qaapi
:
'
"http://qaapi.liangkebang
.com"
'
,
}
}
config/prod.env.js
View file @
1a89b596
'
use strict
'
'
use strict
'
module
.
exports
=
{
module
.
exports
=
{
NODE_ENV
:
'
"production"
'
,
NODE_ENV
:
'
"production"
'
,
BASE_API
:
'
"http://boss-ka2.liangkebang.net"
'
,
BASE_API
:
'
"http://boss-namespace.liangkebang.net"
'
,
qaapi
:
'
"http://qaapi.liangkebang.com"
'
,
}
}
src/api/k8s.js
0 → 100644
View file @
1a89b596
import
request
from
'
@/utils/request
'
export
function
fetchKubernetesList
()
{
return
request
({
url
:
'
/k8s/namespace
'
,
method
:
'
get
'
})
}
src/api/order.js
View file @
1a89b596
...
@@ -36,7 +36,7 @@ export function cancelLoan(data) {
...
@@ -36,7 +36,7 @@ export function cancelLoan(data) {
return
request
({
return
request
({
url
:
'
/order/cancel/loan
'
,
url
:
'
/order/cancel/loan
'
,
method
:
'
post
'
,
method
:
'
post
'
,
data
params
:
data
})
})
}
}
...
...
src/router/index.js
View file @
1a89b596
...
@@ -81,7 +81,7 @@ export const constantRouterMap = [
...
@@ -81,7 +81,7 @@ export const constantRouterMap = [
]
]
export
default
new
Router
({
export
default
new
Router
({
// mode: 'history', //
后端支持可开
mode
:
'
history
'
,
//
后端支持可开
scrollBehavior
:
()
=>
({
y
:
0
}),
scrollBehavior
:
()
=>
({
y
:
0
}),
routes
:
constantRouterMap
routes
:
constantRouterMap
})
})
src/store/getters.js
View file @
1a89b596
...
@@ -4,6 +4,7 @@ const getters = {
...
@@ -4,6 +4,7 @@ const getters = {
token
:
state
=>
state
.
user
.
token
,
token
:
state
=>
state
.
user
.
token
,
avatar
:
state
=>
state
.
user
.
avatar
,
avatar
:
state
=>
state
.
user
.
avatar
,
name
:
state
=>
state
.
user
.
name
,
name
:
state
=>
state
.
user
.
name
,
roles
:
state
=>
state
.
user
.
roles
roles
:
state
=>
state
.
user
.
roles
,
env
:
state
=>
state
.
env
.
name
}
}
export
default
getters
export
default
getters
src/store/index.js
View file @
1a89b596
...
@@ -2,6 +2,7 @@ import Vue from 'vue'
...
@@ -2,6 +2,7 @@ import Vue from 'vue'
import
Vuex
from
'
vuex
'
import
Vuex
from
'
vuex
'
import
app
from
'
./modules/app
'
import
app
from
'
./modules/app
'
import
user
from
'
./modules/user
'
import
user
from
'
./modules/user
'
import
env
from
'
./modules/env
'
import
getters
from
'
./getters
'
import
getters
from
'
./getters
'
Vue
.
use
(
Vuex
)
Vue
.
use
(
Vuex
)
...
@@ -9,7 +10,8 @@ Vue.use(Vuex)
...
@@ -9,7 +10,8 @@ Vue.use(Vuex)
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
modules
:
{
modules
:
{
app
,
app
,
user
user
,
env
},
},
getters
getters
})
})
...
...
src/store/modules/env.js
0 → 100644
View file @
1a89b596
const
env
=
{
state
:
{
name
:
'
qaapi
'
},
mutations
:
{
CHANGE_ENV
:
(
state
,
env
)
=>
{
state
.
name
=
env
}
},
actions
:
{
changeEnv
({
commit
},
data
)
{
commit
(
'
CHANGE_ENV
'
,
data
)
}
}
}
export
default
env
src/utils/request.js
View file @
1a89b596
...
@@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth'
...
@@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth'
// 创建axios实例
// 创建axios实例
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
BASE_API
,
// api 的 base_url
//
baseURL: process.env.BASE_API, // api 的 base_url
withCredentials
:
true
,
withCredentials
:
true
,
timeout
:
1000
*
10
// 请求超时时间
timeout
:
1000
*
10
// 请求超时时间
})
})
...
@@ -16,6 +16,9 @@ service.interceptors.request.use(
...
@@ -16,6 +16,9 @@ service.interceptors.request.use(
if
(
store
.
getters
.
token
)
{
if
(
store
.
getters
.
token
)
{
config
.
headers
[
'
SESSION
'
]
=
getToken
()
// 让每个请求携带自定义token 请根据实际情况自行修改
config
.
headers
[
'
SESSION
'
]
=
getToken
()
// 让每个请求携带自定义token 请根据实际情况自行修改
}
}
const
url
=
store
.
getters
.
env
===
'
qaapi
'
?
process
.
env
.
qaapi
:
process
.
env
.
BASE_API
.
replace
(
'
namespace
'
,
store
.
getters
.
env
)
config
.
url
=
url
+
config
.
url
config
.
headers
[
'
cluster
'
]
=
'
qa
'
return
config
return
config
},
},
error
=>
{
error
=>
{
...
@@ -33,7 +36,7 @@ service.interceptors.response.use(
...
@@ -33,7 +36,7 @@ service.interceptors.response.use(
* code为非20000是抛错 可结合自己业务进行修改
* code为非20000是抛错 可结合自己业务进行修改
*/
*/
const
res
=
response
.
data
const
res
=
response
.
data
if
(
res
.
code
!==
200000
)
{
if
(
(
typeof
res
.
code
===
'
number
'
&&
res
.
code
!==
200000
)
||
(
typeof
res
.
code
===
'
string
'
&&
res
.
code
!==
'
0000
'
)
)
{
Message
({
Message
({
message
:
res
.
message
,
message
:
res
.
message
,
type
:
'
error
'
,
type
:
'
error
'
,
...
...
src/views/login/index.vue
View file @
1a89b596
...
@@ -23,6 +23,19 @@
...
@@ -23,6 +23,19 @@
<svg-icon
:icon-class=
"pwdType === 'password' ? 'eye' : 'eye-open'"
/>
<svg-icon
:icon-class=
"pwdType === 'password' ? 'eye' : 'eye-open'"
/>
</span>
</span>
</el-form-item>
</el-form-item>
<el-form-item
prop=
"env"
>
<!--
<span
class=
"svg-container"
>
<svg-icon
icon-class=
"nested"
/>
</span>
-->
<el-select
v-model=
"ns"
filterable
clearable
style=
"width:117%;"
placeholder=
"请选择环境"
@
change=
"changeEnv"
>
<el-option
v-for=
"item in nsArray"
:key=
"item.name"
:label=
"item.name"
:value=
"item.name"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
:loading=
"loading"
type=
"primary"
style=
"width:100%;"
@
click.native.prevent=
"handleLogin"
>
<el-button
:loading=
"loading"
type=
"primary"
style=
"width:100%;"
@
click.native.prevent=
"handleLogin"
>
Sign in
Sign in
...
@@ -37,7 +50,7 @@
...
@@ -37,7 +50,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
// import { isvalidUsername } from '@/utils/validate
'
import
{
fetchKubernetesList
}
from
'
@/api/k8s
'
export
default
{
export
default
{
name
:
'
Login
'
,
name
:
'
Login
'
,
...
@@ -58,7 +71,7 @@ export default {
...
@@ -58,7 +71,7 @@ export default {
// }
// }
return
{
return
{
loginForm
:
{
loginForm
:
{
username
:
'
admin01
'
,
username
:
''
,
password
:
''
password
:
''
},
},
loginRules
:
{
loginRules
:
{
...
@@ -67,7 +80,9 @@ export default {
...
@@ -67,7 +80,9 @@ export default {
},
},
loading
:
false
,
loading
:
false
,
pwdType
:
'
password
'
,
pwdType
:
'
password
'
,
redirect
:
undefined
redirect
:
undefined
,
ns
:
''
,
nsArray
:
[]
}
}
},
},
watch
:
{
watch
:
{
...
@@ -78,7 +93,26 @@ export default {
...
@@ -78,7 +93,26 @@ export default {
immediate
:
true
immediate
:
true
}
}
},
},
created
()
{
this
.
fetchK8sList
()
this
.
$store
.
dispatch
(
'
changeEnv
'
,
'
qaapi
'
)
},
methods
:
{
methods
:
{
fetchK8sList
()
{
fetchKubernetesList
().
then
(
res
=>
{
this
.
nsArray
=
res
.
data
.
namespaces
.
filter
(
i
=>
{
if
(
i
.
name
.
indexOf
(
'
ka
'
)
!==
-
1
)
{
return
i
}
})
})
},
changeEnv
()
{
this
.
$store
.
dispatch
(
'
changeEnv
'
,
this
.
ns
)
sessionStorage
.
setItem
(
'
qahome_env
'
,
this
.
ns
)
},
showPwd
()
{
showPwd
()
{
if
(
this
.
pwdType
===
'
password
'
)
{
if
(
this
.
pwdType
===
'
password
'
)
{
this
.
pwdType
=
''
this
.
pwdType
=
''
...
...
src/views/order/index.vue
View file @
1a89b596
...
@@ -259,7 +259,7 @@ export default {
...
@@ -259,7 +259,7 @@ export default {
this
.
$notify
({
this
.
$notify
({
title
:
'
操作成功
'
,
title
:
'
操作成功
'
,
type
:
'
success
'
,
type
:
'
success
'
,
duration
:
1
000
duration
:
2
000
})
})
})
})
this
.
getOrders
()
this
.
getOrders
()
...
@@ -276,7 +276,7 @@ export default {
...
@@ -276,7 +276,7 @@ export default {
this
.
$notify
({
this
.
$notify
({
title
:
'
操作成功
'
,
title
:
'
操作成功
'
,
type
:
'
success
'
,
type
:
'
success
'
,
duration
:
1
000
duration
:
2
000
})
})
})
})
this
.
getOrders
()
this
.
getOrders
()
...
@@ -287,8 +287,9 @@ export default {
...
@@ -287,8 +287,9 @@ export default {
this
.
$notify
({
this
.
$notify
({
title
:
'
关单完毕
'
,
title
:
'
关单完毕
'
,
type
:
'
success
'
,
type
:
'
success
'
,
duration
:
1
000
duration
:
2
000
})
})
this
.
dialogDeleteVisible
=
false
})
})
this
.
getOrders
()
this
.
getOrders
()
},
},
...
...
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