changePassword.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. API.changePassword(this.form).then((response) => {
  44. uni.hideLoading();
  45. this.form.password=""
  46. this.form.oldPassword=""
  47. uni.showModal({
  48. title:"提示",
  49. content:"密码修改成功!",
  50. showCancel:false
  51. })
  52. }).catch(error => {
  53. uni.showToast({
  54. title: error,
  55. icon: "none"
  56. })
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .main{
  64. background-color: #fff;
  65. margin-top: 24rpx;
  66. .original-password,.new-password{
  67. line-height: 96rpx;
  68. padding:0 32rpx;
  69. display: flex;
  70. align-items: center;
  71. border-bottom: 1px solid rgba(221,221,221,1);
  72. /deep/.u-input__input{
  73. height: 96rpx;
  74. }
  75. }
  76. text{
  77. display: inline-block;
  78. width: 128rpx;
  79. color: rgba(51,51,51,1);
  80. font-size: 32rpx;
  81. }
  82. }
  83. // 确认修改
  84. .confirm{
  85. border-radius: 8px;
  86. background-color: rgba(22,119,255,1);
  87. color: rgba(255,255,255,1);
  88. font-size: 32rpx;
  89. line-height: 88rpx;
  90. margin: 24rpx 32rpx;
  91. }
  92. </style>