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.

211 lines
5.8 KiB

3 years ago
<template>
<div class="login">
<!-- 公司左上角logo -->
<div class="left-logo">
<svg-icon icon-class="icon-hm-login1" style="font-size:130px;" />
</div>
<!-- 中间背景 -->
<div class="login-bgm" />
<!-- <img src="../../../assets/img/login_bgm.png" alt="" class="login-bgm"> -->
<div class="login-content">
<div class="login-content-title">
3 years ago
<p class="main-title">眼科信息系统</p>
3 years ago
<p class="subtitle-title">登录</p>
</div>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
status-icon
>
<!-- 用户名 -->
<el-form-item prop="account">
<el-input v-model="dataForm.account" placeholder="请输入工号" @keyup.enter.native="submitNext" />
3 years ago
</el-form-item>
<!-- 密码 -->
<el-form-item prop="password">
<el-input ref="passWord" v-model="dataForm.password" type="password" placeholder="请输入密码" @keyup.enter.native="dataFormSubmitHandle()" />
3 years ago
</el-form-item>
2 years ago
<!-- <el-form-item prop="captcha">-->
<!-- <el-row :gutter="10">-->
<!-- <el-col :span="14">-->
<!-- <el-input v-model="dataForm.captcha" :placeholder="$t('login.captcha')" />-->
<!-- </el-col>-->
<!-- <el-col :span="10" class="login-captcha">-->
<!-- <img :src="captchaPath" @click="getCaptcha()">-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </el-form-item>-->
3 years ago
<el-form-item>
<el-button type="primary" class="w-percent-100" @click="dataFormSubmitHandle()">{{ $t('login.title') }}
</el-button>
</el-form-item>
</el-form>
<p class="tips">没有账号? 请联系管理员</p>
</div>
<div class="login-footer">
<p class="copyright">南京慧目信息技术有限公司 版权所有</p>
</div>
</div>
</template>
<script>
import Cookies from 'js-cookie'
import debounce from 'lodash/debounce'
import { messages } from '@/i18n'
import { getUUID } from '@/utils'
import { mapActions, MapActions } from 'vuex'
3 years ago
export default {
data() {
return {
i18nMessages: messages,
captchaPath: '',
dataForm: {
account: '',
password: '',
uuid: '',
captcha: ''
}
}
},
computed: {
dataRule() {
return {
account: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
password: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
captcha: [
2 years ago
{ required: false, message: this.$t('validate.required'), trigger: 'blur' }
3 years ago
]
}
}
},
created() {
2 years ago
// this.getCaptcha()
3 years ago
},
methods: {
...mapActions(['acSetUser']),
2 years ago
submitNext() {
this.$refs.passWord.focus()
},
3 years ago
// 获取验证码
async getCaptcha() {
this.dataForm.uuid = getUUID()
const { data: res } = await this.$http.get(`/captcha?uuid=${this.dataForm.uuid}`)
this.captchaPath = res.data
},
// 表单提交
dataFormSubmitHandle: debounce(function() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http.post('/login', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
this.getCaptcha()
return this.$message.error(res.msg)
}
if (!res.data.currentUser) {
return
}
this.acSetUser(res.data.currentUser)
const employeeId = this.$store.state.currentUser.employeeId
Cookies.set('xa-token' + employeeId, res.data.token)
// window.localStorage.setItem('qg-userData', JSON.stringify(res.data.currentUser))
3 years ago
this.$router.push({ name: 'outpatientManagement-call' })
3 years ago
}).catch(() => { })
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>
<style lang="scss" scoped>
.login {
width: 100vw;
height: 100vh;
overflow: hidden;
display: flex;
justify-content: center;
position: relative;
.left-logo {
position: fixed;
left: 30px;
top: -30px;
.title {
font-size: 18px;
font-family: PingFang SC;
font-weight: 700;
display: inline-block;
padding-left: 10px;
vertical-align: middle;
}
}
.login-bgm {
background: url(../../../assets/img/login_bgm.png) no-repeat top center;
width: 900px;
height: 276px;
margin: 0 auto;
margin-top: 175px;
}
.login-content {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 340px;
.login-content-title {
text-align: center;
color: #262626;
margin-bottom: 32px;
.main-title {
font-size: 38px;
margin-bottom: 20px;
color:#1E79FF;
font-weight: 700;
}
.subtitle-title {
font-size: 24px;
color: #11305C;
}
}
.tips {
text-align: center;
color: #909399;
}
.login-captcha {
img {
width: 135px;
height: 48px;
}
}
}
.login-footer {
position: fixed;
bottom: 0;
left: 0;
z-index: -1;
background: url(../../../assets/img/login_filter.png) no-repeat top center;
width: 100%;
height: 166px;
.copyright {
position: fixed;
bottom: 16px;
left: 50%;
transform: translateX(-50%);
color: #fff;
}
}
}
</style>
<style lang="scss">
.login {
.el-input__inner {
background-color: #11305c;
color: #fff;
height: 48px;
}
}
</style>