editPass.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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('loginInfo').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. setTimeout(function() {
  51. uni.navigateBack(-1)
  52. }, 1000);
  53. /* uni.navigateTo({
  54. url: './login'
  55. }) */
  56. }else{
  57. uni.showToast({
  58. icon: 'none',
  59. title: res.msg,
  60. duration: 3000
  61. });
  62. }
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style>
  69. .submit{
  70. width: 650rpx;
  71. height: 80rpx;
  72. line-height: 80rpx;
  73. text-align: center;
  74. background: #3F90F7;
  75. color: #ffffff;
  76. font-size: 30rpx;
  77. border-radius: 10rpx;
  78. position: fixed;
  79. bottom: 100rpx;
  80. left: 50rpx;
  81. }
  82. .line{
  83. display: flex;
  84. padding: 30rpx 20rpx;
  85. border-bottom: 1px solid #eee;
  86. color: #333333;
  87. }
  88. .input-field{
  89. padding-left: 50rpx;
  90. }
  91. </style>