resetpwd.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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="titico">*密码必须包含数字、大小写字母、特殊符号且大于8位</view>
  11. <view class="rbtn" @click="submit">提交</view>
  12. </uni-forms>
  13. </view>
  14. </template>
  15. <script>
  16. import { getappCheck } from "@/api/system/user"
  17. export default {
  18. data() {
  19. return {
  20. phone:'',
  21. code:'',
  22. user: {
  23. newPassword: undefined,
  24. confirmPassword: undefined
  25. },
  26. rules: {
  27. newPassword: {
  28. rules: [{
  29. required: true,
  30. errorMessage: '新密码不能为空',
  31. },
  32. {
  33. minLength: 8,
  34. errorMessage: '长度大于8位'
  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. .titico{font-weight: 500;font-size: 24rpx;color: #FF6969;margin-top: 20rpx;}
  86. .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;}
  87. .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;}
  88. .pwd /deep/ .uni-forms-item__label{font-size: 32rpx;font-weight: 500;
  89. color: #161616;flex: 0 0 auto;width: auto !important;}
  90. .pwd /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 32rpx;color: #161616;}
  91. .pwd /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  92. .pwd /deep/ .uni-easyinput__placeholder-class{font-size: 30rpx;}
  93. .pwd /deep/ .uni-easyinput__content-input{font-size: 30rpx;}
  94. .pwd /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;}
  95. </style>