Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
multiSystem
Project
Project
Details
Activity
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
Yulun Yao
multiSystem
Commits
09f60e48
Commit
09f60e48
authored
Sep 13, 2021
by
程卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
14c20a6c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
33 deletions
+32
-33
index.js
src/router/index.js
+11
-11
api.js
src/server/api.js
+4
-4
systemDash.vue
src/views/dashboard/systemDash.vue
+4
-3
login.vue
src/views/login.vue
+13
-15
No files found.
src/router/index.js
View file @
09f60e48
...
@@ -12,17 +12,17 @@ const router = new Router({
...
@@ -12,17 +12,17 @@ const router = new Router({
routes
,
routes
,
})
})
//
router.beforeEach((to, from, next) => {
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
//
// TODO
// TODO
//
store.commit('setWebviewSrc', to.meta && to.meta.src) // 判断有src的话为需要嵌入iframe的子项目
//
store.commit('setWebviewSrc', to.meta && to.meta.src) // 判断有src的话为需要嵌入iframe的子项目
//
const token = Cookie.get('token')
const
token
=
Cookie
.
get
(
'token'
)
//
// 当前无token且不在login页面则推到登录页面
// 当前无token且不在login页面则推到登录页面
//
if (to.path != '/login' && !token) {
if
(
to
.
path
!=
'/login'
&&
!
token
)
{
//
next('/login')
next
(
'/login'
)
//
} else {
}
else
{
//
next()
next
()
//
}
}
//
})
})
export
default
router
export
default
router
src/server/api.js
View file @
09f60e48
...
@@ -35,7 +35,7 @@ case 'huangpu-prod':
...
@@ -35,7 +35,7 @@ case 'huangpu-prod':
break
break
case
'production'
:
case
'production'
:
BASE_URL
=
'
/api
'
BASE_URL
=
'
http://yangpu-hm.omniview.pro/api/v2
'
break
break
default
:
// 默认环境下(开发环境)
default
:
// 默认环境下(开发环境)
...
@@ -44,8 +44,8 @@ default: // 默认环境下(开发环境)
...
@@ -44,8 +44,8 @@ default: // 默认环境下(开发环境)
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// WBX_URL = 'https://wbx-uat.omniview.pro/pc'
// WBX_URL = 'https://wbx-uat.omniview.pro/pc'
// BASE_URL = '/api'
// BASE_URL = '/api'
//
BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
BASE_URL
=
'http://yangpu-hm.omniview.pro/api/v2'
BASE_URL
=
'http://www.962121.net/hmfmstest/ifttt'
//
BASE_URL = 'http://www.962121.net/hmfmstest/ifttt'
// BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2'
// BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://211.136.105.193/apiv2'
// BASE_URL = 'http://211.136.105.193/apiv2'
...
@@ -145,7 +145,7 @@ export default {
...
@@ -145,7 +145,7 @@ export default {
// 首页统计列表
// 首页统计列表
GET_RESOURE_LIST
:
'/service-basicdatasync-ddd/resource/count'
,
GET_RESOURE_LIST
:
'/service-basicdatasync-ddd/resource/count'
,
// 首页统计列表
// 首页统计列表
POST_LOGIN
:
'/
api/uaa/oauth/toke
n'
,
POST_LOGIN
:
'/
public/logi
n'
,
// 居委会列表
// 居委会列表
GET_NEI_LIST
:
'/service-basicdatasync-ddd/residentsCommittees'
,
GET_NEI_LIST
:
'/service-basicdatasync-ddd/residentsCommittees'
,
...
...
src/views/dashboard/systemDash.vue
View file @
09f60e48
<
template
>
<
template
>
<div
class=
"routerWapper"
>
<div
class=
"routerWapper"
>
{{
$cookie
.
get
(
'token'
)
}}
<!--
{{
systemList
}}
-->
<!--
{{
systemList
}}
-->
<a-card
title=
"选择登录系统"
style=
"margin: 20px; padding: 20px; height: 100%; border: 2px dashed lightgrey"
>
<a-card
title=
"选择登录系统"
style=
"margin: 20px; padding: 20px; height: 100%; border: 2px dashed lightgrey"
>
<a-card-grid
v-for=
"(item, index) in systemList"
:key=
"index"
style=
"width:25%;text-align:center; height: 80px; cursor: pointer"
@
click=
"loadPage(item)"
>
<a-card-grid
v-for=
"(item, index) in systemList"
:key=
"index"
style=
"width:25%;text-align:center; height: 80px; cursor: pointer"
@
click=
"loadPage(item)"
>
...
@@ -26,12 +27,12 @@ export default {
...
@@ -26,12 +27,12 @@ export default {
},
},
{
{
name
:
'物联网传输协议智能转换平台 V1.0'
,
name
:
'物联网传输协议智能转换平台 V1.0'
,
url
:
'http
://kewei.omniview.pro
'
,
url
:
'http
s://kewei.omniview.pro/web/#/layout/dashboard
'
,
token
:
''
token
:
''
},
},
{
{
name
:
'知识图谱规则引擎软件 V1.0'
,
name
:
'知识图谱规则引擎软件 V1.0'
,
url
:
'http://kw-atlas.omniview.pro
'
,
url
:
'http://kw-atlas.omniview.pro
/demo?token='
+
this
.
$cookie
.
get
(
'token'
)
,
token
:
''
token
:
''
}
}
]
]
...
@@ -39,7 +40,7 @@ export default {
...
@@ -39,7 +40,7 @@ export default {
},
},
methods
:
{
methods
:
{
loadPage
(
webInfo
)
{
loadPage
(
webInfo
)
{
window
.
location
.
href
=
webInfo
.
url
window
.
open
(
webInfo
.
url
)
}
}
},
},
}
}
...
...
src/views/login.vue
View file @
09f60e48
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<h3
style=
"color: #40a9ff;"
>
{{
logoName
}}
</h3>
<h3
style=
"color: #40a9ff;"
>
{{
logoName
}}
</h3>
<a-form
:form=
"form"
>
<a-form
:form=
"form"
>
<a-form-item>
<a-form-item>
<a-input
v-decorator=
"['username',
{ validateTrigger:'blur', rules: [ { required: true,validator: validate} ] }]" placeholder="用户名">
<a-input
autocomplete=
"off"
v-decorator=
"['username',
{ validateTrigger:'blur', rules: [ { required: true,validator: validate} ] }]" placeholder="用户名">
<a-icon
<a-icon
slot=
"prefix"
slot=
"prefix"
type=
"user"
type=
"user"
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
</a-input>
</a-input>
</a-form-item>
</a-form-item>
<a-form-item>
<a-form-item>
<a-input
v-decorator=
"['pwd',
{ validateTrigger:'blur', rules: [ { required: true,validator: validate} ] }]" type="password" placeholder="密码">
<a-input
autocomplete=
"off"
v-decorator=
"['pwd',
{ validateTrigger:'blur', rules: [ { required: true,validator: validate} ] }]" type="password" placeholder="密码">
<a-icon
<a-icon
slot=
"prefix"
slot=
"prefix"
type=
"lock"
type=
"lock"
...
@@ -53,7 +53,7 @@ export default {
...
@@ -53,7 +53,7 @@ export default {
}
}
},
},
created
()
{
created
()
{
//
this.getLogo()
this
.
getLogo
()
},
},
methods
:
{
methods
:
{
getLogo
(){
getLogo
(){
...
@@ -62,7 +62,7 @@ export default {
...
@@ -62,7 +62,7 @@ export default {
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
document
.
title
=
this
.
$com
.
confirm
(
res
,
'data.content.prjName'
,
[])
document
.
title
=
this
.
$com
.
confirm
(
res
,
'data.content.prjName'
,
[])
this
.
logoName
=
this
.
$com
.
confirm
(
res
,
'data.content.prjName'
,
[])
||
'系统登录'
//
this.logoName = this.$com.confirm(res, 'data.content.prjName', []) || '系统登录'
}
}
})
})
},
},
...
@@ -78,29 +78,27 @@ export default {
...
@@ -78,29 +78,27 @@ export default {
this
.
form
.
validateFields
((
err
,
values
)
=>
{
this
.
form
.
validateFields
((
err
,
values
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
const
params
=
{
const
params
=
{
'client_id'
:
this
.
form
.
getFieldValue
(
'username'
),
'username'
:
encryptDes
(
this
.
form
.
getFieldValue
(
'username'
)),
'client_secret'
:
this
.
form
.
getFieldValue
(
'pwd'
),
'pwd'
:
encryptDes
(
this
.
form
.
getFieldValue
(
'pwd'
))
'grant_type'
:
'client_credentials'
}
}
this
.
$ajax
.
post
({
this
.
$ajax
.
post
({
url
:
this
.
$api
.
POST_LOGIN
+
'?client_id='
+
this
.
form
.
getFieldValue
(
'username'
)
+
'&client_secret='
+
this
.
form
.
getFieldValue
(
'pwd'
)
+
'&grant_type=client_credentials'
url
:
this
.
$api
.
POST_LOGIN
,
params
,
}).
then
(
res
=>
{
}).
then
(
res
=>
{
const
store
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'VuexStore'
))
const
store
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'VuexStore'
))
if
(
store
)
store
.
content
=
''
if
(
store
)
store
.
content
=
''
sessionStorage
.
setItem
(
'VuexStore'
,
JSON
.
stringify
(
store
))
sessionStorage
.
setItem
(
'VuexStore'
,
JSON
.
stringify
(
store
))
// 当前登录的账号密码的返回值
// 当前登录的账号密码的返回值
if
(
!!
res
.
access_token
)
{
if
(
res
.
code
==
200
)
{
res
.
token
=
this
.
$com
.
confirm
(
res
,
'data.content'
,
[])
res
.
token
=
this
.
$com
.
confirm
(
res
,
'data.content'
,
[])
console
.
log
(
res
.
access_token
)
// console.log(res.token)
// console.log(res.token)
this
.
$cookie
.
set
(
'token'
,
res
.
access_token
)
this
.
$cookie
.
set
(
'token'
,
'bearer '
+
res
.
token
.
access_token
)
//
this.$cookie.set('userName', res.name) // 存储当前账号的用户名
this
.
$cookie
.
set
(
'userName'
,
res
.
name
)
// 存储当前账号的用户名
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
'/
system/systemList
'
path
:
'/'
})
})
}
else
{
}
else
{
this
.
$message
.
error
(
res
.
error
)
// this.$message.error(res.msg
)
}
}
})
})
}
}
...
...
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