|
|
@ -1,93 +1,141 @@ |
|
|
|
<template> |
|
|
|
<div class="g-app"> |
|
|
|
<div class="g-bd" v-if="isShowLogin || true"> |
|
|
|
<div class="m-fm"> |
|
|
|
<div class="wrap"> |
|
|
|
<h2 class="title">{{ $t('brand.work') }}</h2> |
|
|
|
<div class="fm"> |
|
|
|
<el-form |
|
|
|
:model="dataForm" |
|
|
|
:rules="dataRule" |
|
|
|
ref="dataForm" |
|
|
|
@keyup.enter.native="dataFormSubmitHandle()" |
|
|
|
status-icon |
|
|
|
> |
|
|
|
<div class="fm-item"> |
|
|
|
<div class="ico"> |
|
|
|
<img src="@/assets/img/login/zhanghao.png" alt="" /> |
|
|
|
</div> |
|
|
|
<div class="input"> |
|
|
|
<input |
|
|
|
type="text" |
|
|
|
v-model="dataForm.phone" |
|
|
|
placeholder="账号" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="fm-item"> |
|
|
|
<div class="ico"> |
|
|
|
<img src="@/assets/img/login/mima.png" alt="" /> |
|
|
|
</div> |
|
|
|
<div class="input"> |
|
|
|
<input |
|
|
|
type="password" |
|
|
|
v-model="dataForm.password" |
|
|
|
:placeholder="$t('login.password')" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="fm-captcha"> |
|
|
|
<div class="fm-item"> |
|
|
|
<div class="input"> |
|
|
|
<input |
|
|
|
type="text" |
|
|
|
v-model="dataForm.captcha" |
|
|
|
placeholder="验证码" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="captcha"> |
|
|
|
<img :src="captchaPath" @click="getCaptcha()" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="isShowLogin" |
|
|
|
class="aui-wrapper aui-page__login"> |
|
|
|
|
|
|
|
<div class="fm-btn" @click="dataFormSubmitHandle()"> |
|
|
|
{{ $t('login.title') }} |
|
|
|
</div> |
|
|
|
<div class="hint">请使用小程序端的账号密码登录</div> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
<div class="aui-content__wrapper"> |
|
|
|
<main class="aui-content"> |
|
|
|
<div class="login-header"> |
|
|
|
<h2 class="login-brand">{{ $t('brand.work') }}</h2> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="login-body"> |
|
|
|
<h3 class="login-title">{{ $t('login.title') }}</h3> |
|
|
|
<el-form :model="dataForm" |
|
|
|
:rules="dataRule" |
|
|
|
ref="dataForm" |
|
|
|
@keyup.enter.native="dataFormSubmitHandle()" |
|
|
|
status-icon> |
|
|
|
<!-- <el-form-item> |
|
|
|
<el-select v-model="$i18n.locale" |
|
|
|
class="w-percent-100"> |
|
|
|
<el-option v-for="(val, key) in i18nMessages" |
|
|
|
:key="key" |
|
|
|
:label="val._lang" |
|
|
|
:value="key"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> --> |
|
|
|
<el-form-item prop="phone"> |
|
|
|
<el-input v-model="dataForm.phone" |
|
|
|
placeholder="手机号"> |
|
|
|
<span slot="prefix" |
|
|
|
class="el-input__icon"> |
|
|
|
<svg class="icon-svg" |
|
|
|
aria-hidden="true"> |
|
|
|
<use xlink:href="#icon-user"></use> |
|
|
|
</svg> |
|
|
|
</span> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="password"> |
|
|
|
<el-input v-model="dataForm.password" |
|
|
|
type="password" |
|
|
|
:placeholder="$t('login.password')"> |
|
|
|
<span slot="prefix" |
|
|
|
class="el-input__icon"> |
|
|
|
<svg class="icon-svg" |
|
|
|
aria-hidden="true"> |
|
|
|
<use xlink:href="#icon-lock"></use> |
|
|
|
</svg> |
|
|
|
</span> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="captcha"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="14"> |
|
|
|
<el-input v-model="dataForm.captcha" |
|
|
|
:placeholder="$t('login.captcha')"> |
|
|
|
<span slot="prefix" |
|
|
|
class="el-input__icon"> |
|
|
|
<svg class="icon-svg" |
|
|
|
aria-hidden="true"> |
|
|
|
<use xlink:href="#icon-safetycertificate"></use> |
|
|
|
</svg> |
|
|
|
</span> |
|
|
|
</el-input> |
|
|
|
</el-col> |
|
|
|
<el-col :span="10" |
|
|
|
class="login-captcha"> |
|
|
|
<img :src="captchaPath" |
|
|
|
@click="getCaptcha()"> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" |
|
|
|
@click="dataFormSubmitHandle()" |
|
|
|
class="w-percent-100">{{ $t('login.title') }}</el-button> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
<div class="div_tip"> |
|
|
|
<p class="p_tip"> |
|
|
|
{{ '请使用小程序端的账号密码登录'}} |
|
|
|
</p> |
|
|
|
|
|
|
|
<div class="m-footer"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="login-footer"> |
|
|
|
<p> |
|
|
|
<a href="" target="_blank">{{ $t('login.copyright') }}</a> |
|
|
|
<a href="https://demo.cloud.renren.io/renren-cloud" |
|
|
|
target="_blank">{{ $t('login.demo') }}</a> |
|
|
|
</p> |
|
|
|
<!-- 2020 © renren.io --> |
|
|
|
<p><a href="https://www.renren.io/" |
|
|
|
target="_blank">{{ $t('login.copyright') }}</a></p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</main> |
|
|
|
</div> |
|
|
|
|
|
|
|
<c-dialog |
|
|
|
:showFooter="false" |
|
|
|
:title="'选择客户'" |
|
|
|
:isNest="false" |
|
|
|
:visible="diaVisible" |
|
|
|
:dialogHeight="0.8" |
|
|
|
:width="30" |
|
|
|
:top="'120px'" |
|
|
|
@cancel="diaCancel" |
|
|
|
> |
|
|
|
<c-dialog :showFooter='false' |
|
|
|
:title="'选择客户'" |
|
|
|
:isNest="false" |
|
|
|
:visible="diaVisible" |
|
|
|
:dialogHeight="0.8" |
|
|
|
:width="30" |
|
|
|
:top="'120px'" |
|
|
|
@cancel="diaCancel"> |
|
|
|
<!-- <div class="div_total"> --> |
|
|
|
<div v-for="(item, index) in tableData" :key="index" class="div_row"> |
|
|
|
<span @click="selectCustomer(item)" class="span_name">{{ |
|
|
|
item.customerName |
|
|
|
}}</span> |
|
|
|
<div v-for="(item,index) in tableData" |
|
|
|
:key=index |
|
|
|
class="div_row"> |
|
|
|
<span @click="selectCustomer(item)" |
|
|
|
class="span_name">{{item.customerName}}</span> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- </div> --> |
|
|
|
<!-- <el-table v-loading="tableLoading" |
|
|
|
:data="tableData" |
|
|
|
border |
|
|
|
style="width: 100%;"> |
|
|
|
|
|
|
|
<el-table-column prop="customerName" |
|
|
|
label="客户名称" |
|
|
|
header-align="left" |
|
|
|
align="left" |
|
|
|
width="300"></el-table-column> |
|
|
|
<el-table-column label="操作" |
|
|
|
fixed="right" |
|
|
|
header-align="right" |
|
|
|
align="right"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button size="small" |
|
|
|
@click="selectCustomer(scope.row)">选择</el-button> |
|
|
|
|
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> --> |
|
|
|
</c-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import Cookies from 'js-cookie' |
|
|
|
import CDialog from '@c/CDialog' |
|
|
@ -95,11 +143,11 @@ import debounce from 'lodash/debounce' |
|
|
|
import { messages } from '@/i18n' |
|
|
|
import { getUUID } from '@/utils' |
|
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
|
import JSEncrypt from 'jsencrypt' //引入加密 |
|
|
|
import JSEncrypt from 'jsencrypt'//引入加密 |
|
|
|
|
|
|
|
let loading // 加载动画 |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
pubKey: null, // 获取到公钥 |
|
|
|
isShowLogin: true, |
|
|
@ -125,9 +173,11 @@ export default { |
|
|
|
CDialog |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
dataRule() { |
|
|
|
dataRule () { |
|
|
|
return { |
|
|
|
phone: [{ required: true, message: '手机号不能为空', trigger: 'blur' }], |
|
|
|
phone: [ |
|
|
|
{ required: true, message: '手机号不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
|
password: [ |
|
|
|
{ required: true, message: '密码不能为空', trigger: 'blur' } |
|
|
|
], |
|
|
@ -137,10 +187,10 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
created () { |
|
|
|
//平阴联动平台 登陆 |
|
|
|
if (this.$route.query.platformToken) { |
|
|
|
this.isShowLogin = false |
|
|
|
this.isShowLogin = false; |
|
|
|
this.getAutoLogin(this.$route.query.platformToken) |
|
|
|
} else { |
|
|
|
this.getCaptcha() |
|
|
@ -148,31 +198,29 @@ export default { |
|
|
|
this.getPubKey() |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
localStorage.removeItem('showHeader') |
|
|
|
mounted () { |
|
|
|
localStorage.removeItem('showHeader'); |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
// 获取公钥 |
|
|
|
getPubKey() { |
|
|
|
this.$http |
|
|
|
.post('/auth/govweb/getKey') |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
getPubKey () { |
|
|
|
this.$http.post('/auth/govweb/getKey').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
|
|
|
|
this.pubKey = res.data // 获取到公钥; |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
this.pubKey = res.data; // 获取到公钥; |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取验证码 |
|
|
|
getCaptcha() { |
|
|
|
getCaptcha () { |
|
|
|
this.dataForm.uuid = getUUID() |
|
|
|
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/auth/login/captcha?uuid=${this.dataForm.uuid}` |
|
|
|
}, |
|
|
|
// 表单提交 |
|
|
|
dataFormSubmitHandle() { |
|
|
|
dataFormSubmitHandle () { |
|
|
|
this.$refs['dataForm'].validate((valid, messageObj) => { |
|
|
|
if (!valid) { |
|
|
|
app.util.validateRule(messageObj) |
|
|
@ -184,11 +232,10 @@ export default { |
|
|
|
phone: this.dataForm.phone |
|
|
|
} |
|
|
|
window.app.ajax.post( |
|
|
|
url, |
|
|
|
params, |
|
|
|
url, params, |
|
|
|
(data, rspMsg) => { |
|
|
|
if (data.length === 0) { |
|
|
|
//没有客户,提示无法登录 |
|
|
|
|
|
|
|
if (data.length === 0) {//没有客户,提示无法登录 |
|
|
|
this.$message.error('账号不存在') |
|
|
|
this.endLoading() |
|
|
|
} else if (data.length === 1) { |
|
|
@ -204,66 +251,65 @@ export default { |
|
|
|
(rspMsg, data) => { |
|
|
|
this.endLoading() |
|
|
|
this.$message.error(rspMsg) |
|
|
|
} |
|
|
|
) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
// 平阴联动 自动登录接口 |
|
|
|
getAutoLogin(platformToken) { |
|
|
|
this.dataForm.thirdToken = platformToken |
|
|
|
this.dataForm.platform = 'pyld' |
|
|
|
this.$http |
|
|
|
.post(`/auth/sso/oper/third/login`, this.dataForm) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
if (res.code == 8302) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
getAutoLogin (platformToken) { |
|
|
|
this.dataForm.thirdToken = platformToken; |
|
|
|
this.dataForm.platform = "pyld"; |
|
|
|
this.$http.post(`/auth/sso/oper/third/login`, this.dataForm).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
if (res.code == 8302) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
localStorage.setItem('customerId', res.data.customerId) |
|
|
|
localStorage.setItem('userType', 'work') |
|
|
|
localStorage.setItem('showHeader', '0') |
|
|
|
Cookies.set('token', res.data.token) |
|
|
|
this.$router.replace({ name: 'home' }) |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
localStorage.setItem('customerId', res.data.customerId) |
|
|
|
localStorage.setItem('userType', 'work') |
|
|
|
localStorage.setItem('showHeader', '0') |
|
|
|
Cookies.set('token', res.data.token) |
|
|
|
this.$router.replace({ name: 'home' }) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
// epmet-ext9.elinkservice.cn/platform-admin |
|
|
|
}, |
|
|
|
//选择客户 |
|
|
|
selectCustomer(row) { |
|
|
|
selectCustomer (row) { |
|
|
|
localStorage.setItem('customerId', row.customerId) |
|
|
|
localStorage.setItem('customerName', row.customerName) |
|
|
|
this.startLoading() |
|
|
|
// const url = 'https://nei.netease.com/api/apimock-v2/e3b1d0eb88e905f6c7ee559b2d6bb7ad/auth/govweb/login' |
|
|
|
const url = '/auth/govweb/login' |
|
|
|
this.dataForm.customerId = row.customerId |
|
|
|
let param = {} |
|
|
|
Object.assign(param, this.dataForm) |
|
|
|
param.password = this.encryptedData(this.pubKey, this.dataForm.password) |
|
|
|
this.$http |
|
|
|
.post(url, param) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
this.getCaptcha() |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.diaVisible = false |
|
|
|
let param = {}; |
|
|
|
Object.assign(param, this.dataForm); |
|
|
|
param.password = this.encryptedData(this.pubKey, this.dataForm.password); |
|
|
|
this.$http.post(url, param).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
this.getCaptcha() |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} |
|
|
|
this.diaVisible = false |
|
|
|
|
|
|
|
localStorage.setItem('userType', 'work') |
|
|
|
localStorage.setItem('userType', 'work') |
|
|
|
|
|
|
|
Cookies.set('token', res.data.token) |
|
|
|
this.$router.replace({ name: 'indexWork' }).catch(() => {}) |
|
|
|
}) |
|
|
|
.catch(() => {}) |
|
|
|
Cookies.set('token', res.data.token) |
|
|
|
this.$router.replace({ name: 'home' }).catch(() => { }) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
this.endLoading() |
|
|
|
|
|
|
|
}, |
|
|
|
// 取消 |
|
|
|
diaCancel() { |
|
|
|
diaCancel () { |
|
|
|
|
|
|
|
this.diaVisible = false |
|
|
|
}, |
|
|
|
// 开启加载动画 |
|
|
|
startLoading() { |
|
|
|
startLoading () { |
|
|
|
loading = Loading.service({ |
|
|
|
lock: true, // 是否锁定 |
|
|
|
text: '正在加载……', // 加载中需要显示的文字 |
|
|
@ -271,23 +317,64 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 结束加载动画 |
|
|
|
endLoading() { |
|
|
|
endLoading () { |
|
|
|
// clearTimeout(timer); |
|
|
|
if (loading) { |
|
|
|
loading.close() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 加密 |
|
|
|
encryptedData(key, data) { |
|
|
|
encryptedData (key, data) { |
|
|
|
|
|
|
|
// 新建JSEncrypt对象 |
|
|
|
let encryptor = new JSEncrypt() |
|
|
|
let encryptor = new JSEncrypt(); |
|
|
|
// 设置公钥 |
|
|
|
encryptor.setPublicKey(key) |
|
|
|
encryptor.setPublicKey(key); |
|
|
|
// 加密数据 |
|
|
|
return encryptor.encrypt(data) |
|
|
|
return encryptor.encrypt(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
.div_tip { |
|
|
|
float: left; |
|
|
|
} |
|
|
|
.p_tip { |
|
|
|
color: rgb(255, 80, 80); |
|
|
|
} |
|
|
|
.div_total { |
|
|
|
height: 80%; |
|
|
|
width: 100%; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
.el-dialog__body { |
|
|
|
width: 500px; |
|
|
|
padding: 0px 0px 0px 20px; |
|
|
|
} |
|
|
|
.div_row { |
|
|
|
height: 50px; |
|
|
|
text-align: center; |
|
|
|
line-height: 50px; |
|
|
|
|
|
|
|
<style lang="scss" src="@/assets/scss/pages/loginWork.scss"></style> |
|
|
|
/* width: 100px; */ |
|
|
|
/* background-color: rgb(241, 241, 241); */ |
|
|
|
} |
|
|
|
.div_row:hover { |
|
|
|
color: rgb(2, 119, 173); |
|
|
|
font-weight: bold; |
|
|
|
text-decoration: underline; |
|
|
|
} |
|
|
|
.i_icon { |
|
|
|
width: 15px; |
|
|
|
height: 15px; |
|
|
|
margin-right: 10px; |
|
|
|
float: left; |
|
|
|
} |
|
|
|
.span_name { |
|
|
|
font-size: 18px; |
|
|
|
cursor: pointer; |
|
|
|
/* color: rgb(37, 156, 235); */ |
|
|
|
} |
|
|
|
</style> |
|
|
|