You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.4 KiB

9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="pageBg">
  3. <view class="pageBgImg">
  4. <topNavbar title="修改密码"></topNavbar>
  5. <view class="form pad">
  6. <view class="card">
  7. <view class="form-item">
  8. <view class="lab">原密码</view>
  9. <view class="inputBox my">
  10. <u-input placeholder="输入旧密码" v-model="FormData.oldPwd" border="none"></u-input>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="card">
  15. <view class="form-item border">
  16. <view class="lab">新密码</view>
  17. <view class="inputBox my">
  18. <u-input placeholder="输入新密码" v-model="FormData.pwd1" border="none"></u-input>
  19. </view>
  20. </view>
  21. <view class="form-item">
  22. <view class="lab">新密码</view>
  23. <view class="inputBox my">
  24. <u-input placeholder="再次输入新密码" v-model="FormData.pwd2" border="none"></u-input>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="btnBg" :class="{hui: !highlight}" @click="updatePasswordFn">确认修改</view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import { updatePassword } from '@/config/api.js'
  35. export default {
  36. data() {
  37. return {
  38. FormData: {
  39. oldPwd: '',
  40. pwd1: '',
  41. pwd2: '',
  42. }
  43. }
  44. },
  45. computed: {
  46. highlight() {
  47. let { FormData } = this
  48. if(FormData.oldPwd&&FormData.pwd1&&FormData.pwd2) {
  49. return true
  50. }else {
  51. return false
  52. }
  53. }
  54. },
  55. methods: {
  56. async updatePasswordFn() {
  57. let obj = {
  58. newPassword: this.FormData.pwd1,
  59. oldPassword: this.FormData.oldPwd
  60. }
  61. const res = await updatePassword(obj)
  62. if(res.code==0) {
  63. this.$u.toast('密码修改成功')
  64. setTimeout(()=>{
  65. uni.switchTab({
  66. url: '/pages/tabbar/mine/index'
  67. })
  68. },1500)
  69. this.FormData = {
  70. oldPwd: '',
  71. pwd1: '',
  72. pwd2: '',
  73. }
  74. }
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .pageBgImg {
  81. .form {
  82. .card {
  83. padding: 0 20rpx;
  84. margin-bottom: 20rpx;
  85. .form-item {
  86. height: 104rpx;
  87. line-height: 104rpx;
  88. font-size: 28rpx;
  89. color: #333;
  90. display: flex;
  91. align-items: center;
  92. &.border {
  93. border-bottom: 1px solid #F6F6F6;
  94. }
  95. .lab {
  96. width: 180rpx;
  97. }
  98. .inputBox {
  99. flex: 1;
  100. u-input {
  101. }
  102. }
  103. }
  104. }
  105. .btnBg {
  106. width: 396rpx;
  107. margin: 136rpx auto;
  108. &.hui {
  109. opacity: 0.3;
  110. }
  111. }
  112. }
  113. }
  114. </style>