changePassword.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="">
  3. <navBar name="修改密码"></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. import common from '../../common/common';
  28. import ZxInput from './components/ZxInput.vue'
  29. var config = require('../../common/config_gyq.js');
  30. var http = require('../../common/request.js');
  31. export default {
  32. data() {
  33. return {
  34. form: {
  35. }
  36. }
  37. },
  38. components: {
  39. ZxInput
  40. },
  41. computed: {
  42. isSubmit({ form }) {
  43. return form.old_passwd && form.new_passwd && form.second_passwd
  44. }
  45. },
  46. methods: {
  47. async changePassword() {
  48. if(!this.isSubmit) return
  49. let res = await uni.showModal({
  50. confirmText:this.$t('确定'),
  51. cancelText:this.$t('取消'),
  52. title:this.$t('是否确认修改密码?')
  53. })
  54. if(res[1].confirm){
  55. let {data} = await http.postApi(config.API_FLK_ACCOUNT_IMODIFY_PASSWD,this.form)
  56. if(data.code == 200){
  57. common.simpleToast(this.$t('修改成功'))
  58. setTimeout(()=>{
  59. uni.navigateBack({
  60. delta:1
  61. })
  62. },800)
  63. }else{
  64. common.simpleToast(data.msg)
  65. }
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. @import "@/libs/css/layout.scss";
  73. .changePassword-page {
  74. padding: 0 32rpx 58rpx ;
  75. min-height: 100vh;
  76. width: 100%;
  77. background: #F1F3F4;
  78. margin-top: 20rpx;
  79. }
  80. </style>