changePassword.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view>
  3. <u-navbar title="修改密码" title-color="#101010"></u-navbar>
  4. <view class="main">
  5. <view class="original-password">
  6. <text>原密码 </text><u-input v-model="form.oldPassword" style="padding: 0 0 0 20px" class="password-input" type="password" placeholder="填写原密码" :password-icon="true" />
  7. </view>
  8. <view class="new-password">
  9. <text>新密码</text><u-input v-model="form.password" style="padding: 0 0 0 20px" class="password-input" type="password" placeholder="创建6-16位组合新密码" :password-icon="true" />
  10. </view>
  11. </view>
  12. <!-- 确认修改 -->
  13. <button class="confirm" @click="changePassword">确认修改</button>
  14. </view>
  15. </template>
  16. <script>
  17. import * as API from '@/apis/pagejs/user.js'
  18. export default {
  19. data() {
  20. return {
  21. form: {
  22. oldPassword: '',
  23. password: '',
  24. },
  25. }
  26. },
  27. methods: {
  28. changePassword(){
  29. if (!this.form.oldPassword) {
  30. uni.showToast({
  31. title: "请输入原密码",
  32. icon: "none"
  33. })
  34. return
  35. }
  36. if (!this.form.password) {
  37. uni.showToast({
  38. title: "请输入新密码",
  39. icon: "none"
  40. })
  41. return
  42. }
  43. uni.showLoading({
  44. title: "加载中",
  45. mask: true,
  46. })
  47. API.changePassword(this.form).then((response) => {
  48. uni.hideLoading();
  49. this.form.password=""
  50. this.form.oldPassword=""
  51. uni.showModal({
  52. title:"提示",
  53. content:"密码修改成功!",
  54. showCancel:false
  55. })
  56. }).catch(error => {
  57. uni.showToast({
  58. title: error,
  59. icon: "none"
  60. })
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .main{
  68. background-color: #fff;
  69. margin-top: 24rpx;
  70. .original-password,.new-password{
  71. line-height: 96rpx;
  72. padding:0 32rpx;
  73. display: flex;
  74. align-items: center;
  75. border-bottom: 1px solid rgba(221,221,221,1);
  76. ::v-deep.u-input__input{
  77. height: 96rpx;
  78. }
  79. }
  80. text{
  81. display: inline-block;
  82. width: 128rpx;
  83. color: rgba(51,51,51,1);
  84. font-size: 32rpx;
  85. }
  86. }
  87. // 确认修改
  88. .confirm{
  89. border-radius: 8px;
  90. background-color: rgba(22,119,255,1);
  91. color: rgba(255,255,255,1);
  92. font-size: 32rpx;
  93. line-height: 88rpx;
  94. margin: 24rpx 32rpx;
  95. }
  96. </style>