modifypass.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view>
  3. <z-navbar title="修改密码" back></z-navbar>
  4. <z-card width="630" class="mt-30 flex-n fac step_area">
  5. <view class="step_area_item flex-n fac">
  6. <view class="step_area_num" :class="step==0?'step_area_num_choose':''">1</view>
  7. <view class="step_area_text" :class="step==0?'step_area_text_choose':''">验证原密码</view>
  8. </view>
  9. <view class="line flex-1 mlr-20"></view>
  10. <view class="step_area_item flex-n fac">
  11. <view class="step_area_num" :class="step==1?'step_area_num_choose':''">2</view>
  12. <view class="step_area_text" :class="step==1?'step_area_text_choose':''">设置新密码</view>
  13. </view>
  14. </z-card>
  15. <template v-if="step==0">
  16. <view class="toast_area mlr-30">为保障您的账号安全,修改密码前请填写原密码</view>
  17. <z-card>
  18. <view class="mlr-40 card_area">
  19. <view class="flex-n fac card_area_item">
  20. <view class="card_icon iconfont iconsuotou"></view>
  21. <z-input class="ml-19 flex-1" type="password" align="left" v-model="oldPass" placeholder="请输入原登录密码"></z-input>
  22. </view>
  23. </view>
  24. </z-card>
  25. <z-button class="mt-50" @click="nextStep">下一步</z-button>
  26. <view class="mt-30 forget_pass" @click="gotoForgetPage">忘记原密码</view>
  27. </template>
  28. <template v-else>
  29. <z-card class="mt-40">
  30. <view class="mlr-40 card_area">
  31. <view class="flex-n fac card_area_item">
  32. <view class="card_icon iconfont iconsuotou"></view>
  33. <z-input class="ml-19 flex-1" type="password" align="left" v-model="newPass" placeholder="请设置6-20位新的登录密码"></z-input>
  34. </view>
  35. <view class="line"></view>
  36. <view class="flex-n fac card_area_item">
  37. <view class="card_icon iconfont iconsuotou"></view>
  38. <z-input class="ml-19 flex-1" type="password" align="left" v-model="newPassRepeat" placeholder="请再次输入新的登录密码"></z-input>
  39. </view>
  40. </view>
  41. </z-card>
  42. <z-button class="mt-50" @click="submit">提 交</z-button>
  43. </template>
  44. <u-toast ref="uToast"></u-toast>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. //入参
  52. oldPass:'',
  53. newPass:'',
  54. newPassRepeat:'',
  55. step: 0
  56. }
  57. },
  58. methods:{
  59. //下一步
  60. nextStep() {
  61. this.$axios.post('app/user/verifyOldPassword', {
  62. "passWord": this.oldPass,
  63. }).then(res => {
  64. this.step = 1;
  65. }).catch(err => {
  66. this.$refs.uToast.error(err.msg);
  67. })
  68. },
  69. //忘记密码
  70. gotoForgetPage(){
  71. uni.navigateTo({
  72. url: './forgetpass',
  73. success: res => {},
  74. fail: () => {},
  75. complete: () => {}
  76. });
  77. },
  78. submit(){
  79. if(this.newPass==''||this.newPass.length<6||this.newPass.length>20){
  80. return this.$refs.uToast.error('请输入6-20位新的登录密码');
  81. }
  82. if(this.newPassRepeat==''){
  83. return this.$refs.uToast.error('请再次输入新的登录密码');
  84. }
  85. if(this.newPass!=this.newPassRepeat){
  86. return this.$refs.uToast.error('两次输入的登录密码不同');
  87. }
  88. this.$axios.post('app/user/updatePassword', {
  89. "passWord": this.newPass
  90. }).then(res => {
  91. // this.$refs.uToast.success('密码修改成功,请在登录页重新登录');
  92. uni.showToast({
  93. title:'密码修改成功,请在登录页重新登录,正在跳转……',
  94. icon: 'none',
  95. duration: 2000,
  96. success() {
  97. uni.reLaunch({
  98. url: '../../login/oldlogin'
  99. });
  100. }
  101. })
  102. }).catch(err => {
  103. this.$refs.uToast.error(err.msg);
  104. })
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .step_area {
  111. padding: 24rpx 30rpx;
  112. .step_area_item {
  113. .step_area_num {
  114. width: 54rpx;
  115. height: 54rpx;
  116. border: 1px solid #999999;
  117. border-radius: 50%;
  118. text-align: center;
  119. line-height: 54rpx;
  120. color: #999999;
  121. font-size: 30rpx;
  122. }
  123. .step_area_num_choose {
  124. background: #2481EE;
  125. color: white;
  126. border:1px solid #2481EE;
  127. }
  128. .step_area_text_choose {
  129. color: #2481EE !important;
  130. }
  131. .step_area_text {
  132. color: #999999;
  133. font-size: 30rpx;
  134. margin-left: 25rpx;
  135. }
  136. }
  137. }
  138. .toast_area {
  139. font-size: 24rpx;
  140. color: #666666;
  141. line-height: 90rpx;
  142. }
  143. .card_area {
  144. .card_area_item {
  145. height: 100rpx;
  146. }
  147. .card_icon {
  148. font-size: 40rpx;
  149. min-width: 40rpx;
  150. color: gray;
  151. }
  152. .card_send_message {
  153. font-size: 28rpx;
  154. color: #2481EE;
  155. }
  156. }
  157. .forget_pass{
  158. font-size: 28rpx;
  159. color: #2481EE;
  160. line-height: 60rpx;
  161. margin: 0 auto;
  162. width: fit-content;
  163. }
  164. </style>