LoginPage.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div style="width:100%;height:100%;">
  3. <div class="login-header">
  4. <img src="../../assets/image/e_logo5.png" class="logo" />
  5. <span class="welcome-login">欢迎登录</span>
  6. </div>
  7. <div class="login">
  8. <div class="drag">
  9. <div style="background:rgba(255,255,255,0.1); border-radius:5px;">
  10. <Card icon="log-in" title="智慧课堂管理平台" :bordered="false" class="login-card">
  11. <div class="form-con">
  12. <Form ref="loginForm" :model="form" :rules="rules" @keydown.enter.native="handleSubmit">
  13. <FormItem prop="userName">
  14. <Input v-model="form.userName" placeholder="请输入用户名">
  15. <span slot="prepend">
  16. <Icon :size="16" type="ios-person"></Icon>
  17. </span>
  18. </Input>
  19. </FormItem>
  20. <FormItem prop="password">
  21. <Input type="password" v-model="form.password" placeholder="请输入密码">
  22. <span slot="prepend">
  23. <Icon :size="14" type="md-lock"></Icon>
  24. </span>
  25. </Input>
  26. </FormItem>
  27. <FormItem>
  28. <Button @click="handleSubmit" type="primary" :loading="loading" long>登&emsp;录</Button>
  29. </FormItem>
  30. </Form>
  31. <span style="float:left;color:#999999;cursor:pointer;">忘记密码?</span>
  32. <span style="float:right;color:#999999;cursor:pointer;">立刻注册>>></span>
  33. </div>
  34. </Card>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. export default {
  42. name: 'LoginForm',
  43. props: {
  44. userNameRules: {
  45. type: Array,
  46. default: () => {
  47. return [
  48. { required: true, message: '账号不能为空', trigger: 'blur' }
  49. ]
  50. }
  51. },
  52. passwordRules: {
  53. type: Array,
  54. default: () => {
  55. return [
  56. { required: true, message: '密码不能为空', trigger: 'blur' }
  57. ]
  58. }
  59. }
  60. },
  61. data() {
  62. return {
  63. loading:false,
  64. form: {
  65. userName: '',
  66. password: ''
  67. }
  68. }
  69. },
  70. computed: {
  71. rules() {
  72. return {
  73. userName: this.userNameRules,
  74. password: this.passwordRules
  75. }
  76. }
  77. },
  78. methods: {
  79. loginSuccess() {
  80. this.$router.push({ path: '/main' });
  81. },
  82. handleSubmit() {
  83. this.$refs.loginForm.validate((valid) => {
  84. if (valid) {
  85. localStorage.setItem("userName", this.form.userName);
  86. localStorage.setItem("isLogin", 1);
  87. this.loading = true;
  88. setTimeout(() => {
  89. this.loading = false;
  90. this.loginSuccess();
  91. }, 1500);
  92. }
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped>
  99. .login {
  100. background-image: url('../../assets/image/login_bg1.png');
  101. width: 100%;
  102. height: 100%;
  103. background-size: cover;
  104. display: flex;
  105. flex-direction: row;
  106. align-items: center;
  107. justify-content: center;
  108. }
  109. .welcome-login {
  110. float: right;
  111. line-height: 80px;
  112. margin-right: 120px;
  113. font-size: 22px;
  114. font-weight: 800;
  115. color: #1196D2;
  116. }
  117. .login-header {
  118. width:100%;
  119. height:80px;
  120. background-color:#fff;
  121. position:absolute;
  122. z-index:10;
  123. /*box-shadow: 0 -5px 10px 6px #41b6ba inset;*/
  124. }
  125. .logo {
  126. height: 60px;
  127. margin-top:10px;
  128. margin-left:100px;
  129. }
  130. .login:after {
  131. content: "";
  132. width: 100%;
  133. height: 100%;
  134. position: relative;
  135. left: 0;
  136. top: 0;
  137. background: inherit;
  138. filter: blur(4px);
  139. z-index: 1;
  140. }
  141. .drag {
  142. position: absolute;
  143. text-align: center;
  144. z-index: 11;
  145. border-radius: 5px;
  146. box-shadow: 0 0 10px 6px rgba(0,0,0,.5);
  147. width: 90%;
  148. max-width: 350px;
  149. background:white;
  150. }
  151. .login-tip {
  152. color: white;
  153. }
  154. .drag >>> .ivu-card-head p span {
  155. color: #555555;
  156. /*padding-top:10px;*/
  157. display:inline-block;
  158. font-size: 18px;
  159. }
  160. .login-card {
  161. background: none;
  162. padding-bottom:20px;
  163. color: black;
  164. width: 100%;
  165. }
  166. </style>