h5.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div class="scope">
  3. <div class="tmp2">
  4. <h4 class="title">x-admin</h4>
  5. <el-form ref="form" class="form" size="medium" :disabled="saving">
  6. <el-form-item label="用户名">
  7. <el-input
  8. placeholder="请输入用户名"
  9. v-model="form.username"
  10. maxlength="20"
  11. @keyup.enter.native="next"
  12. auto-complete="off"
  13. clearable
  14. ></el-input>
  15. </el-form-item>
  16. <el-form-item label="密码">
  17. <el-input
  18. type="password"
  19. placeholder="请输入密码"
  20. v-model="form.password"
  21. maxlength="20"
  22. auto-complete="off"
  23. @keyup.enter.native="next"
  24. clearable
  25. ></el-input>
  26. </el-form-item>
  27. <el-form-item label="验证码" class="captcha">
  28. <el-input
  29. placeholder="请输入图片验证码"
  30. maxlength="4"
  31. v-model="form.verifyCode"
  32. auto-complete="off"
  33. @keyup.enter.native="next"
  34. clearable
  35. ></el-input>
  36. <captcha
  37. ref="captcha"
  38. class="value"
  39. v-model="form.captchaId"
  40. @change="captchaChange"
  41. ></captcha>
  42. </el-form-item>
  43. <el-button class="submit-btn" @click="next" :saving="saving">登录</el-button>
  44. </el-form>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import { isPc } from '@/cool/utils/index';
  50. import index from './index';
  51. export default {
  52. mixins: [index],
  53. beforeRouteEnter(to, from, next) {
  54. document.querySelector("meta[name='viewport']")['content'] =
  55. 'width=device-width, initial-scale=1';
  56. next();
  57. },
  58. beforeRouteLeave(to, from, next) {
  59. document.querySelector("meta[name='viewport']")['content'] = '';
  60. next();
  61. },
  62. created() {
  63. if (isPc()) {
  64. this.$router.push('/login');
  65. }
  66. }
  67. };
  68. </script>
  69. <style lang="stylus" scoped>
  70. .scope {
  71. height: 100vh;
  72. width: 100vw;
  73. position: relative;
  74. background-color: #f7f7f7;
  75. .tmp2 {
  76. height: 450px;
  77. width: 90%;
  78. max-width: 500px;
  79. border-radius: 10px;
  80. box-shadow: 6px 11px 41px -28px $color2;
  81. background-color: #fff;
  82. position: absolute;
  83. left: 0;
  84. top: 0;
  85. right: 0;
  86. bottom: 0;
  87. margin: auto;
  88. padding: 20px 25px;
  89. box-sizing: border-box;
  90. >>>.el-input {
  91. input {
  92. padding: 0 5px;
  93. border: 0;
  94. border-bottom: 1px solid #eee;
  95. background-color: #fff;
  96. }
  97. }
  98. .title {
  99. margin: 20px 0 30px 0;
  100. text-align: center;
  101. }
  102. .captcha {
  103. position: relative;
  104. .value {
  105. position: absolute;
  106. bottom: 0;
  107. right: 0;
  108. }
  109. }
  110. .submit-btn {
  111. width: 100%;
  112. background-color: $color2;
  113. color: #fff;
  114. }
  115. }
  116. }
  117. </style>