| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- <template>
- <div class="page-login">
- <div class="page-login--layer page-login--layer-area">
- <ul class="circles">
- <li v-for="n in 10" :key="n"></li>
- </ul>
- </div>
-
- <div class="page-login--layer">
- <div
- class="page-login--content"
- flex="dir:top main:justify cross:stretch box:justify">
- <div class="page-login--content-header">
-
- </div>
- <div
- class="page-login--content-main"
- flex="dir:top main:center cross:center">
- <!-- logo -->
- <img class="page-login--logo" src="./image/logo.png">
- <!-- form -->
- <div class="page-login--form">
- <el-card shadow="never">
- <el-form
- ref="loginForm"
- label-position="top"
- :rules="rules"
- :model="formLogin"
- size="default">
- <div style="font-size:30px;text-align:center;color:#fff;margin-bottom:30px">用户登录</div>
- <el-form-item prop="username">
- <el-input
- type="text"
- v-model="formLogin.username"
- placeholder="用户名">
- <i slot="prepend" class="fa fa-user"></i>
- </el-input>
- </el-form-item>
- <el-form-item prop="password">
- <el-input
- type="password"
- v-model="formLogin.password"
- placeholder="密码">
- <i slot="prepend" class="fa fa-lock"></i>
- </el-input>
- </el-form-item>
-
- <el-button
- size="default"
- @click="submit"
- type="primary"
- class="button-login">
- 登录
- </el-button>
- </el-form>
- </el-card>
-
- </div>
- </div>
- <div class="page-login--content-footer">
-
- <Foot></Foot>
- </div>
- </div>
- </div>
-
- </div>
- </template>
- <script>
- import util from '@/libs/util.js'
- import Foot from "../../../layout/header-aside/components/footer";
- import api from '@/api'
- import { mapActions } from 'vuex'
- import localeMixin from '@/locales/mixin.js'
- export default {
- components: {Foot},
- mixins: [
- localeMixin
- ],
- data () {
- return {
-
-
-
- // 快速选择用户
- dialogVisible: false,
- users: [
- {
- name: 'Admin',
- username: 'admin',
- password: 'admin'
- },
- {
- name: 'Editor',
- username: 'editor',
- password: 'editor'
- },
- {
- name: 'User1',
- username: 'user1',
- password: 'user1'
- }
- ],
- // 表单
- formLogin: {
- username: '',
- password: '',
- code: 'v9am'
- },
- // 表单校验
- rules: {
- username: [
- {
- required: true,
- message: '请输入用户名',
- trigger: 'blur'
- }
- ],
- password: [
- {
- required: true,
- message: '请输入密码',
- trigger: 'blur'
- }
- ],
- code: [
- {
- required: true,
- message: '请输入验证码',
- trigger: 'blur'
- }
- ]
- },
-
- }
- },
- mounted () {
-
- },
- created(){
- //开启监听键盘按下事件
- window.addEventListener("keydown",this.handleKeyDown,true);
- },
- beforeDestroy () {
-
- },
- methods: {
- ...mapActions('d2admin/account', [
- 'login'
- ]),
- handleKeyDown(e){
- let key=null;
- if(window.event===undefined){
- key=e.keyCode;
- }else{
- key=window.event.keyCode;
- }
- if(key===13){
- this.submit();
- }
- },
-
-
- loginBtn(){
- let data={
- userName:this.formLogin.username,
- userPassword:this.formLogin.password
- }
- api.login(data)
- .then(res=>{
- if(res.code==200){
- console.log(res,"loginRes")
- //移除键盘事件
- window.removeEventListener('keydow',this.handleKeyDown,true)
- // util.cookies.set('uuid', "admin-uuid")
- // util.cookies.set('token', "afe08f93-c46b-47d9-ac3b-43e9ad0c55ba")
- // util.cookies.set('uuid', "admin-uuid")
- console.log( res.data.token," res.data.token")
- util.cookies.set('token', res.data.token)
- // 重定向对象不存在则返回顶层路径
- this.$router.replace(this.$route.query.redirect || '/')
- localStorage.setItem("userName",this.formLogin.username);
- localStorage.setItem("manageStore",res.data.object.manageStore);
- localStorage.setItem("orgId",res.data.object.orgId);
- localStorage.setItem("orgCode",res.data.object.orgCode);
- localStorage.setItem("orgName",res.data.object.orgName);
-
-
- }else if(res.code==600){
- this.$message.error('账号或密码错误');
- }
- })
- },
-
- // 提交登录信息
- submit () {
- this.$refs.loginForm.validate((valid) => {
- if (valid) {
- // 登录
- // 注意 这里的演示没有传验证码
- // 具体需要传递的数据请自行修改代码
- // this.login({
- // username: this.formLogin.username,
- // password: this.formLogin.password
- // })
- // .then(() => {
- // // 重定向对象不存在则返回顶层路径
- // this.$router.replace(this.$route.query.redirect || '/')
- // localStorage.setItem("userName",this.formLogin.username)
- // })
- this.loginBtn();
-
-
- } else {
- // 登录表单校验失败
- this.$message.error('表单校验失败,请检查')
- }
- })
-
- },
- // 随机语录
- tipsrandom () {
- var index
- index = Math.floor(Math.random() * this.tipsarr.length)
- this.tips = this.tipsarr[index]
- }
- }
- }
- </script>
- <style lang="scss">
- .page-login {
- @extend %unable-select;
- $backgroundColor: #F0F2F5;
- // ---
- background-color: $backgroundColor;
- background: url('./image/bg.jpg') center no-repeat ;
- background-size:100% 100%;
- height: 100%;
- position: relative;
- // 层
- .page-login--layer {
- @extend %full;
- overflow: auto;
- }
- .page-login--layer-area {
- overflow: hidden;
- }
- // 时间
- .page-login--layer-time {
- font-size: 24em;
- font-weight: bold;
- color: rgba(0, 0, 0, 0.03);
- overflow: hidden;
- }
- // 登陆页面控件的容器
- .page-login--content {
- height: 100%;
- min-height: 500px;
- }
- // header
- .page-login--content-header {
- padding: 1em 0;
- .page-login--content-header-motto {
- margin: 0px;
- padding: 0px;
- color: $color-text-normal;
- text-align: center;
- font-size: 12px;
- }
- }
- // main
- .page-login--logo {
- width: 240px;
- margin-bottom: 2em;
- margin-top: -2em;
- }
- // 登录表单
- .page-login--form {
- width: 28em;
- height: 26em;
- background-image: url("./image/dengluk.png");
- background-repeat: no-repeat;
- background-size: 100% 100%;
- // 卡片
- .el-card {
- margin-bottom: 15px;
- background: none !important;
- border: none !important;
- }
- // 登录按钮
- .button-login {
- width: 100%;
- height: 56px;
- background: linear-gradient(0deg, #01E9BD, #00D6B9);
- border-radius: 6px;
- }
- .el-input{
- width: 100%;
- background: rgba(255,255,255,0.1100);
- border: 1px solid #6DF6E4;
- box-shadow: 0px 0px 9px 0px rgba(0,87,75,0.3100);
- border-radius: 6px;
- color: #fff;
- height: 57px;
- }
- // 输入框左边的图表区域缩窄
- .el-input-group__prepend {
- padding: 0px 14px;
- }
- .login-code {
- height: 40px - 2px;
- display: block;
- margin: 0px -20px;
- border-top-right-radius: 2px;
- border-bottom-right-radius: 2px;
- }
- // 登陆选项
- .page-login--options {
- margin: 0px;
- padding: 0px;
- font-size: 14px;
- color: $color-primary;
- margin-bottom: 15px;
- font-weight: bold;
- }
- .page-login--quick {
- width: 100%;
- }
- }
- // 快速选择用户面板
- .page-login--quick-user {
- @extend %flex-center-col;
- padding: 10px 0px;
- border-radius: 4px;
- &:hover {
- background-color: $color-bg;
- i {
- color: $color-text-normal;
- }
- span {
- color: $color-text-normal;
- }
- }
- i {
- font-size: 36px;
- color: $color-text-sub;
- }
- span {
- font-size: 12px;
- margin-top: 10px;
- color: $color-text-sub;
- }
- }
- // footer
- .page-login--content-footer {
- // padding: 1em 0;
- .page-login--content-footer-locales {
- padding: 0px;
- margin: 0px;
- margin-bottom: 15px;
- font-size: 12px;
- line-height: 12px;
- text-align: center;
- color: $color-text-normal;
- a {
- color: $color-text-normal;
- margin: 0 .5em;
- &:hover {
- color: $color-text-main;
- }
- }
- }
- .page-login--content-footer-copyright {
- padding: 0px;
- margin: 0px;
- margin-bottom: 10px;
- font-size: 12px;
- line-height: 12px;
- text-align: center;
- color: $color-text-normal;
- a {
- color: $color-text-normal;
- }
- }
- .page-login--content-footer-options {
- padding: 0px;
- margin: 0px;
- font-size: 12px;
- line-height: 12px;
- text-align: center;
- a {
- color: $color-text-normal;
- margin: 0 1em;
- }
- }
- }
- // 背景
- .circles {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- overflow: hidden;
- margin: 0px;
- padding: 0px;
- // li {
- // position: absolute;
- // display: block;
- // list-style: none;
- // width: 20px;
- // height: 20px;
- // background: #FFF;
- // animation: animate 25s linear infinite;
- // bottom: -200px;
- // @keyframes animate {
- // 0%{
- // transform: translateY(0) rotate(0deg);
- // opacity: 1;
- // border-radius: 0;
- // }
- // 100%{
- // transform: translateY(-1000px) rotate(720deg);
- // opacity: 0;
- // border-radius: 50%;
- // }
- // }
- // &:nth-child(1) {
- // left: 15%;
- // width: 80px;
- // height: 80px;
- // animation-delay: 0s;
- // }
- // &:nth-child(2) {
- // left: 5%;
- // width: 20px;
- // height: 20px;
- // animation-delay: 2s;
- // animation-duration: 12s;
- // }
- // &:nth-child(3) {
- // left: 70%;
- // width: 20px;
- // height: 20px;
- // animation-delay: 4s;
- // }
- // &:nth-child(4) {
- // left: 40%;
- // width: 60px;
- // height: 60px;
- // animation-delay: 0s;
- // animation-duration: 18s;
- // }
- // &:nth-child(5) {
- // left: 65%;
- // width: 20px;
- // height: 20px;
- // animation-delay: 0s;
- // }
- // &:nth-child(6) {
- // left: 75%;
- // width: 150px;
- // height: 150px;
- // animation-delay: 3s;
- // }
- // &:nth-child(7) {
- // left: 35%;
- // width: 200px;
- // height: 200px;
- // animation-delay: 7s;
- // }
- // &:nth-child(8) {
- // left: 50%;
- // width: 25px;
- // height: 25px;
- // animation-delay: 15s;
- // animation-duration: 45s;
- // }
- // &:nth-child(9) {
- // left: 20%;
- // width: 15px;
- // height: 15px;
- // animation-delay: 2s;
- // animation-duration: 35s;
- // }
- // &:nth-child(10) {
- // left: 85%;
- // width: 150px;
- // height: 150px;
- // animation-delay: 0s;
- // animation-duration: 11s;
- // }
- // }
- }
- .el-input__inner{
- border: none;
- height: 57px;
- line-height: 57px;
- padding-left: 10px;
- padding-right: 0;
- background: transparent;
- color:#fff
- }
- .el-input__inner:-webkit-autofill,
- .el-input__inner:-webkit-autofill:hover,
- .el-input__inner:-webkit-autofill:focus,
- .el-input__inner:-webkit-autofill:active {
- -webkit-transition-delay: 99999s;
- -webkit-transition: color 99999s ease-out, background-color 99999s ease-out;
- }
- .el-input-group__append, .el-input-group__prepend{
- background: none !important;
- border:none !important;
- color: rgba(255, 255, 255, 0.8) !important;
- font-size: 22px;
- }
- .el-form-item__error{
- color:#fff
- }
- input::-webkit-input-placeholder{
- color:#fff;
- }
- input::-moz-placeholder{ /* Mozilla Firefox 19+ */
- color:#fff;
- }
- input:-moz-placeholder{ /* Mozilla Firefox 4 to 18 */
- color:#fff;
- }
- input:-ms-input-placeholder{ /* Internet Explorer 10-11 */
- color:#fff;
- }
- }
- </style>
|