|
|
@ -142,11 +142,13 @@ import debounce from 'lodash/debounce' |
|
|
|
import { messages } from '@/i18n' |
|
|
|
import { getUUID } from '@/utils' |
|
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
|
import JSEncrypt from 'jsencrypt'//引入加密 |
|
|
|
|
|
|
|
let loading // 加载动画 |
|
|
|
export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
pubKey: null, // 获取到公钥 |
|
|
|
isShowLogin: true, |
|
|
|
i18nMessages: messages, |
|
|
|
captchaPath: '', |
|
|
@ -191,11 +193,24 @@ export default { |
|
|
|
this.getAutoLogin(this.$route.query.platformToken) |
|
|
|
}else{ |
|
|
|
this.getCaptcha() |
|
|
|
localStorage.remove('showHeader') |
|
|
|
//获取公钥 |
|
|
|
this.getPubKey() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
// 获取公钥 |
|
|
|
getPubKey() { |
|
|
|
this.$http.post('/auth/govweb/getKey').then(({data: res}) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
|
|
|
|
this.pubKey = res.data; // 获取到公钥; |
|
|
|
console.log("pubkey", this.pubKey); |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取验证码 |
|
|
|
getCaptcha () { |
|
|
|
this.dataForm.uuid = getUUID() |
|
|
@ -236,7 +251,6 @@ export default { |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
// 平阴联动 自动登录接口 |
|
|
@ -255,7 +269,8 @@ export default { |
|
|
|
localStorage.setItem('showHeader', '0') |
|
|
|
Cookies.set('token', res.data.token) |
|
|
|
this.$router.replace({name: 'home'}) |
|
|
|
}).catch(() => { }) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
// epmet-ext9.elinkservice.cn/platform-admin |
|
|
|
}, |
|
|
|
//选择客户 |
|
|
@ -267,6 +282,9 @@ export default { |
|
|
|
const url = '/auth/govweb/login' |
|
|
|
this.dataForm.customerId = row.customerId |
|
|
|
|
|
|
|
console.log('password pre', this.dataForm.password); |
|
|
|
this.dataForm.password = this.encryptedData(this.pubKey, this.dataForm.password); |
|
|
|
console.log('password after', this.dataForm.password); |
|
|
|
this.$http.post(url, this.dataForm).then(({data: res}) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
this.getCaptcha() |
|
|
@ -278,7 +296,8 @@ export default { |
|
|
|
|
|
|
|
Cookies.set('token', res.data.token) |
|
|
|
this.$router.replace({name: 'home'}) |
|
|
|
}).catch(() => { }) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
this.endLoading() |
|
|
|
|
|
|
|
}, |
|
|
@ -301,8 +320,17 @@ export default { |
|
|
|
if (loading) { |
|
|
|
loading.close() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 加密 |
|
|
|
encryptedData(key, data) { |
|
|
|
debugger |
|
|
|
// 新建JSEncrypt对象 |
|
|
|
let encryptor = new JSEncrypt(); |
|
|
|
// 设置公钥 |
|
|
|
encryptor.setPublicKey(key); |
|
|
|
// 加密数据 |
|
|
|
return encryptor.encrypt(data); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|