江西小程序管理端
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.

120 lines
2.3 KiB

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