No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

143 líneas
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 #EAF1FF;
  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. font-weight: bold;
  114. }
  115. .inpTextBox1 {
  116. width: 410rpx;
  117. font-size: 32rpx;
  118. padding: 0 20rpx;
  119. box-sizing: border-box;
  120. color: #333;
  121. }
  122. .save {
  123. width: 640rpx;
  124. height: 87rpx;
  125. text-align: center;
  126. line-height: 87rpx;
  127. color: #fff;
  128. font-size: 32rpx;
  129. background: #0A6EE9;
  130. margin: 0 auto;
  131. margin-top: 120rpx;
  132. }
  133. </style>