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.

164 lines
4.2 KiB

8 months ago
  1. <!-- 修改用户信息(二合一) -->
  2. <template>
  3. <view class="modify-user">
  4. <navbar :leftClick="leftClick" :title="$t(`page.modifyUser.${titles[$route.query.type]}`)"></navbar>
  5. <!-- 修改pin -->
  6. <view class="edit-user content">
  7. <view class="edit-list">
  8. <view class="edit-item">
  9. <view class="title">{{ $t('page.modifyUser.oldPassword') }}</view>
  10. <input type="text" :placeholder="$t('page.modifyUser.oldPasswordPlaceholder')" v-model="form.oldPassword"/>
  11. </view>
  12. <view class="edit-item">
  13. <view class="title">{{ $t('page.modifyUser.newPassword') }}</view>
  14. <input type="text" :placeholder="$t('page.modifyUser.newPasswordPlaceholder')" v-model="form.newPassword"/>
  15. </view>
  16. <view class="edit-item">
  17. <view class="title">{{ $t('page.modifyUser.confirmNewPassword') }}</view>
  18. <input type="text" :placeholder="$t('page.modifyUser.newPassword')" v-model="form.confirmNewPassword"/>
  19. </view>
  20. </view>
  21. </view>
  22. <!-- 提交按钮 -->
  23. <view class="confirm content" @click="submit">{{ $t('page.modifyUser.confirm') }}</view>
  24. <!-- 提示信息 -->
  25. <view class="tips content">{{ $t(`page.modifyUser.${tips[$route.query.type]}`) }}</view>
  26. </view>
  27. </template>
  28. <script>
  29. import navbar from '@/components/base/m-navbar.vue'
  30. export default {
  31. components : { navbar },
  32. data(){
  33. return {
  34. titles : ['editPinTitle','editPasswordTitle'],
  35. tips : ['pinTips','passwordTips'],
  36. form : {
  37. oldPassword : '',
  38. newPassword : '',
  39. confirmNewPassword : '',
  40. }
  41. }
  42. },
  43. methods : {
  44. leftClick() {
  45. uni.navigateTo({
  46. url: '/pages/personalInfo/personalInfo'
  47. })
  48. },
  49. //提交
  50. submit(){
  51. this.$play()
  52. if (this.form.oldPassword.trim() === '') return uni.$u.toast(this.$t('page.modifyUser.oldPasswordToast'))
  53. else if (this.form.newPassword.trim() === '') return uni.$u.toast(this.$t('page.modifyUser.newPasswordToast'))
  54. else if (this.form.confirmNewPassword.trim() === '') return uni.$u.toast(this.$t('page.modifyUser.confirmNewPasswordToast'))
  55. else if (this.form.confirmNewPassword.trim() != this.form.newPassword.trim()) return uni.$u.toast(this.$t('page.modifyUser.notPasswordToast'))
  56. if(this.$route.query.type == 0){ //修改pin逻辑
  57. this.request('editPayPass', {}, {
  58. oldPayPass : this.form.oldPassword,
  59. payPass : this.form.newPassword,
  60. okPayPass : this.form.confirmNewPassword,
  61. }).then(res => {
  62. if(res.code == 200){
  63. console.log(res.message);
  64. uni.$u.toast(this.$t(`message.${res.message}`))
  65. setTimeout(() => uni.navigateTo({
  66. url: '/pages/personalInfo/personalInfo'
  67. }), 1000)
  68. }
  69. })
  70. }else{ //修改密码逻辑
  71. this.request('editPass', {}, {
  72. oldPass : this.form.oldPassword,
  73. password : this.form.newPassword,
  74. okPassword : this.form.confirmNewPassword,
  75. }).then(res => {
  76. if(res.code == 200){
  77. uni.$u.toast(this.$t(`message.${res.message}`))
  78. setTimeout(() => uni.navigateTo({
  79. url: '/pages/personalInfo/personalInfo'
  80. }), 1000)
  81. }
  82. })
  83. }
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .modify-user{
  90. width: 750rpx;
  91. min-height: 100vh;
  92. background-color: black;
  93. margin: 0 auto;
  94. background-size: 100%;
  95. background-repeat: no-repeat;
  96. .content {
  97. width: 96%;
  98. margin: 0 auto;
  99. }
  100. .edit-user{
  101. padding-top: 20rpx;
  102. .edit-list{
  103. border: 1px solid #ccc;
  104. .edit-item{
  105. box-sizing: border-box;
  106. padding: 15rpx;
  107. border-bottom: 1px solid #ccc;
  108. &:last-child{
  109. border: none;
  110. }
  111. .title{
  112. color: #788a1c;
  113. font-size: 28rpx;
  114. }
  115. input{
  116. color: #afc638;
  117. text-indent: 1em;
  118. height: 60rpx;
  119. font-size: 28rpx;
  120. margin-top: 15rpx;
  121. }
  122. }
  123. }
  124. }
  125. .confirm{
  126. display: flex;
  127. align-items: center;
  128. justify-content: center;
  129. background: #afc638;
  130. margin: 30rpx auto;
  131. border-radius: 20rpx;
  132. height: 80rpx;
  133. font-size: 40rpx;
  134. font-weight: bold;
  135. }
  136. .tips{
  137. color: rgb(191, 118, 112);
  138. text-align: center;
  139. font-size: 26rpx;
  140. padding: 0rpx 20rpx;
  141. box-sizing: border-box;
  142. }
  143. }
  144. </style>