You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

142 lines
3.2 KiB

  1. <template>
  2. <view style="background: #F8F8F8;width: 100%;height: 100vh;">
  3. <view class="inpText" style="margin-top: 20rpx;">
  4. <view class="inpTextBox">
  5. <view class="inpTextLable">
  6. <view class="inpTextName">原密码</view>
  7. </view>
  8. <input placeholder="请输入原密码" placeholder-class="inpTextBox" class="inpTextBox1" maxlength="12"
  9. v-model="password" type="text"></input>
  10. </view>
  11. </view>
  12. <view class="inpText">
  13. <view class="inpTextBox">
  14. <view class="inpTextLable">
  15. <view class="inpTextName">新密码</view>
  16. </view>
  17. <input placeholder="请输入6-12位新密码" placeholder-class="inpTextBox" class="inpTextBox1" maxlength="12"
  18. v-model="newPassword" type="password"></input>
  19. </view>
  20. </view>
  21. <view class="inpText" >
  22. <view class="inpTextBox" style="border: none;">
  23. <view class="inpTextLable">
  24. <view class="inpTextName">确认密码</view>
  25. </view>
  26. <input placeholder="请确认密码" placeholder-class="inpTextBox" class="inpTextBox1" maxlength="12"
  27. v-model="queryPassword" type="password"></input>
  28. </view>
  29. </view>
  30. <button class="save" @tap="savePassword">保存</button>
  31. </view>
  32. </template>
  33. <script>
  34. var app = getApp();
  35. var util = require("../../utils/util.js");
  36. var config = require("../../config");
  37. export default {
  38. data() {
  39. return {
  40. password: "",
  41. newPassword: "",
  42. queryPassword: ""
  43. };
  44. },
  45. methods: {
  46. // 修改密码
  47. savePassword() {
  48. if (this.newPassword == "" || this.queryPassword == "" || this.password == "") {
  49. uni.showModal({
  50. cancelColor: "#999999",
  51. title: '提示',
  52. content: '输入框不能为空',
  53. showCancel: false
  54. });
  55. } else if (this.newPassword.length < 6) {
  56. uni.showModal({
  57. cancelColor: "#999999",
  58. title: '提示',
  59. content: '新密码不能小于6位',
  60. showCancel: false
  61. });
  62. } else if (this.newPassword == this.queryPassword) {
  63. var params = {
  64. oldPassword: this.password,
  65. newPassword: this.newPassword,
  66. qPassword: this.queryPassword
  67. };
  68. util.getRequestPromise(config.service.updatePassword, params).then(data => {
  69. uni.clearStorage();
  70. uni.navigateTo({
  71. url: '/pages/login/index'
  72. });
  73. });
  74. } else {
  75. uni.showModal({
  76. title: '提示',
  77. cancelColor: "#999999",
  78. content: '两次密码不一致',
  79. showCancel: false
  80. });
  81. }
  82. }
  83. }
  84. };
  85. </script>
  86. <style>
  87. .inpText {
  88. width: 100%;
  89. box-sizing: border-box;
  90. padding: 0 20rpx;
  91. background-color: #FFFFFF;
  92. }
  93. .inpTextBox {
  94. color: #BBBFC8;
  95. text-align: left;
  96. border-bottom: 1px solid #EEEEEE;
  97. display: -webkit-box;
  98. display: -webkit-flex;
  99. display: flex;
  100. -webkit-box-align: center;
  101. -webkit-align-items: center;
  102. align-items: center;
  103. height: 109rpx;
  104. }
  105. .inpTextLable {
  106. width: 155rpx;
  107. display: flex;
  108. align-items: center;
  109. }
  110. .inpTextName {
  111. color: #020F28;
  112. font-size: 32rpx;
  113. }
  114. .inpTextBox1 {
  115. width: 410rpx;
  116. font-size: 32rpx;
  117. padding: 0 20rpx;
  118. box-sizing: border-box;
  119. color: #333;
  120. }
  121. .save {
  122. width: 640rpx;
  123. height: 87rpx;
  124. text-align: center;
  125. line-height: 87rpx;
  126. color: #fff;
  127. font-size: 32rpx;
  128. background: #0A6EE9;
  129. margin: 0 auto;
  130. margin-top: 120rpx;
  131. }
  132. </style>