index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <div>
  3. <div class="box">
  4. <div class="toptext">{{$t('application.Reset')}}</div>
  5. <div class="centerbox">
  6. <el-input class="cen_email" :placeholder="$t('application.New')" v-model="password" show-password></el-input>
  7. <el-input class="cen_email" :placeholder="$t('application.Confirm')" v-model="confirmPassword" show-password></el-input>
  8. <button class="cen_button" v-loading.fullscreen.lock="fullscreenLoading" @click="appli">{{$t('application.Submit')}}</button>
  9. </div>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. components: {
  16. },
  17. name: 'applications',
  18. data () {
  19. return {
  20. code: '',
  21. email: '',
  22. password: '',
  23. confirmPassword: '',
  24. fullscreenLoading: false
  25. }
  26. },
  27. methods: {
  28. verification () {
  29. if (!this.password) {
  30. this.$message.error(this.$t('register.Password') + this.$t('register.Cannot'))
  31. return false
  32. } else if (!this.$util.passwordValid(this.password)) {
  33. this.$message.error(this.$t('register.kinds'))
  34. return false
  35. } else if (this.password !== this.confirmPassword) {
  36. this.$message.error(this.$t('register.inconsistent'))
  37. return false
  38. } else {
  39. return true
  40. }
  41. },
  42. appli () {
  43. if (this.verification()) {
  44. var code = this.$route.query.code.split(' ')
  45. // console.log(code)
  46. this.fullscreenLoading = true;
  47. this.$api.post('auth/resetPassword', {
  48. code: code[0],
  49. email: this.$route.query.email,
  50. password: this.password,
  51. confirmPassword: this.confirmPassword
  52. }).then((res) => {
  53. if (res.code == 0) {
  54. this.$message({
  55. message: this.$t('register.successfully'),
  56. type: 'success'
  57. })
  58. this.fullscreenLoading = false;
  59. setTimeout(()=> {
  60. this.$util.goRoute({
  61. name: 'login'
  62. })
  63. }, 1000)
  64. } else if (res.code == 302) {
  65. this.$message.error(this.$t('register.registered'))
  66. this.fullscreenLoading = false;
  67. } else if (res.code == 407) {
  68. this.$message.error(this.$t('message.submitFailed'))
  69. this.fullscreenLoading = false;
  70. } else {
  71. this.$message.error(res.msg)
  72. this.fullscreenLoading = false;
  73. }
  74. })
  75. }
  76. }
  77. },
  78. mounted () {
  79. },
  80. created () {
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. @media screen and (min-width: 751px) and (max-width: 9999px) {
  86. .box{
  87. overflow: hidden;
  88. }
  89. .toptext{
  90. margin-top: 3rem;
  91. font-size: 16px;
  92. color: #005bab;
  93. background: #cfe0ef;
  94. font-weight: 700;
  95. padding: 2rem 0;
  96. text-align: center;
  97. }
  98. .centerbox /deep/{
  99. width: 100%;
  100. box-shadow: 2px 3px 8px 0px rgba(180, 180, 180, 0.3);
  101. background: #F9FBFD;
  102. padding: 50px;
  103. border: 1px solid #dbdbdb;
  104. .cen_email{
  105. width: 40%;
  106. margin: 0 auto 2rem;
  107. height: 40px;
  108. color: #a7a7a7;
  109. border: 1px solid #ccc;
  110. display: block;
  111. // text-indent: 1rem;
  112. border-radius: 4px;
  113. }
  114. .cen_button{
  115. width: 40%;
  116. margin: 0 auto;
  117. height: 40px;
  118. display: block;
  119. background: #005bab;
  120. border: none;
  121. color: #ffffff;
  122. border-radius: 4px;
  123. font-size: 14px;
  124. }
  125. }
  126. }
  127. @media screen and (min-width: 0px) and (max-width: 750px) {
  128. .box{
  129. overflow: hidden;
  130. }
  131. .toptext{
  132. margin-top: 0.1rem;
  133. height: 0.5rem;
  134. font-size: 16px;
  135. color: #005bab;
  136. background: #cfe0ef;
  137. line-height: 0.5rem;
  138. text-indent: 0.1rem;
  139. font-weight: 700;
  140. }
  141. .centerbox{
  142. width: 100%;
  143. box-shadow: 2px 3px 8px 0px rgba(180, 180, 180, 0.3);
  144. background: #F9FBFD;
  145. padding: 0.3rem;
  146. border: 1px solid #dbdbdb;
  147. .cen_email{
  148. width: 100%;
  149. margin: 0 auto 0.2rem;
  150. height: 40px;
  151. color: #a7a7a7;
  152. border: 1px solid #ccc;
  153. display: block;
  154. // text-indent: 0.1rem;
  155. border-radius: 4px;
  156. }
  157. .cen_button{
  158. width: 100%;
  159. margin: 0 auto;
  160. height: 40px;
  161. display: block;
  162. background: #005bab;
  163. border: none;
  164. color: #ffffff;
  165. border-radius: 4px;
  166. font-size: 14px;
  167. }
  168. }
  169. }
  170. </style>