revisePass.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="index">
  3. <view class="top">
  4. <image src="../../static/image/login-bg.png" mode="widthFix" class="bg">
  5. <view class="top-text">
  6. <view class="">
  7. 实验中心
  8. </view>
  9. <view class="">
  10. 开放预约平台
  11. </view>
  12. </view>
  13. </image>
  14. <!-- <image src="../../static/image/logo.png" mode="widthFix" class="logo"></image> -->
  15. </view>
  16. <view class="login-form">
  17. <view class="input">
  18. <u-input v-model="password" type="password" :password-icon="true" height="102" placeholder="请填写新密码" />
  19. </view>
  20. <view class="input">
  21. <u-input v-model="passwordCon" type="password" :password-icon="true" height="102"
  22. placeholder="请确认新密码" />
  23. </view>
  24. <view class="button" @click="doLogin()">
  25. 确定
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import Base64 from 'base-64';
  32. export default {
  33. data() {
  34. return {
  35. password: '',
  36. passwordCon: '',
  37. }
  38. },
  39. onShow() {
  40. },
  41. onHide() {
  42. },
  43. methods: {
  44. doLogin() {
  45. if (!this.password) {
  46. this.$u.toast('密码不能为空')
  47. return
  48. }
  49. if (!this.passwordCon) {
  50. this.$u.toast('确认密码不能为空')
  51. return
  52. }
  53. var patrn = new RegExp(
  54. "([\u4E00-\u9FFF]|[\u3002\uff1b\uff0c\uff1a\u201c\u201d\uff08\uff09\u3001\uff1f\u300a\u300b\uff01\u3010\u3011\uffe5])+",
  55. "g");
  56. if (patrn.exec(this.password)) {
  57. uni.showToast({
  58. title: '您输入的密码中含有中文字符请重新输入!',
  59. icon: 'none'
  60. })
  61. return
  62. }
  63. // let base64 = new Base64()
  64. let data = {
  65. id: this.$store.state.vuex_user.id,
  66. password: this.password,
  67. password_confirmation: this.passwordCon
  68. }
  69. this.$u.post('/auth/reset-password', data).then(res => {
  70. this.$u.toast('修改成功')
  71. setTimeout(() => {
  72. uni.navigateBack()
  73. }, 1500)
  74. // this.$u.vuex('vuex_token', 'bearer ' + res.data.token);
  75. // this.$u.vuex('vuex_user', res.data.user);
  76. // this.$u.vuex('vuex_islogin', true);
  77. // this.$u.vuex('vuex_token_time', new Date().getTime())
  78. // if (this.is_rember) {
  79. // let account = {
  80. // username: this.username,
  81. // password: this.password,
  82. // }
  83. // this.$u.vuex('vuex_account', account)
  84. // } else {
  85. // this.$u.vuex('vuex_account', '')
  86. // }
  87. // uni.switchTab({
  88. // url: '../index/index'
  89. // })
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .index {
  97. height: 100vh;
  98. // background-color: #fdfdfd;
  99. overflow: hidden;
  100. }
  101. .top {
  102. position: relative;
  103. text-align: center;
  104. font-size: 30px;
  105. font-weight: bold;
  106. height: 30vh;
  107. background-color: #3665FF;
  108. color: #fff;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. .bg {
  113. width: 100%;
  114. position: absolute;
  115. bottom: 0;
  116. left: 0;
  117. height: 30vh;
  118. opacity: 0.2;
  119. }
  120. .logo {
  121. text-align: center;
  122. margin: 0 auto;
  123. height: 53px;
  124. overflow: hidden;
  125. }
  126. }
  127. .login-form {
  128. padding: 20px 15px;
  129. width: 90%;
  130. margin: 0 auto;
  131. margin-top: 40px;
  132. .input {
  133. margin-bottom: 15px;
  134. background-color: #F7F8FA;
  135. border-radius: 26px;
  136. // height: 52px;
  137. // line-height: 52px;
  138. border: none !important;
  139. .view {
  140. width: 100px;
  141. height: 30px;
  142. background: #3665FF;
  143. color: white;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. border-radius: 4px;
  148. }
  149. }
  150. ::v-deep {
  151. .u-input {
  152. padding: 0 15px !important;
  153. }
  154. }
  155. .button {
  156. width: 90%;
  157. text-align: center;
  158. background-color: #3665FF;
  159. height: 52px;
  160. line-height: 52px;
  161. border-radius: 26px;
  162. color: #fff;
  163. margin: 0 auto;
  164. margin-top: 40px;
  165. font-size: 16px;
  166. font-weight: 550;
  167. }
  168. }
  169. </style>