|
@ -142,11 +142,13 @@ import debounce from 'lodash/debounce' |
|
|
import { messages } from '@/i18n' |
|
|
import { messages } from '@/i18n' |
|
|
import { getUUID } from '@/utils' |
|
|
import { getUUID } from '@/utils' |
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
|
|
|
import JSEncrypt from 'jsencrypt'//引入加密 |
|
|
|
|
|
|
|
|
let loading // 加载动画 |
|
|
let loading // 加载动画 |
|
|
export default { |
|
|
export default { |
|
|
data () { |
|
|
data () { |
|
|
return { |
|
|
return { |
|
|
|
|
|
pubKey: null, // 获取到公钥 |
|
|
isShowLogin: true, |
|
|
isShowLogin: true, |
|
|
i18nMessages: messages, |
|
|
i18nMessages: messages, |
|
|
captchaPath: '', |
|
|
captchaPath: '', |
|
@ -191,18 +193,31 @@ export default { |
|
|
this.getAutoLogin(this.$route.query.platformToken) |
|
|
this.getAutoLogin(this.$route.query.platformToken) |
|
|
}else{ |
|
|
}else{ |
|
|
this.getCaptcha() |
|
|
this.getCaptcha() |
|
|
localStorage.remove('showHeader') |
|
|
//获取公钥 |
|
|
|
|
|
this.getPubKey() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
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 () { |
|
|
getCaptcha () { |
|
|
this.dataForm.uuid = getUUID() |
|
|
this.dataForm.uuid = getUUID() |
|
|
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/auth/login/captcha?uuid=${this.dataForm.uuid}` |
|
|
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/auth/login/captcha?uuid=${this.dataForm.uuid}` |
|
|
}, |
|
|
}, |
|
|
// 表单提交 |
|
|
// 表单提交 |
|
|
dataFormSubmitHandle () { |
|
|
dataFormSubmitHandle() { |
|
|
this.$refs['dataForm'].validate((valid, messageObj) => { |
|
|
this.$refs['dataForm'].validate((valid, messageObj) => { |
|
|
if (!valid) { |
|
|
if (!valid) { |
|
|
app.util.validateRule(messageObj) |
|
|
app.util.validateRule(messageObj) |
|
@ -214,38 +229,37 @@ export default { |
|
|
phone: this.dataForm.phone |
|
|
phone: this.dataForm.phone |
|
|
} |
|
|
} |
|
|
window.app.ajax.post( |
|
|
window.app.ajax.post( |
|
|
url, params, |
|
|
url, params, |
|
|
(data, rspMsg) => { |
|
|
(data, rspMsg) => { |
|
|
|
|
|
|
|
|
if (data.length === 0) {//没有客户,提示无法登录 |
|
|
|
|
|
this.$message.error('账号不存在') |
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
} else if (data.length === 1) { |
|
|
|
|
|
this.selectCustomer(data[0]) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
this.diaVisible = true |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.tableData = data |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
(rspMsg, data) => { |
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
this.$message.error(rspMsg) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data.length === 0) {//没有客户,提示无法登录 |
|
|
|
|
|
this.$message.error('账号不存在') |
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
} else if (data.length === 1) { |
|
|
|
|
|
this.selectCustomer(data[0]) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
this.diaVisible = true |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.tableData = data |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
(rspMsg, data) => { |
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
this.$message.error(rspMsg) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 平阴联动 自动登录接口 |
|
|
// 平阴联动 自动登录接口 |
|
|
getAutoLogin (platformToken) { |
|
|
getAutoLogin(platformToken) { |
|
|
this.dataForm.thirdToken = platformToken; |
|
|
this.dataForm.thirdToken = platformToken; |
|
|
this.dataForm.platform = "pyld"; |
|
|
this.dataForm.platform = "pyld"; |
|
|
this.$http.post(`/auth/sso/oper/third/login`,this.dataForm).then(({ data: res }) => { |
|
|
this.$http.post(`/auth/sso/oper/third/login`, this.dataForm).then(({data: res}) => { |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
if(res.code == 8302){ |
|
|
if (res.code == 8302) { |
|
|
return this.$message.error(res.internalMsg) |
|
|
return this.$message.error(res.internalMsg) |
|
|
} |
|
|
} |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
@ -254,12 +268,13 @@ export default { |
|
|
localStorage.setItem('userType', 'work') |
|
|
localStorage.setItem('userType', 'work') |
|
|
localStorage.setItem('showHeader', '0') |
|
|
localStorage.setItem('showHeader', '0') |
|
|
Cookies.set('token', res.data.token) |
|
|
Cookies.set('token', res.data.token) |
|
|
this.$router.replace({ name: 'home' }) |
|
|
this.$router.replace({name: 'home'}) |
|
|
}).catch(() => { }) |
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
// epmet-ext9.elinkservice.cn/platform-admin |
|
|
// epmet-ext9.elinkservice.cn/platform-admin |
|
|
}, |
|
|
}, |
|
|
//选择客户 |
|
|
//选择客户 |
|
|
selectCustomer (row) { |
|
|
selectCustomer(row) { |
|
|
localStorage.setItem('customerId', row.customerId) |
|
|
localStorage.setItem('customerId', row.customerId) |
|
|
localStorage.setItem('customerName', row.customerName) |
|
|
localStorage.setItem('customerName', row.customerName) |
|
|
this.startLoading() |
|
|
this.startLoading() |
|
@ -267,7 +282,10 @@ export default { |
|
|
const url = '/auth/govweb/login' |
|
|
const url = '/auth/govweb/login' |
|
|
this.dataForm.customerId = row.customerId |
|
|
this.dataForm.customerId = row.customerId |
|
|
|
|
|
|
|
|
this.$http.post(url, this.dataForm).then(({ data: res }) => { |
|
|
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) { |
|
|
if (res.code !== 0) { |
|
|
this.getCaptcha() |
|
|
this.getCaptcha() |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
@ -277,18 +295,19 @@ export default { |
|
|
localStorage.setItem('userType', 'work') |
|
|
localStorage.setItem('userType', 'work') |
|
|
|
|
|
|
|
|
Cookies.set('token', res.data.token) |
|
|
Cookies.set('token', res.data.token) |
|
|
this.$router.replace({ name: 'home' }) |
|
|
this.$router.replace({name: 'home'}) |
|
|
}).catch(() => { }) |
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
this.endLoading() |
|
|
this.endLoading() |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// 取消 |
|
|
// 取消 |
|
|
diaCancel () { |
|
|
diaCancel() { |
|
|
|
|
|
|
|
|
this.diaVisible = false |
|
|
this.diaVisible = false |
|
|
}, |
|
|
}, |
|
|
// 开启加载动画 |
|
|
// 开启加载动画 |
|
|
startLoading () { |
|
|
startLoading() { |
|
|
loading = Loading.service({ |
|
|
loading = Loading.service({ |
|
|
lock: true, // 是否锁定 |
|
|
lock: true, // 是否锁定 |
|
|
text: '正在加载……', // 加载中需要显示的文字 |
|
|
text: '正在加载……', // 加载中需要显示的文字 |
|
@ -296,13 +315,22 @@ export default { |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
// 结束加载动画 |
|
|
// 结束加载动画 |
|
|
endLoading () { |
|
|
endLoading() { |
|
|
// clearTimeout(timer); |
|
|
// clearTimeout(timer); |
|
|
if (loading) { |
|
|
if (loading) { |
|
|
loading.close() |
|
|
loading.close() |
|
|
} |
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 加密 |
|
|
|
|
|
encryptedData(key, data) { |
|
|
|
|
|
debugger |
|
|
|
|
|
// 新建JSEncrypt对象 |
|
|
|
|
|
let encryptor = new JSEncrypt(); |
|
|
|
|
|
// 设置公钥 |
|
|
|
|
|
encryptor.setPublicKey(key); |
|
|
|
|
|
// 加密数据 |
|
|
|
|
|
return encryptor.encrypt(data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|