resetpwd.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="pwd-retrieve-container pwd">
  3. <uni-forms ref="form" :value="user" >
  4. <uni-forms-item name="newPassword" label="新密码">
  5. <uni-easyinput :inputBorder="false" type="password" v-model="user.newPassword" placeholder="请输入新密码" />
  6. </uni-forms-item>
  7. <uni-forms-item name="confirmPassword" label="确认密码">
  8. <uni-easyinput :inputBorder="false" type="password" v-model="user.confirmPassword" placeholder="请确认新密码" />
  9. </uni-forms-item>
  10. <view class="rbtn" @click="submit">提交</view>
  11. </uni-forms>
  12. </view>
  13. </template>
  14. <script>
  15. import { getappCheck } from "@/api/system/user"
  16. export default {
  17. data() {
  18. return {
  19. phone:'',
  20. code:'',
  21. user: {
  22. newPassword: undefined,
  23. confirmPassword: undefined
  24. },
  25. rules: {
  26. newPassword: {
  27. rules: [{
  28. required: true,
  29. errorMessage: '新密码不能为空',
  30. },
  31. {
  32. minLength: 6,
  33. maxLength: 20,
  34. errorMessage: '长度在 6 到 20 个字符'
  35. }
  36. ]
  37. },
  38. confirmPassword: {
  39. rules: [{
  40. required: true,
  41. errorMessage: '确认密码不能为空'
  42. }, {
  43. validateFunction: (rule, value, data) => data.newPassword === value,
  44. errorMessage: '两次输入的密码不一致'
  45. }
  46. ]
  47. }
  48. }
  49. }
  50. },
  51. onReady() {
  52. this.$refs.form.setRules(this.rules)
  53. },
  54. onLoad(e) {
  55. this.phone=e.phone;
  56. this.code=e.code;
  57. },
  58. methods: {
  59. submit() {
  60. var that = this;
  61. this.$refs.form.validate().then(res => {
  62. var params={
  63. phone:this.phone,
  64. code:this.code,
  65. password:this.user.newPassword
  66. }
  67. getappCheck(params).then(response => {
  68. that.$toast("重置成功")
  69. setTimeout(function(){
  70. that.$tab.reLaunch('/pages/login')
  71. },1500)
  72. })
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. page {
  80. background-color: #f5f5f5;
  81. }
  82. .pwd-retrieve-container {
  83. padding: 10rpx 36rpx;
  84. }
  85. .pwd .rbtn{width: 100%;height: 98rpx;background: $com-cd3;border-radius: 49rpx;text-align: center;line-height: 98rpx;font-size: 32rpx;font-weight: bold;color: #FFFEFE;margin-top: 68rpx;}
  86. .pwd /deep/ .uni-forms-item{height: 126rpx;background: #FFFFFF;border-radius: 18rpx;margin-top: 30rpx;padding: 0 40rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;}
  87. .pwd /deep/ .uni-forms-item__label{font-size: 32rpx;font-weight: 500;
  88. color: #161616;flex: 0 0 auto;width: auto !important;}
  89. .pwd /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 32rpx;color: #161616;}
  90. .pwd /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  91. .pwd /deep/ .uni-easyinput__placeholder-class{font-size: 30rpx;}
  92. .pwd /deep/ .uni-easyinput__content-input{font-size: 30rpx;}
  93. .pwd /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;}
  94. </style>