password.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <!--修改密码-->
  3. <view class="pwd">
  4. <view class="title">闪现出行运维平台</view>
  5. <view class="inp">
  6. <view>
  7. <text class="iconfont iconmima"></text>
  8. <input placeholder="请输入原密码" type="password" v-model="oldPwd"></input>
  9. </view>
  10. <view>
  11. <text class="iconfont iconkey-result"></text>
  12. <input placeholder="请输入新密码" type="password" v-model="newPwd"></input>
  13. </view>
  14. <view>
  15. <text class="iconfont iconkey-result"></text>
  16. <input placeholder="请输入确认密码" type="password" v-model="sPwd"></input>
  17. </view>
  18. </view>
  19. <view class="btn flexC" @click="submit">确认修改</view>
  20. </view>
  21. </template>
  22. <script>
  23. var app = getApp();
  24. export default {
  25. data() {
  26. return {
  27. oldPwd: '', //旧密码
  28. newPwd: '', //新密码
  29. sPwd: '' //确认密码
  30. }
  31. },
  32. methods: {
  33. submit: function() {
  34. if (!this.oldPwd) {
  35. uni.showToast({
  36. title: "原密码不能为空",
  37. icon: 'none'
  38. })
  39. } else if (!this.newPwd) {
  40. uni.showToast({
  41. title: '新密码不能为空',
  42. icon: 'none'
  43. })
  44. } else if (!this.sPwd) {
  45. uni.showToast({
  46. title: '确认密码不能为空',
  47. icon: 'none'
  48. })
  49. } else if (this.newPwd != this.sPwd) {
  50. uni.showToast({
  51. title: '确认密码与新密码不一致',
  52. icon: 'none'
  53. })
  54. } else {
  55. var data = {
  56. ole_password: this.oldPwd
  57. }
  58. app.request('personal/verifyOldPassword', data, 'POST').then(res => {
  59. if (res.statusCode == 400) {
  60. uni.showToast({
  61. title: '原始密码不正确',
  62. icon: 'none'
  63. })
  64. } else {
  65. var data = {
  66. old_password: this.oldPwd,
  67. re_password: this.newPwd,
  68. new_password: this.sPwd,
  69. }
  70. app.request('personal/changePassword', data, 'POST').then(res => {
  71. if (res.statusCode == 200) {
  72. uni.showToast({
  73. title: '修改密码成功',
  74. icon: 'none'
  75. })
  76. uni.clearStorage();
  77. uni.navigateTo({
  78. url: '/pages/login/login'
  79. })
  80. } else {
  81. uni.showToast({
  82. title: '修改密码失败',
  83. icon: 'none'
  84. })
  85. }
  86. })
  87. }
  88. })
  89. }
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. /* pages/password/password.wxss */
  96. .pwd {
  97. width: 85%;
  98. margin: 0 auto;
  99. }
  100. .pwd .title {
  101. width: 80%;
  102. font-size: 40rpx;
  103. font-family: FZCQJW--GB1-0;
  104. font-weight: 400;
  105. color: rgba(135, 135, 135, 1);
  106. padding: 63rpx 0 78rpx 0;
  107. }
  108. .pwd .inp>view {
  109. display: flex;
  110. margin-top: 60rpx;
  111. border-bottom: 1px solid #ccc;
  112. }
  113. .inp .iconfont {
  114. font-size: 40rpx;
  115. color: #878787;
  116. margin-left: 15rpx;
  117. }
  118. .inp view input {
  119. font-size: 28rpx;
  120. width: 80%;
  121. padding: 0 0 15rpx 10rpx;
  122. }
  123. .inp view .placeholder {
  124. color: #b6b6b6;
  125. font-size: 28rpx;
  126. }
  127. .btn {
  128. width: 600rpx;
  129. height: 88rpx;
  130. line-height: 88rpx;
  131. margin: 0 auto;
  132. text-align: center;
  133. background: rgba(24, 213, 185, 1);
  134. box-shadow: 0rpx 8rpx 13rpx 0rpx rgba(100, 239, 218, 1);
  135. border-radius: 10rpx;
  136. font-size: 32rpx;
  137. font-family: PingFang SC;
  138. font-weight: 500;
  139. color: rgba(255, 255, 255, 1);
  140. margin-top: 80rpx !important;
  141. }
  142. </style>