edit_pwd.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <u-input v-model="oldPwd" type="password" border="bottom" placeholder="请输入原密码"></u-input>
  5. <u-input v-model="newPwd" type="password" border="bottom" placeholder="请输入新密码"></u-input>
  6. <u-input v-model="again_new_password" type="password" border="bottom" placeholder="请再次输入新密码"></u-input>
  7. <view class="text_style1">密码格式为6-16位数字,字母或符号</view>
  8. </view>
  9. <view class="btn" @click="save">完成</view>
  10. </view>
  11. </template>
  12. <script>
  13. import $api from '@/static/js/api.js'
  14. var that = ''
  15. export default {
  16. data() {
  17. return {
  18. oldPwd: '',
  19. newPwd: '',
  20. again_new_password: '',
  21. }
  22. },
  23. onLoad() {
  24. that = this
  25. },
  26. methods: {
  27. save() {
  28. if($api.formCheck(that.oldPwd,'required') && $api.formCheck(that.newPwd,'required')) {
  29. if(that.oldPwd !== that.newPwd) {
  30. $api.req({
  31. url: '/data/api.business.User/user_password',
  32. method: 'POST',
  33. data: {
  34. old_password: that.oldPwd,
  35. new_password: that.newPwd,
  36. again_new_password: that.again_new_password
  37. }
  38. }, function(res) {
  39. if(res.code == 1) {
  40. console.log(res);
  41. $api.info('修改成功')
  42. $api.jump('/pages/login/login/login')
  43. }
  44. })
  45. } else {
  46. $api.info('请输入与原密码不同的新密码')
  47. }
  48. }
  49. }
  50. },
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .content::v-deep {
  55. background-color: #fff;
  56. padding: 0 30rpx 0;
  57. .u-input {
  58. padding: 28rpx 0 !important;
  59. margin-top: 32rpx;
  60. }
  61. .btn {
  62. margin: 112rpx auto 0;
  63. width: 630rpx;
  64. height: 92rpx;
  65. border-radius: 50rpx;
  66. background-color: #506dff;
  67. color: #fff;
  68. font-size: 36rpx;
  69. text-align: center;
  70. line-height: 92rpx;
  71. }
  72. .text_style1 {
  73. font-size: 24rpx;
  74. color: #999;
  75. margin-top: 32rpx;
  76. }
  77. }
  78. </style>