password.1.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view>
  3. <view class="uni-common-mt">
  4. <view class="uni-form-item uni-column">
  5. <view class="title">输入原密码</view>
  6. <view class="with-fun">
  7. <input class="uni-input" placeholder="请输入密码" :password="showPassword[0]" v-model="formData.pass1" />
  8. <view class="uni-icon uni-icon-eye" :class="[!showPassword[0] ? 'uni-active' : '']" @click="changePassword(0)"></view>
  9. </view>
  10. </view>
  11. <view class="uni-form-item uni-column">
  12. <view class="title">输入新密码</view>
  13. <view class="with-fun">
  14. <input class="uni-input" placeholder="请输入密码" :password="showPassword[1]" v-model="formData.pass2" />
  15. <view class="uni-icon uni-icon-eye" :class="[!showPassword[1] ? 'uni-active' : '']" @click="changePassword(1)"></view>
  16. </view>
  17. </view>
  18. <view class="uni-form-item uni-column">
  19. <view class="title">确认新密码</view>
  20. <view class="with-fun">
  21. <input class="uni-input" placeholder="请输入密码" :password="showPassword[2]" v-model="formData.pass3" />
  22. <view class="uni-icon uni-icon-eye" :class="[!showPassword[2] ? 'uni-active' : '']" @click="changePassword(2)"></view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="send">
  27. <button class="mini-btn send_button" type="primary" size="mini" @tap="send">保 存</button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import _action from '../../common/_action';
  33. export default {
  34. data() {
  35. return {
  36. showPassword: [ true,true,true ],
  37. formData: {
  38. pass1: '',
  39. pass2: '',
  40. pass3: '',
  41. }
  42. }
  43. },
  44. computed: {
  45. },
  46. methods: {
  47. changePassword(num) {
  48. this.$set(this.showPassword,num,!this.showPassword[num]);
  49. },
  50. send(){
  51. let _this = this;
  52. if(!_this.formData.pass1 || _this.formData.pass1.length < 6){
  53. uni.showModal({
  54. content: '请输入原密码,不能小于6位',
  55. });
  56. return;
  57. }
  58. if(!_this.formData.pass2 || _this.formData.pass2.length < 6){
  59. uni.showModal({
  60. content: '请输入新密码,不能小于6位',
  61. });
  62. return;
  63. }
  64. if(!_this.formData.pass3 || _this.formData.pass3.length < 6){
  65. uni.showModal({
  66. content: '请确认新密码,不能小于6位',
  67. });
  68. return;
  69. }
  70. if(_this.formData.pass2 !== _this.formData.pass3){
  71. uni.showModal({
  72. content: '两次新密码不一致',
  73. });
  74. return;
  75. }
  76. _this.$httpSend({
  77. path: '/im/set/password',
  78. data: _this.formData,
  79. success() {
  80. uni.showToast({
  81. title: '已修改,请重新登陆',
  82. });
  83. setTimeout(() => {
  84. _action.checkFail();
  85. },2000);
  86. }
  87. });
  88. },
  89. },
  90. onLoad() {
  91. this.platform = uni.getSystemInfoSync().platform
  92. }
  93. }
  94. </script>
  95. <style scoped>
  96. .title {
  97. padding: 10upx 25upx;
  98. }
  99. .uni-icon-clear,
  100. .uni-icon-eye {
  101. color: #999;
  102. }
  103. .send {
  104. width: 100%;
  105. text-align: center;
  106. }
  107. .send_button {
  108. background-color: #1AAD19 !important;
  109. margin-top: 30upx;
  110. }
  111. </style>