editID.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="editPwd">
  3. <view class="input-li">
  4. <text class="custom-icon custom-icon-mima"></text>
  5. <input placeholder="账户" placeholder-class="input-pl" type="text" v-model="mobile" />
  6. </view>
  7. <view class="input-li">
  8. <text class="custom-icon custom-icon-mima"></text>
  9. <input placeholder="密码" placeholder-class="input-pl" type="password" v-model="password" />
  10. </view>
  11. <view class="conform-btn" @click="editID">确认修改</view>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. mapActions
  17. } from 'vuex';
  18. export default {
  19. data() {
  20. return {
  21. mobile: "",
  22. password: "",
  23. };
  24. },
  25. computed: {
  26. userInfo() {
  27. return this.$store.state.userInfo;
  28. },
  29. },
  30. methods: {
  31. ...mapActions({
  32. logout: 'logout'
  33. }),
  34. editID() {
  35. if (!this.mobile.trim() || !this.password) {
  36. this.$u.toast('账号密码不能为空');
  37. return
  38. }
  39. this.$u.api.updateUserMobile({
  40. mobile: this.mobile,
  41. userCenterId: this.userInfo.userCenterId,
  42. password: this.password
  43. }).then(res => {
  44. this.$u.toast('修改成功,请重新登录');
  45. setTimeout(() => {
  46. this.logout();
  47. }, 500);
  48. });
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scope>
  54. .editPwd {
  55. padding-top: 50rpx;
  56. }
  57. .input-li {
  58. width: 702rpx;
  59. margin: 30rpx auto 0;
  60. border: 1px solid #eeeeee;
  61. line-height: 80rpx;
  62. border-radius: 8rpx;
  63. padding: 0 30rpx;
  64. .input-pl {
  65. font-size: 24rpx;
  66. font-weight: 300;
  67. }
  68. .custom-icon {
  69. color: #444444;
  70. font-size: 32rpx;
  71. }
  72. input {
  73. padding-left: 30rpx;
  74. display: inline-block;
  75. vertical-align: middle;
  76. }
  77. }
  78. .conform-btn {
  79. width: 680rpx;
  80. color: #ffffff;
  81. line-height: 80rpx;
  82. background-color: $uni-color-primary;
  83. text-align: center;
  84. border-radius: 10rpx;
  85. margin: 60rpx auto 0;
  86. }
  87. </style>