Commit 09f60e48 authored by 程卓's avatar 程卓

登录

parent 14c20a6c
......@@ -12,17 +12,17 @@ const router = new Router({
routes,
})
// router.beforeEach((to, from, next) => {
// // TODO
// store.commit('setWebviewSrc', to.meta && to.meta.src) // 判断有src的话为需要嵌入iframe的子项目
router.beforeEach((to, from, next) => {
// TODO
// store.commit('setWebviewSrc', to.meta && to.meta.src) // 判断有src的话为需要嵌入iframe的子项目
// const token = Cookie.get('token')
// // 当前无token且不在login页面则推到登录页面
// if (to.path != '/login' && !token) {
// next('/login')
// } else {
// next()
// }
// })
const token = Cookie.get('token')
// 当前无token且不在login页面则推到登录页面
if (to.path != '/login' && !token) {
next('/login')
} else {
next()
}
})
export default router
......@@ -35,7 +35,7 @@ case 'huangpu-prod':
break
case 'production':
BASE_URL = '/api'
BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
break
default: // 默认环境下(开发环境)
......@@ -44,8 +44,8 @@ default: // 默认环境下(开发环境)
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// WBX_URL = 'https://wbx-uat.omniview.pro/pc'
// BASE_URL = '/api'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
BASE_URL = 'http://www.962121.net/hmfmstest/ifttt'
BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://www.962121.net/hmfmstest/ifttt'
// BASE_URL = 'http://xuhui.hm.omniview.pro/api/v2'
// BASE_URL = 'http://yangpu-hm.omniview.pro/api/v2'
// BASE_URL = 'http://211.136.105.193/apiv2'
......@@ -145,7 +145,7 @@ export default {
// 首页统计列表
GET_RESOURE_LIST: '/service-basicdatasync-ddd/resource/count',
// 首页统计列表
POST_LOGIN: '/api/uaa/oauth/token',
POST_LOGIN: '/public/login',
// 居委会列表
GET_NEI_LIST: '/service-basicdatasync-ddd/residentsCommittees',
......
<template>
<div class="routerWapper">
{{$cookie.get('token')}}
<!-- {{systemList}} -->
<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)">
......@@ -26,12 +27,12 @@ export default {
},
{
name: '物联网传输协议智能转换平台 V1.0',
url: 'http://kewei.omniview.pro',
url: 'https://kewei.omniview.pro/web/#/layout/dashboard',
token: ''
},
{
name: '知识图谱规则引擎软件 V1.0',
url: 'http://kw-atlas.omniview.pro',
url: 'http://kw-atlas.omniview.pro/demo?token='+this.$cookie.get('token'),
token: ''
}
]
......@@ -39,7 +40,7 @@ export default {
},
methods: {
loadPage(webInfo) {
window.location.href = webInfo.url
window.open(webInfo.url)
}
},
}
......
......@@ -5,7 +5,7 @@
<h3 style="color: #40a9ff;">{{logoName}}</h3>
<a-form :form="form">
<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
slot="prefix"
type="user"
......@@ -14,7 +14,7 @@
</a-input>
</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
slot="prefix"
type="lock"
......@@ -53,7 +53,7 @@ export default {
}
},
created() {
// this.getLogo()
this.getLogo()
},
methods: {
getLogo(){
......@@ -62,7 +62,7 @@ export default {
}).then(res => {
if (res.code==200) {
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 {
this.form.validateFields((err, values) => {
if (!err) {
const params = {
'client_id': this.form.getFieldValue('username'),
'client_secret': this.form.getFieldValue('pwd'),
'grant_type': 'client_credentials'
'username': encryptDes(this.form.getFieldValue('username')),
'pwd': encryptDes(this.form.getFieldValue('pwd'))
}
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 => {
const store = JSON.parse(sessionStorage.getItem('VuexStore'))
if (store) store.content = ''
sessionStorage.setItem('VuexStore', JSON.stringify(store))
// 当前登录的账号密码的返回值
if (!!res.access_token) {
if (res.code == 200) {
res.token = this.$com.confirm(res, 'data.content', [])
console.log(res.access_token)
// console.log(res.token)
this.$cookie.set('token', res.access_token)
// this.$cookie.set('userName', res.name) // 存储当前账号的用户名
this.$cookie.set('token', 'bearer ' + res.token.access_token)
this.$cookie.set('userName', res.name) // 存储当前账号的用户名
this.$router.push({
path: '/system/systemList'
path: '/'
})
} else {
this.$message.error(res.error)
// this.$message.error(res.msg)
}
})
}
......
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