|
@@ -1,193 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="site-wrapper site-page--login">
|
|
|
- <div class="login-main">
|
|
|
- <h3 class="title">
|
|
|
- <span>登录</span>
|
|
|
- </h3>
|
|
|
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
|
|
- status-icon>
|
|
|
- <el-form-item prop="userName">
|
|
|
- <el-input v-model="dataForm.userName" placeholder="帐号"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="password">
|
|
|
- <el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="captcha">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :span="17">
|
|
|
- <el-input v-model="dataForm.captcha" placeholder="验证码">
|
|
|
- </el-input>
|
|
|
- </el-col>
|
|
|
- <el-col :span="7" class="login-captcha">
|
|
|
- <img :src="captchaPath" @click="getCaptcha()" alt="">
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button class="login-btn-submit" type="primary" @click="dataFormSubmit()">登录</el-button>
|
|
|
- <p class="login" @click="gotoRegister">暂无账号?立即注册</p>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { getUUID } from '@/utils'
|
|
|
-
|
|
|
-export default {
|
|
|
- data () {
|
|
|
- return {
|
|
|
- dataForm: {
|
|
|
- userName: '',
|
|
|
- password: '',
|
|
|
- uuid: '',
|
|
|
- captcha: ''
|
|
|
- },
|
|
|
- dataRule: {
|
|
|
- userName: [
|
|
|
- { required: true, message: '帐号不能为空', trigger: 'blur' }
|
|
|
- ],
|
|
|
- password: [
|
|
|
- { required: true, message: '密码不能为空', trigger: 'blur' }
|
|
|
- ],
|
|
|
- captcha: [
|
|
|
- { required: true, message: '验证码不能为空', trigger: 'blur' }
|
|
|
- ]
|
|
|
- },
|
|
|
- captchaPath: ''
|
|
|
- }
|
|
|
- },
|
|
|
- created () {
|
|
|
- this.getCaptcha()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 提交表单
|
|
|
- dataFormSubmit () {
|
|
|
- // this.$router.replace({ name: 'home' })
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.$http({
|
|
|
- url: this.$http.adornUrl('/sys/login'),
|
|
|
- method: 'post',
|
|
|
- data: this.$http.adornData({
|
|
|
- 'username': this.dataForm.userName,
|
|
|
- 'password': this.dataForm.password,
|
|
|
- 'uuid': this.dataForm.uuid,
|
|
|
- 'captcha': this.dataForm.captcha
|
|
|
- })
|
|
|
- }).then(({ data }) => {
|
|
|
- if (data && data.code === 0) {
|
|
|
- this.$cookie.set('token', data.token)
|
|
|
- this.$router.replace({ name: 'home' })
|
|
|
- } else {
|
|
|
- this.getCaptcha()
|
|
|
- this.$message.error(data.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取验证码
|
|
|
- getCaptcha () {
|
|
|
- this.dataForm.uuid = getUUID()
|
|
|
- this.captchaPath = this.$http.adornUrl(`/captcha.jpg?uuid=${this.dataForm.uuid}`)
|
|
|
- },
|
|
|
- gotoRegister () {
|
|
|
- this.$router.push({
|
|
|
- name: 'register'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss" scoped>
|
|
|
-.site-wrapper.site-page--login {
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- right: 0;
|
|
|
- bottom: 0;
|
|
|
- left: 0;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
- background-color: #ebeeef;
|
|
|
- overflow: hidden;
|
|
|
-
|
|
|
- .login-main {
|
|
|
- width: 670px;
|
|
|
- padding-bottom: 80px;
|
|
|
- border-radius: 10px;
|
|
|
- overflow: hidden;
|
|
|
- background: #fff;
|
|
|
- }
|
|
|
-
|
|
|
- .title {
|
|
|
- position: relative;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
- width: 100%;
|
|
|
- height: 179px;
|
|
|
- margin: 0 auto 22px;
|
|
|
- color: #fff;
|
|
|
- background: url(~@/assets/img/login_bg.jpg) center center/100% 100% no-repeat;
|
|
|
-
|
|
|
- &::before {
|
|
|
- content: "";
|
|
|
- display: block;
|
|
|
- position: absolute;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- background-color: rgba(54, 84, 99, 0.7);
|
|
|
- }
|
|
|
-
|
|
|
- span {
|
|
|
- position: relative;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
- z-index: 1;
|
|
|
- display: block;
|
|
|
- width: 100%;
|
|
|
- line-height: 179px;
|
|
|
- font-size: 30px;
|
|
|
- font-weight: 400;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .el-form {
|
|
|
- width: 80%;
|
|
|
- margin: 0 auto;
|
|
|
- }
|
|
|
-
|
|
|
- .login-captcha {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
- align-items: center;
|
|
|
- overflow: hidden;
|
|
|
-
|
|
|
- > img {
|
|
|
- height: 36px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .login-btn-submit {
|
|
|
- width: 100%;
|
|
|
- }
|
|
|
-
|
|
|
- .login {
|
|
|
- margin-top: 10px;
|
|
|
- font-size: 14px;
|
|
|
- line-height: 22px;
|
|
|
- color: #1ab2ff;
|
|
|
- cursor: pointer;
|
|
|
- text-align: left;
|
|
|
- text-indent: 8px;
|
|
|
- width: 160px;
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|