You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.7 KiB

10 months ago
  1. <template>
  2. <view>
  3. <u-navbar :title="$t('page.setting.updatePassword.title')" :safeAreaInsetTop="false" placeholder
  4. @leftClick="leftClick">
  5. </u-navbar>
  6. <u--form labelPosition="left" :model="model1" :rules="rules" class="line" ref="uForm">
  7. <u-form-item :label="$t('page.setting.updatePassword.OldPassword')" prop="oldPassword" borderBottom
  8. labelWidth="80px">
  9. <u--input v-model="model1.oldPassword" type="password"
  10. :placeholder="$t('page.setting.updatePassword.OldPassword-Placeholder')"></u--input>
  11. </u-form-item>
  12. <u-form-item :label="$t('page.setting.updatePassword.newPassword')" prop="password" borderBottom
  13. labelWidth="80px">
  14. <u--input v-model="model1.password" type="password"
  15. :placeholder="$t('page.setting.updatePassword.newPassword-Placeholder')"></u--input>
  16. </u-form-item>
  17. <u-form-item :label="$t('page.setting.updatePassword.confirmPassword')" prop="okPassword" borderBottom
  18. labelWidth="80px">
  19. <u--input v-model="model1.okPassword" type="password"
  20. :placeholder="$t('page.setting.updatePassword.newPassword-Placeholder')"></u--input>
  21. </u-form-item>
  22. </u--form>
  23. <u-button class="submit" size="large" @click="submit" :text="$t('page.walletRecharge.submit')"></u-button>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. model1: {
  31. id : 1,
  32. oldPassword: '',
  33. password: '',
  34. okPassword: ''
  35. },
  36. rules: {
  37. 'oldPassword': {
  38. type: 'string',
  39. required: true,
  40. message: this.$t('page.setting.updatePassword.OldPassword-Placeholder'),
  41. trigger: ['blur', 'change']
  42. },
  43. 'password': {
  44. type: 'string',
  45. required: true,
  46. message: this.$t('page.setting.updatePassword.newPassword-Placeholder'),
  47. trigger: ['blur', 'change']
  48. },
  49. 'okPassword': {
  50. type: 'string',
  51. required: true,
  52. message: this.$t('page.setting.updatePassword.newPassword-Placeholder'),
  53. trigger: ['blur', 'change']
  54. },
  55. },
  56. }
  57. },
  58. methods: {
  59. leftClick() {
  60. uni.navigateTo({
  61. url: '/pages/setting/setting'
  62. })
  63. },
  64. editPassword(){
  65. this.request('editPass',this.model1).then(res=>{
  66. if(res.code === 200){
  67. uni.$u.toast(this.$t('page.setting.updatePassword.edit-success'))
  68. setTimeout(()=>{
  69. uni.navigateTo({
  70. url: '/pages/login/login'
  71. })
  72. },500)
  73. }
  74. })
  75. },
  76. submit() {
  77. this.$refs.uForm.validate().then(res => {
  78. this.editPassword();
  79. })
  80. },
  81. }
  82. }
  83. </script>
  84. <style scoped lang="scss">
  85. .line {
  86. background-color: #fff;
  87. padding: 5px 10px;
  88. margin-top: 10px;
  89. .celi {
  90. border-radius: 10px;
  91. margin: 10px 0;
  92. }
  93. }
  94. .submit {
  95. border-radius: 30px;
  96. background-color: #ED762F;
  97. color: #fff;
  98. margin: 10px;
  99. width: calc(100% - 20px);
  100. }
  101. </style>