changePassword.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="">
  3. <navBar :name="$t('修改密码')"></navBar>
  4. <view class="changePassword-page">
  5. <ZxInput
  6. v-model="form.old_passwd"
  7. :placeholder="$t('请输入旧密码')"
  8. isPassword
  9. />
  10. <ZxInput
  11. v-model="form.new_passwd"
  12. :placeholder="$t('请输入新密码')"
  13. isPassword
  14. />
  15. <ZxInput
  16. v-model="form.second_passwd"
  17. :placeholder="$t('请再次输入新密码')"
  18. isPassword
  19. />
  20. <view :class="['zx-form-btn', isSubmit && 'is-submit']" style="margin-top: 64rpx;" @tap="changePassword">
  21. {{ $t('确认修改') }}
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. var storage = require('../../common/storage.js');
  28. import common from '../../common/common';
  29. import ZxInput from './components/ZxInput.vue'
  30. var config = require('../../common/config_gyq.js');
  31. var http = require('../../common/request.js');
  32. export default {
  33. data() {
  34. return {
  35. form: {
  36. }
  37. }
  38. },
  39. components: {
  40. ZxInput,
  41. },
  42. computed: {
  43. isSubmit({ form }) {
  44. return form.old_passwd && form.new_passwd && form.second_passwd
  45. }
  46. },
  47. methods: {
  48. async changePassword() {
  49. if(!this.isSubmit) return
  50. let res = await uni.showModal({
  51. confirmText:this.$t('确定'),
  52. cancelText:this.$t('取消'),
  53. title:this.$t('是否确认修改密码?')
  54. })
  55. if(res[1].confirm){
  56. let {data} = await http.postApi(config.API_FLK_ACCOUNT_IMODIFY_PASSWD,this.form)
  57. if(data.code == 200){
  58. common.simpleToast(this.$t('修改成功,请重新登录'))
  59. storage.removeUserToken()
  60. uni.removeStorageSync('USER_INFO_DATA')
  61. uni.reLaunch({
  62. url:'/pages/loginRegister/login'
  63. })
  64. }else{
  65. common.simpleToast(data.msg)
  66. }
  67. }
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. @import "@/libs/css/layout.scss";
  74. .changePassword-page {
  75. padding: 0 32rpx 58rpx ;
  76. min-height: 100vh;
  77. width: 100%;
  78. background: #F1F3F4;
  79. margin-top: 20rpx;
  80. }
  81. </style>