resetPassword.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="page">
  3. <view class="info">
  4. <u--form labelPosition="left" :model="info" ref="ownerForm" labelWidth="80" errorType="message"
  5. :labelStyle="{fontWeight:'bold',color:'#333'}">
  6. <u-form-item label="旧密码" borderBottom>
  7. <u--input v-model="info.oldPassWord" border="none" clearable placeholder="请输入旧密码"
  8. placeholderStyle="color:#999"></u--input>
  9. </u-form-item>
  10. <u-form-item label="新密码" borderBottom>
  11. <u--input v-model="info.newPassWord" border="none" clearable placeholder="请输入8-20位的字母,数字的组合"
  12. placeholderStyle="color:#999" :password="isHidePassword">
  13. </u--input>
  14. </u-form-item>
  15. <u-form-item label="确认密码" borderBottom>
  16. <u--input v-model="newPassWord" border="none" clearable placeholder="请确认密码"
  17. placeholderStyle="color:#999" :password="isHidePassword">
  18. </u--input>
  19. </u-form-item>
  20. </u--form>
  21. </view>
  22. <view class="btn dis a-c j-c " @click="save">
  23. 确定
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. mapState,
  30. mapMutations
  31. } from "vuex"
  32. export default {
  33. data() {
  34. return {
  35. isHidePassword: true, //是否隐藏密码
  36. info: {
  37. oldPassWord: "", //旧密码
  38. newPassWord: "", //新密码
  39. },
  40. newPassWord: "",
  41. }
  42. },
  43. onShow() {
  44. },
  45. onLoad() {
  46. },
  47. computed: {},
  48. methods: {
  49. ...mapMutations(['emptyUserInfo']),
  50. async save() {
  51. if (!this.info.oldPassWord) {
  52. uni.showToast({
  53. title: '旧密码为空',
  54. icon: 'none'
  55. });
  56. return;
  57. }
  58. if (!this.info.newPassWord) {
  59. uni.showToast({
  60. title: '新密码为空',
  61. icon: 'none'
  62. });
  63. return;
  64. }
  65. if (!this.newPassWord) {
  66. uni.showToast({
  67. title: '确认密码为空',
  68. icon: 'none'
  69. });
  70. return;
  71. }
  72. if (this.info.newPassWord !== this.newPassWord) {
  73. uni.showToast({
  74. title: '新密码要与确认密码一致',
  75. icon: 'none'
  76. });
  77. return;
  78. }
  79. let res = await this.$http.post('/auth/modifyPass', this.info);
  80. if (res.code == 200) {
  81. uni.showToast({
  82. title: '密码修改成功,请重新登录',
  83. icon: 'none'
  84. });
  85. this.emptyUserInfo();
  86. setTimeout(() => {
  87. uni.reLaunch({
  88. url: "/pages/login/login"
  89. })
  90. }, 1500);
  91. } else {
  92. uni.showToast({
  93. title: res.msg,
  94. icon: 'none'
  95. });
  96. }
  97. },
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. page {
  103. background-color: #fff;
  104. padding: 30rpx 60rpx;
  105. box-sizing: border-box;
  106. }
  107. .info {}
  108. .btn {
  109. padding: 20rpx;
  110. box-sizing: border-box;
  111. background: #FDE935;
  112. border-radius: 45rpx 45rpx 45rpx 45rpx;
  113. margin-top: 100rpx;
  114. font-size: 36rpx;
  115. color: #1F1F1F;
  116. font-weight: bold;
  117. }
  118. ::v-deep {
  119. .u-form-item__body {
  120. padding: 34rpx 0;
  121. }
  122. }
  123. </style>