changePassWord.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="content">
  3. <view class="messageBg">
  4. <!-- 新密码 -->
  5. <view class="message line">
  6. <view class="leftTitle">新密码:</view>
  7. <input password="tue" type="text" class="passWord" placeholder="请输入新密码" v-model="newPW" @confirm="newPWDone" />
  8. </view>
  9. <!-- 确认密码 -->
  10. <view class="message">
  11. <view class="leftTitle">确认密码:</view>
  12. <input password="tue" type="text" class="passWord" placeholder="请再次输入新密码" v-model="surePW" @confirm="surePWDone" />
  13. </view>
  14. </view>
  15. <!-- 修改 -->
  16. <view class="sureBtn" @click="changePW">确定修改</view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. newPW: '',
  24. surePW: '',
  25. }
  26. },
  27. methods: {
  28. newPWDone(e) {
  29. this.newPW = e.target.value;
  30. console.log(this.newPW);
  31. },
  32. surePWDone(e) {
  33. this.surePW = e.target.value;
  34. console.log(this.surePW);
  35. },
  36. changePW() {
  37. if (!this.newPW) {
  38. uni.showToast({
  39. title: '密码不能为空',
  40. duration: 2000,
  41. icon: 'none'
  42. })
  43. return
  44. }
  45. if ((this.surePW != this.newPW)) {
  46. uni.showToast({
  47. title: '请确认密码',
  48. duration: 2000,
  49. icon: 'none'
  50. })
  51. this.surePW = '';
  52. return
  53. }
  54. uni.showLoading({
  55. title: '加载中'
  56. })
  57. this.$http('accompany/SuperAccounts/updatePwd', {
  58. pwd: this.surePW,
  59. }, 'POST').then(res => {
  60. uni.hideLoading()
  61. uni.showToast({
  62. title: '修改成功',
  63. })
  64. setTimeout(function(){
  65. uni.navigateBack({
  66. })
  67. },1000)
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style>
  74. .content {
  75. background-color: #F4F5F7;
  76. min-height: 100vh;
  77. padding: 20rpx 24rpx;
  78. }
  79. /* #ifdef H5 */
  80. .content {
  81. background-color: #F4F5F7;
  82. min-height: calc(100vh - 44px);
  83. padding: 20rpx 24rpx;
  84. }
  85. /* #endif */
  86. .messageBg,
  87. .sureBtn {
  88. background-color: #FFFFFF;
  89. border-radius: 10rpx;
  90. margin: 20rpx 0rpx;
  91. }
  92. .message {
  93. display: flex;
  94. justify-content: flex-start;
  95. line-height: 98rpx;
  96. align-items: center;
  97. }
  98. .line {
  99. border-bottom: 1rpx solid #EEEEEE;
  100. }
  101. .leftTitle {
  102. font-size: 28rpx;
  103. color: #3C3C3C;
  104. margin-left: 20rpx;
  105. width: 140rpx;
  106. }
  107. .passWord {
  108. flex-grow: 1;
  109. font-size: 28rpx;
  110. color: #999999;
  111. margin-left: 52rpx;
  112. margin-right: 20rpx;
  113. }
  114. .sureBtn {
  115. line-height: 98rpx;
  116. text-align: center;
  117. color: #FFFFFF;
  118. background-color: #FF8700;
  119. }
  120. </style>