changePassword.vue 1.9 KB

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