updatePassword.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="content">
  3. <view class="updatePassword-wrap">
  4. <view class="username item">
  5. <text>新密码:</text>
  6. <uni-easyinput :inputBorder="false" v-model="password"
  7. class="input"
  8. type="text"
  9. placeholder="请输入新密码" />
  10. </view>
  11. <view class="password item">
  12. <text>确认密码:</text>
  13. <uni-easyinput v-model="rePassword"
  14. :inputBorder="false"
  15. class="input"
  16. type="text" placeholder="请确认密码">
  17. </uni-easyinput>
  18. </view>
  19. <button type="primary" @click="submit" class="submit-BT">提交</button>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {updatePwd} from '@/api/system.js'
  25. export default {
  26. data() {
  27. return {
  28. password: "",
  29. rePassword: "",
  30. }
  31. },
  32. methods: {
  33. submit() {
  34. let rePassword = (this.rePassword).trim();
  35. let password = (this.password).trim();
  36. if (password.length < 1) {
  37. uni.showToast({
  38. title: '请填写新密码',
  39. icon: "error"
  40. })
  41. return;
  42. }
  43. if (rePassword!==password) {
  44. uni.showToast({
  45. title: '两次密码不一致',
  46. icon: "error"
  47. })
  48. return;
  49. }
  50. updatePwd({
  51. password,
  52. rePassword
  53. }).then(()=>{
  54. uni.showToast({
  55. title:'修改成功',
  56. duration:2000,
  57. complete() {
  58. uni.reLaunch({
  59. url:'/pages/login/index'
  60. })
  61. }
  62. })
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .content {
  70. .head {
  71. font-size: 50upx;
  72. text-align: center;
  73. padding: 40upx 0;
  74. letter-spacing: 2upx;
  75. }
  76. .updatePassword-wrap {
  77. margin: 100upx auto 0;
  78. box-sizing: border-box;
  79. padding: 20upx 30upx;
  80. border-radius: 8upx;
  81. .item {
  82. display: flex;
  83. justify-content: flex-start;
  84. align-items: center;
  85. height: 90upx;
  86. font-size: 32upx;
  87. line-height: 90upx;
  88. background-color: #fff;
  89. border-radius: 50upx;
  90. padding: 0 20upx;
  91. .input{
  92. width: 520upx;
  93. border: none;
  94. }
  95. &.password {
  96. margin-top: 40upx;
  97. }
  98. }
  99. .tip {
  100. text-align: right;
  101. padding: 18upx 0;
  102. font-size: 28upx;
  103. }
  104. .submit-BT {
  105. width: 600rpx;
  106. height: 72rpx;
  107. line-height: 72rpx;
  108. text-align: center;
  109. background:#3D90F4;
  110. border-radius: 42rpx;
  111. font-size: 32rpx;
  112. font-family: PingFang SC;
  113. font-weight: 400;
  114. color: #FFFFFF;
  115. z-index: 999;
  116. margin: 100rpx auto;
  117. }
  118. }
  119. }
  120. </style>