index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="changePwd">
  3. <u-navbar ref="uNavbar" :border-bottom="false" :back-icon-color="setNav.backColor" :is-back="setNav.isdisPlayNavTitle"
  4. :title-size="setNav.size" :title-bold="setNav.bold" :title="setNav.navTitle" :title-color="setNav.color" :background="setNav"></u-navbar>
  5. <view class="input">
  6. <view class="lable">旧密码</view>
  7. <input type="text" v-model="oldPassword" placeholder="请输入旧密码" />
  8. </view>
  9. <view class="input">
  10. <view class="lable">新密码</view>
  11. <input type="text" v-model="newPassword" placeholder="请输入新密码" />
  12. </view>
  13. <view class="input">
  14. <view class="lable">再次确认密码</view>
  15. <input type="text" v-model="newPassword1" placeholder="请再次输入新密码" />
  16. </view>
  17. <view class="btn" @click="getQueryList">确认修改</view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. setNav: {
  25. backgroundColor: '#fff', //背景色
  26. color: '##343434', //字体颜色
  27. bold: true,
  28. size: '36',
  29. backColor: '##343434',
  30. isdisPlayNavTitle: true, //是否显示返回按钮
  31. navTitle: '修改密码' //导航标题
  32. },
  33. oldPassword: '',
  34. newPassword: '',
  35. newPassword1: '',
  36. }
  37. },
  38. onLoad() {
  39. },
  40. computed: {
  41. },
  42. methods: {
  43. async getQueryList() {
  44. if (!this.oldPassword) {
  45. return uni.showToast({
  46. 'title': '请输入旧密码',
  47. icon: 'none'
  48. })
  49. }
  50. if (!this.newPassword) {
  51. return uni.showToast({
  52. 'title': '请输入新密码',
  53. icon: 'none'
  54. })
  55. }
  56. if (!this.newPassword1) {
  57. return uni.showToast({
  58. 'title': '请再次输入新密码',
  59. icon: 'none'
  60. })
  61. }
  62. if (this.newPassword != this.newPassword1) {
  63. return uni.showToast({
  64. 'title': '新密码不匹配',
  65. icon: 'none'
  66. })
  67. }
  68. let res = await this.$u.put(`system/user/profile/updatePwd?oldPassword=${this.oldPassword}&newPassword=${this.newPassword}`, {
  69. "oldPassword": this.oldPassword,
  70. "newPassword": this.newPassword
  71. })
  72. console.log(res)
  73. if (res.code ==500){
  74. uni.showToast({
  75. 'title': res.msg,
  76. icon: 'none'
  77. })
  78. } else {
  79. uni.showToast({
  80. 'title': res.msg
  81. })
  82. setTimeout(function(){
  83. uni.navigateBack({
  84. })
  85. }, 1000)
  86. }
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .changePwd {
  93. height: 100%;
  94. background: #fff;
  95. .input {
  96. display: flex;
  97. align-items: center;
  98. padding: 22rpx 34rpx;
  99. font-size: 28rpx;
  100. font-weight: 500;
  101. color: #343434;
  102. input {
  103. font-size: 28rpx;
  104. font-weight: 400;
  105. color: #AAAAAA;
  106. flex: 1;
  107. text-align: right;
  108. }
  109. }
  110. .btn {
  111. width: 90%;
  112. height: 82rpx;
  113. background: #009FE8;
  114. border-radius: 6px;
  115. margin: 100rpx auto;
  116. color: #fff;
  117. text-align: center;
  118. line-height: 82rpx;
  119. font-size: 28rpx;
  120. }
  121. }
  122. </style>