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

登录

parent 14c20a6c
...@@ -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
...@@ -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/token', POST_LOGIN: '/public/login',
// 居委会列表 // 居委会列表
GET_NEI_LIST: '/service-basicdatasync-ddd/residentsCommittees', GET_NEI_LIST: '/service-basicdatasync-ddd/residentsCommittees',
......
<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: 'https://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)
} }
}, },
} }
......
...@@ -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)
} }
}) })
} }
......
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