You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
585 lines
18 KiB
585 lines
18 KiB
<template> |
|
<div class="wrap"> |
|
<div class="login"> |
|
<div class="form"> |
|
<ul class="tab"> |
|
<li v-for="(item, i) in tabList" :key="i" :class="{ active: active == item.id }" @click="typeClick(item)">{{ |
|
item.label }}</li> |
|
</ul> |
|
<el-form :model="form" :rules="rules" ref="form" style="margin-top: 20px"> |
|
<el-form-item prop="account" ref="phoneItem"> |
|
<label class="label account"></label> |
|
<el-input v-model.trim="form.account" placeholder="请输入手机号/邮箱" @input="val => checkAccountByPhone(val, 0)" |
|
@keyup.enter.native="submit"> |
|
<img v-if="verFormEnable" slot="suffix" class="correct-icon" src="@/assets/images/login/correct.svg" |
|
alt=""> |
|
</el-input> |
|
<p v-if="diaClientMsg" class="el-form-item__error">{{ diaClientMsg }}</p> |
|
</el-form-item> |
|
<el-form-item v-if="active" prop="code"> |
|
<label class="label code"></label> |
|
<div class="ver-code"> |
|
<el-input v-model="form.code" placeholder="请输入验证码" maxlength="6" :disabled="!verFormEnable" |
|
@keyup.enter.native="submit"></el-input> |
|
<el-button type="text" @click="sendPhoneCodeLogin" :disabled="phoneDisabledLogin || !verFormEnable">{{ |
|
phoneBtnTextLogin |
|
}} |
|
</el-button> |
|
</div> |
|
</el-form-item> |
|
<template v-else> |
|
<el-form-item class="relative" prop="password"> |
|
<label class="password label"></label> |
|
<el-input type="password" placeholder="请输入密码" v-model.trim="form.password" @keyup.enter.native="submit" /> |
|
<el-link class="resetPw" :underline="false" type="primary" @click="showResetPw">忘记密码</el-link> |
|
</el-form-item> |
|
<el-form-item prop="code"> |
|
<label class="label code"></label> |
|
<el-input placeholder="请输入验证码" v-model.trim="form.code" @keyup.enter.native="submit"> |
|
</el-input> |
|
<img @click="getVerImg" :src="verificationIMG" class="ver-img" alt=""> |
|
</el-form-item> |
|
</template> |
|
<el-button class="submit" type="primary" @click="submit">登录</el-button> |
|
</el-form> |
|
</div> |
|
|
|
<div class="agree"> |
|
<div class="agreement"> |
|
<h6>专家评审承诺书</h6> |
|
<div class="text"> |
|
<p class="line">本人受邀自愿参加2020年安徽省大学生金融投资创新大赛工作,为进一步提高廉洁自律意识,客观公正的履行职责,我以大赛专家的身份和荣誉郑重作出如下承诺:</p> |
|
<p class="line">1.尊重大赛组委会及秘书处,尊重仲裁,尊重参赛单位和选手,客观、公正地履行职责。</p> |
|
<p class="line">2.遵守道德,遵守大赛纪律,在确定大赛专家身份后至大赛结束前,不私下接触参赛单位和个人,不参与以大赛名义举办的收费培训。不收受他人的财物或其他好处。</p> |
|
<p class="line">3.遵守竞赛管理规定中的保密协议,不透漏与大赛有关的涉密信息。</p> |
|
<p class="line">4.遵守公正、公平原则,不干预裁判工作,不影响比赛成绩。不给参赛选手或单位的违纪行为说情、解脱。</p> |
|
<p class="line">5.不隐瞒按规定应该回避的事项。</p> |
|
<p class="line">6.不发表、不传播没有根据并对大赛产生不利影响的言论。</p> |
|
<p class="line">7.对于涉嫌泄密事宜,愿接受、协助、配合相关部门的监督检查,并履行举证义务。</p> |
|
<p class="line">8.如若发生上述问题,自愿承担相关责任。</p> |
|
<p class="line">特此承诺!</p> |
|
<p class="line">勾选后才可登录!</p> |
|
</div> |
|
</div> |
|
<el-checkbox class="m-t-15 m-l-20" v-model="agreeCheck">同意,我已阅读</el-checkbox> |
|
</div> |
|
</div> |
|
<v-footer ref="footer"></v-footer> |
|
|
|
<el-dialog title="重设密码" :visible.sync="resetPwVisible" :close-on-click-modal="false" width="500px"> |
|
<el-form class="dia-form" ref="pwForm" label-width="110px" :model="pwForm" :rules="pwRules"> |
|
<el-form-item prop="phoneOrEmail" label="手机号/邮箱" ref="diaPhoneItem"> |
|
<el-input placeholder="请输入手机号/邮箱" v-model.trim="pwForm.phoneOrEmail" |
|
@input="val => checkAccountByPhone(val, 1)"> |
|
<img v-if="diaClientExist" slot="suffix" style="margin-top: -6px;" src="@/assets/images/login/correct.svg" |
|
alt=""> |
|
</el-input> |
|
<p v-if="diaClientMsg" class="el-form-item__error">{{ diaClientMsg }}</p> |
|
</el-form-item> |
|
<el-form-item prop="code" label="验证码"> |
|
<div class="ver-code"> |
|
<el-input v-model="pwForm.code" placeholder="请输入验证码" maxlength="6" :disabled="!diaClientExist"></el-input> |
|
<el-button style="top: 1px" type="text" @click="sendCodePw" :disabled="phoneDisabled || !diaClientExist">{{ |
|
phoneBtnText }} |
|
</el-button> |
|
</div> |
|
</el-form-item> |
|
<el-form-item prop="newPassword" label="登录密码"> |
|
<el-input placeholder="请输入登录密码" type="password" maxlength="6" v-model="pwForm.newPassword"></el-input> |
|
</el-form-item> |
|
<el-form-item prop="newPasswordTwo" label="确认登录密码"> |
|
<el-input placeholder="请再次输入登录密码" type="password" maxlength="6" v-model="pwForm.newPasswordTwo"></el-input> |
|
</el-form-item> |
|
</el-form> |
|
<span slot="footer" class="dialog-footer"> |
|
<el-button v-if="diaClientExist" size="small" type="primary" @click="pwSubmit">确定</el-button> |
|
<el-button size="small" @click="resetPwVisible = false">取消</el-button> |
|
</span> |
|
</el-dialog> |
|
<!-- <AccountApplyMatch :visible.sync="accountApplyMatchVisible" /> --> |
|
</div> |
|
</template> |
|
|
|
<script> |
|
import vFooter from '@/layouts/footer' |
|
import { mapState } from 'vuex' |
|
import Util from '@/libs/util' |
|
import Setting from "@/setting"; |
|
export default { |
|
components: { |
|
vFooter |
|
}, |
|
data: function () { |
|
return { |
|
tabList: [ |
|
{ |
|
id: 0, |
|
label: '密码登录' |
|
}, { |
|
id: 1, |
|
label: '验证码登录' |
|
} |
|
], |
|
active: 0, |
|
phoneReg: /^1[3456789]\d{9}$/, |
|
mailReg: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, |
|
verificationIMG: '', |
|
form: { |
|
workNumber: '', |
|
account: '', // 手机号验证码模式用这个字段 |
|
password: '', |
|
code: '', // 验证码 |
|
random: '', // 随机数 |
|
platform: Setting.platformId, |
|
distinguish: 1, |
|
}, |
|
rules: { |
|
account: [{ required: true, message: "请输入手机号/邮箱", trigger: "blur" }], |
|
password: [{ required: true, message: "请输入密码", trigger: "blur" }], |
|
code: [{ required: true, message: "请输入验证码", trigger: "blur" }] |
|
}, |
|
verFormEnable: false, |
|
verCodeLogin: false, |
|
phoneDisabledLogin: false, |
|
phoneTimerLogin: null, |
|
phoneBtnTextLogin: '发送验证码', |
|
|
|
phoneVisible: false, |
|
phone: '', |
|
phoneCode: '', |
|
phoneDisabled: false, |
|
phoneTimer: null, |
|
phoneOpener: '', |
|
phoneBtnText: '发送验证码', |
|
|
|
|
|
agreeCheck: false, |
|
|
|
resetPwVisible: false, |
|
diaClientExist: false, |
|
diaClientMsg: '', |
|
pwForm: { |
|
code: '', |
|
newPassword: '', |
|
newPasswordTwo: '', |
|
phoneOrEmail: '', |
|
}, |
|
pwRules: { |
|
phoneOrEmail: [{ required: true, message: "请输入手机号/邮箱", trigger: "blur" }], |
|
password: [{ required: true, message: "请输入密码", trigger: "blur" }], |
|
rePassword: [{ required: true, message: "请再次输入密码", trigger: "blur" }], |
|
code: [{ required: true, message: "请输入验证码", trigger: "blur" }] |
|
}, |
|
}; |
|
}, |
|
computed: { |
|
...mapState('project', [ |
|
'courseId' |
|
]) |
|
}, |
|
mounted () { |
|
localStorage.removeItem('opened') |
|
this.getVerImg() |
|
// 页面离开的时候销毁手机和邮箱验证码定时器 |
|
this.$once("hook:beforeDestroy", function () { |
|
clearInterval(this.phoneTimer) |
|
clearInterval(this.phoneTimerLogin) |
|
this.phoneTimer = null |
|
this.phoneTimerLogin = null |
|
}) |
|
}, |
|
methods: { |
|
getVerImg () { // 获取验证码图片 |
|
this.form.random = Math.floor(Math.random() * 999999999); |
|
this.verificationIMG = this.api.verification + "?random=" + `${this.form.random}`; |
|
}, |
|
// 切换标签 |
|
typeClick (tab) { |
|
const { id } = tab |
|
this.form.password = '' |
|
this.form.code = '' |
|
this.rules.password[0].required = !id |
|
this.active = id |
|
this.$refs.form.clearValidate() |
|
}, |
|
// 提交登录 |
|
submit () { |
|
if (!this.agreeCheck) return Util.errorMsg('请勾选同意,才可继续登录!') |
|
this.$refs.form.validate(async (valid) => { |
|
if (valid) { |
|
const { form } = this |
|
form.distinguish = this.active ? 2 : 1 |
|
try { |
|
const { status, data } = await this.$post(this.api.login, form) |
|
let { userAccounts: accounts, token } = data |
|
if (status == 200) { |
|
// 假如有多个平台的账号 |
|
if (accounts && accounts.length) { |
|
const expert = accounts.find(e => e.isExpert) // 专家 |
|
if (expert && expert.isEnable) { |
|
const res = await this.$post(`${this.api.getToken}?id=${expert.id}&platform=${Setting.platformId}`) |
|
if (res.data) token = res.data.token |
|
} else { |
|
return Util.errorMsg('请输入专家账号') |
|
} |
|
} else if (!data.isExpert) { |
|
form.code = '' |
|
return Util.errorMsg('专家评阅平台只允许专家账号登录,请重新输入') |
|
} |
|
localStorage.setItem('expert_token', token) |
|
|
|
Util.successMsg('登录成功') |
|
this.$router.replace(`/myReview`) |
|
} |
|
} catch (e) { |
|
form.code = '' |
|
this.getVerImg() |
|
} |
|
} |
|
}); |
|
}, |
|
// 验证手机号 |
|
verifyPhone (phone) { |
|
if (!phone) { |
|
this.$message.error("请输入手机号/邮箱") |
|
return false |
|
} |
|
if (!this.phoneReg.test(phone) && !this.mailReg.test(phone)) { |
|
this.$message.error("请输入正确的手机号/邮箱") |
|
return false |
|
} |
|
return true |
|
}, |
|
|
|
// 忘记密码 |
|
showResetPw () { |
|
this.pwForm = { |
|
code: '', |
|
newPassword: '', |
|
newPasswordTwo: '', |
|
phoneOrEmail: '', |
|
} |
|
this.diaClientExist = false |
|
this.resetPwVisible = true |
|
this.diaClientMsg = '' |
|
}, |
|
|
|
// 重设密码发送验证码 |
|
async sendCodePw () { |
|
const { phoneOrEmail } = this.pwForm |
|
if (!this.verifyPhone(phoneOrEmail)) return false |
|
const { message } = await this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phoneOrEmail}&loginOrBind=1&platform=${Setting.platformId}`) |
|
Util.successMsg(message) |
|
this.phoneCountdown() |
|
}, |
|
// 重设密码提交 |
|
pwSubmit () { |
|
this.$refs.pwForm.validate(valid => { |
|
if (valid) { |
|
const form = this.pwForm |
|
if (form.password !== form.rePassword) return Util.errorMsg('两次输入的密码不一致,请重新输入!') |
|
form.platform = Setting.platformId |
|
this.$post(this.api.forgotPassword, form).then(res => { |
|
this.resetPwVisible = false |
|
Util.successMsg('密码重置成功!请重新登录。') |
|
}).catch(res => { }) |
|
} |
|
}) |
|
}, |
|
|
|
// 手机号输入完回调。有账号才能继续操作。type:0手机验证码登录,1重置密码 |
|
async checkAccountByPhone (val, type) { |
|
if (val) { |
|
if (!this.phoneReg.test(val) && !this.mailReg.test(val)) { |
|
this.$refs[type ? 'diaPhoneItem' : 'phoneItem'].clearValidate() |
|
this.diaClientMsg = '请输入正确的手机号/邮箱' |
|
this[type ? 'diaClientExist' : 'verFormEnable'] = false |
|
return false |
|
} |
|
|
|
try { |
|
const { message } = await this.$get(`${this.api.forgotPreVerification}?phoneOrEmail=${val}&platform=${Setting.platformId}`) |
|
const exist = message === 'success' // 用户已存在 |
|
this[type ? 'diaClientExist' : 'verFormEnable'] = exist |
|
this.diaClientMsg = exist ? '' : message |
|
} catch (e) { |
|
this[type ? 'diaClientExist' : 'verFormEnable'] = false |
|
this.diaClientMsg = e.message |
|
} |
|
} else { |
|
this.diaClientMsg = '' |
|
this[type ? 'diaClientExist' : 'verFormEnable'] = false |
|
} |
|
}, |
|
|
|
// 验证码倒计时 |
|
phoneCountdownLogin () { |
|
let count = 60 |
|
if (!this.phoneTimerLogin) { |
|
this.phoneDisabledLogin = true |
|
this.phoneTimerLogin = setInterval(() => { |
|
if (count > 0) { |
|
count-- |
|
this.phoneBtnTextLogin = `${count}秒后重试` |
|
} else { |
|
this.phoneDisabledLogin = false |
|
clearInterval(this.phoneTimerLogin) |
|
this.phoneTimerLogin = null |
|
this.phoneBtnTextLogin = `发送验证码` |
|
} |
|
}, 1000) |
|
} |
|
}, |
|
// 发送验证码 |
|
sendPhoneCodeLogin () { |
|
const phone = this.form.account |
|
if (!this.verifyPhone(phone)) return false |
|
this.$post(`${this.api.sendPhoneVerificationCode}?phoneOrEmail=${phone}&loginOrBind=0&platform=${Setting.platformId}`).then(({ message }) => { |
|
Util.successMsg(message) |
|
this.phoneCountdownLogin() |
|
}).catch(res => { }) |
|
}, |
|
// 验证码倒计时 |
|
phoneCountdown () { |
|
let count = 60 |
|
if (!this.phoneTimer) { |
|
this.phoneDisabled = true |
|
this.phoneTimer = setInterval(() => { |
|
if (count > 0) { |
|
count-- |
|
this.phoneBtnText = `${count}秒后重试` |
|
} else { |
|
this.phoneDisabled = false |
|
clearInterval(this.phoneTimer) |
|
this.phoneTimer = null |
|
this.phoneBtnText = `发送验证码` |
|
} |
|
}, 1000) |
|
} |
|
}, |
|
} |
|
}; |
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
.wrap { |
|
min-height: 100%; |
|
background-color: #f3f6fa; |
|
} |
|
|
|
.ver-code { |
|
position: relative; |
|
|
|
.el-button { |
|
position: absolute; |
|
top: 10px; |
|
right: 10px; |
|
} |
|
} |
|
|
|
.login { |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
height: calc(100vh - 43px); |
|
background: url(../../../assets/images/shapes/shape1.png) (0 123px) / auto no-repeat, |
|
url(../../../assets/images/shapes/shape2.png) (35px 238px) / auto no-repeat, |
|
url(../../../assets/images/shapes/shape3.png) (0 485px) / auto no-repeat, |
|
url(../../../assets/images/shapes/shape4.png) (right 50%) / auto no-repeat, |
|
url(../../../assets/images/shapes/shape5.png) (right 80%) / auto no-repeat, |
|
url(../../../assets/images/shapes/shape6.png) (right bottom) / auto no-repeat; |
|
|
|
.agree { |
|
width: 500px; |
|
height: 450px; |
|
padding-bottom: 20px; |
|
background-color: #fff; |
|
|
|
} |
|
|
|
.agreement { |
|
height: 394px; |
|
padding: 20px; |
|
overflow: auto; |
|
|
|
h6 { |
|
margin-bottom: 10px; |
|
font-size: 20px; |
|
font-weight: 600; |
|
} |
|
|
|
.text { |
|
line-height: 1.6; |
|
} |
|
|
|
.line { |
|
margin-top: 7px; |
|
} |
|
} |
|
|
|
.tab { |
|
display: flex; |
|
justify-content: space-around; |
|
align-items: center; |
|
margin-bottom: 24px; |
|
border-bottom: 2px solid #e1e6f2; |
|
|
|
li { |
|
padding: 18px 0; |
|
// margin: 0 20px -1px 0; |
|
margin-bottom: -1px; |
|
font-size: 16px; |
|
color: #555; |
|
cursor: pointer; |
|
border-bottom: 4px solid transparent; |
|
|
|
&:last-child { |
|
margin-right: 0; |
|
} |
|
|
|
&.active { |
|
color: $main-color; |
|
border-bottom-color: $main-color; |
|
} |
|
} |
|
} |
|
|
|
.items { |
|
display: flex; |
|
align-items: center; |
|
} |
|
|
|
.form { |
|
width: 436px; |
|
height: 450px; |
|
padding: 20px 38px 50px; |
|
border-radius: 6px; |
|
background-color: #fff; |
|
|
|
.title { |
|
margin-bottom: 25px; |
|
font-size: 26px; |
|
color: #0b1d30; |
|
letter-spacing: 4px; |
|
} |
|
} |
|
|
|
/deep/.el-form-item { |
|
margin-bottom: 20px; |
|
} |
|
|
|
/deep/.el-input__inner { |
|
position: relative; |
|
height: 52px; |
|
padding: 0 20px 0 34px; |
|
line-height: 50px; |
|
background-color: #fbfbfb; |
|
border-color: #e1e6f2; |
|
border-radius: 4px !important; |
|
|
|
&:focus { |
|
border-color: $main-color; |
|
box-shadow: 0 0 2px #4486e9; |
|
} |
|
} |
|
|
|
.resetPw { |
|
position: absolute; |
|
top: 10px; |
|
right: 10px; |
|
} |
|
|
|
.bottom { |
|
display: flex; |
|
justify-content: space-between; |
|
} |
|
|
|
.el-select { |
|
width: 100%; |
|
} |
|
|
|
.label { |
|
z-index: 1; |
|
position: absolute; |
|
top: 17px; |
|
left: 11px; |
|
width: 18px; |
|
height: 18px; |
|
background: url(../../../assets/images/login/account.png) 0 0/100% 100% no-repeat; |
|
} |
|
|
|
.correct-icon { |
|
width: 30px; |
|
margin: 11px 3px 0 0; |
|
} |
|
|
|
.school { |
|
background-image: url(../../../assets/images/login/school.png); |
|
} |
|
|
|
.workNumber { |
|
width: 17px; |
|
background-image: url(../../../assets/images/login/workNumber.png); |
|
} |
|
|
|
.password { |
|
top: 18px; |
|
background-image: url(../../../assets/images/login/password.png); |
|
} |
|
|
|
.code { |
|
top: 18px; |
|
background-image: url(../../../assets/images/login/code.png); |
|
} |
|
|
|
.ver-img { |
|
position: absolute; |
|
top: 2px; |
|
right: 2px; |
|
} |
|
|
|
/deep/.el-form-item__error { |
|
top: 105%; |
|
left: auto; |
|
right: 0; |
|
color: #ffa94e; |
|
} |
|
|
|
.submit { |
|
width: 100%; |
|
height: 48px; |
|
margin-top: 30px; |
|
line-height: 48px; |
|
padding: 0; |
|
font-size: 20px; |
|
background-color: $main-color; |
|
border-radius: 4px; |
|
border: 0; |
|
} |
|
} |
|
|
|
/deep/.dia-form { |
|
.w-100 { |
|
width: 100%; |
|
} |
|
|
|
.tips { |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
} |
|
|
|
.err-msg { |
|
font-size: 12px; |
|
color: #F56C6C; |
|
line-height: 1; |
|
} |
|
} |
|
|
|
|
|
@media (max-height: 680px) { |
|
.wrap .login { |
|
padding: 40px 0; |
|
} |
|
} |
|
</style> |