editPass.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view class="content">
  3. <view class="line">
  4. <view class="input-label">新密码</view>
  5. <view>
  6. <input type="password" v-model="userPwd1" class="input-field" placeholder="请输入当前密码"/>
  7. </view>
  8. </view>
  9. <view class="line">
  10. <view class="input-label">新密码</view>
  11. <view>
  12. <input class="input-field" v-model="userPwd2" type="password" placeholder="请再次输入新密码"/>
  13. </view>
  14. </view>
  15. <view class="submit" @click="submitFn">提交</view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. userPwd1: '',
  23. userPwd2:'',
  24. userId:'',
  25. }
  26. },
  27. onLoad() {
  28. this.userId=uni.getStorageSync('users').userId
  29. },
  30. methods: {
  31. submitFn(){
  32. if(this.userPwd2!=this.userPwd1){
  33. uni.showToast({
  34. icon: 'none',
  35. title: '俩次密码不一致',
  36. duration: 3000
  37. });
  38. return false
  39. }
  40. this.$http('imSys/changePwd', {
  41. userId:this.userId,
  42. userPwd:this.userPwd1
  43. },'POST').then(res => {
  44. if(res.code==0){
  45. uni.showToast({
  46. icon: 'none',
  47. title: '修改成功',
  48. duration: 3000
  49. });
  50. /* uni.navigateTo({
  51. url: './login'
  52. }) */
  53. }
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style>
  60. .submit{
  61. width: 650rpx;
  62. height: 80rpx;
  63. line-height: 80rpx;
  64. text-align: center;
  65. background: #3F90F7;
  66. color: #ffffff;
  67. font-size: 30rpx;
  68. border-radius: 10rpx;
  69. position: fixed;
  70. bottom: 100rpx;
  71. left: 50rpx;
  72. }
  73. .line{
  74. display: flex;
  75. padding: 30rpx 20rpx;
  76. border-bottom: 1px solid #eee;
  77. color: #333333;
  78. }
  79. .input-field{
  80. padding-left: 50rpx;
  81. }
  82. </style>