您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

loginPage.vue 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="container">
  3. <!-- eslint-disable max-len -->
  4. <div class="login-page">
  5. <form id="signIn">
  6. <div class="form col-md-12">
  7. <div>
  8. <h4>Login</h4>
  9. </div>
  10. <button
  11. @click="routerGoTo('/user/register')"
  12. class="btn"
  13. style="margin:2px; color: #60CBEB"
  14. >Register</button>
  15. <button
  16. @click="routerGoTo('/user/registeragency')"
  17. class="btn"
  18. style="margin:2px; color: #60CBEB"
  19. >Agency Registration</button>
  20. <div v-if="this.$store.state.authentication.status === 'error'">
  21. <alert
  22. :text="'User doesn\'t exist or Username and Password is incorrect'"
  23. :type="'ERROR'"
  24. />
  25. </div>
  26. <div class="row">
  27. <div class="col-md-12" style="margin-bottom: 1em">
  28. <div class="input-group mb-3">
  29. <div class="input-group-prepend">
  30. <span class="input-group-text">
  31. <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
  32. </span>
  33. <input
  34. class="form-control"
  35. type="text"
  36. name="username"
  37. placeholder="Username"
  38. v-model="username"
  39. value
  40. />
  41. </div>
  42. </div>
  43. <div class="input-group mb-3">
  44. <div class="input-group-prepend">
  45. <span class="input-group-text">
  46. <eva-icon name="lock-outline" fill="#60CBEB"></eva-icon>
  47. </span>
  48. <input
  49. class="form-control"
  50. :type="isPasswordShown"
  51. v-model="password"
  52. id="password"
  53. placeholder="Password"
  54. name="password"
  55. value
  56. />
  57. <div class="input-group-append">
  58. <span class="input-group-text">
  59. <eva-icon
  60. v-if="!showPassword"
  61. name="eye-off-outline"
  62. fill="#60CBEB"
  63. @click="togglePassword()"
  64. ></eva-icon>
  65. <eva-icon v-else name="eye-outline" fill="#60CBEB" @click="passwordToggled()"></eva-icon>
  66. </span>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <button @click="Login()" class="btn btn-b-n" type="submit">Sign In</button>
  73. <hr />
  74. <div
  75. @click="ToggleTrouble()"
  76. class="btn cursor: pointer;"
  77. style="margin:2px; color: #60CBEB; font-size:110%;"
  78. >Trouble signing in?</div>
  79. <br />
  80. <div v-if="troubleToggle">
  81. <!-- <alert :text="'Username & password request email sent'" :type="'SUCCESS'" /> -->
  82. <div class="row">
  83. <div class="input-group-prepend">
  84. <span class="input-group-text">
  85. <eva-icon name="email-outline" fill="#60CBEB"></eva-icon>
  86. </span>
  87. <input class="form-control" placeholder="Your Email" type="text" name="email" value />
  88. </div>
  89. </div>
  90. <br />
  91. <button @click="SendMail()" class="btn btn-b-n" type="submit">Submit</button>
  92. </div>
  93. </div>
  94. </form>
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import { mapActions, mapState } from 'vuex';
  100. import alert from '../shared/alert.vue';
  101. export default {
  102. name: 'Login',
  103. components: {
  104. alert,
  105. },
  106. data() {
  107. return {
  108. isPasswordShown: 'password',
  109. selectItems: [{ text: 'password', value: 0 }],
  110. selectErrors: 'Some error with the field',
  111. select: null,
  112. textErrors: 'Some error with the field',
  113. text: '',
  114. showPassword: false,
  115. email: '',
  116. troubleToggle: false,
  117. };
  118. },
  119. computed: {
  120. ...mapState('authentication', ['token', 'status', 'username', 'password']),
  121. },
  122. methods: {
  123. ...mapActions('authentication', ['login', 'init']),
  124. ToggleTrouble() {
  125. if (this.troubleToggle) {
  126. this.troubleToggle = false;
  127. } else this.troubleToggle = true;
  128. },
  129. Login() {
  130. this.login().then(() => {
  131. if (this.$store.state.authentication.status === 'error') {
  132. this.$router.push('/user/login');
  133. }
  134. });
  135. },
  136. togglePassword() {
  137. this.showPassword = true;
  138. this.isPasswordShown = 'text';
  139. },
  140. passwordToggled() {
  141. this.showPassword = false;
  142. this.isPasswordShown = 'password';
  143. },
  144. SendMail() {},
  145. routerGoTo(goTo) {
  146. console.log(goTo);
  147. this.$router.push(goTo);
  148. },
  149. },
  150. };
  151. </script>
  152. <style>
  153. .goDown {
  154. margin-top: 150px;
  155. }
  156. </style>