change_pwd.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="change">
  3. <u-form label-width='150'>
  4. <u-form-item label="新密码">
  5. <u-input v-model="password" type="password"/>
  6. </u-form-item>
  7. <u-form-item label="确认密码">
  8. <u-input v-model="sure_password" type="password"/>
  9. </u-form-item>
  10. </u-form>
  11. <view class="submit" @click="submit">
  12. 确认修改
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. password: '',
  21. sure_password: ''
  22. }
  23. },
  24. methods: {
  25. submit() {
  26. if (!this.password) {
  27. uni.showToast({
  28. title: '请输入新密码',
  29. icon: 'none'
  30. })
  31. return
  32. }
  33. if (!this.sure_password) {
  34. uni.showToast({
  35. title: '请输入确认密码',
  36. icon: 'none'
  37. })
  38. return
  39. }
  40. if (this.password != this.sure_password) {
  41. uni.showToast({
  42. title: '您两次输入的密码不一致',
  43. icon: 'none'
  44. })
  45. return
  46. }
  47. this.$u.post('/base/admin-update-password', {
  48. password: this.password,
  49. password_confirmation: this.sure_password
  50. }).then(res => {
  51. this.$u.vuex('vuex_token', '');
  52. this.$u.vuex('vuex_user', '');
  53. console.log(res)
  54. uni.showToast({
  55. title: '修改成功,请重新登录',
  56. icon: 'none'
  57. })
  58. setTimeout(function() {
  59. uni.reLaunch({
  60. url: '../login/index'
  61. })
  62. }, 2000)
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. .change {
  70. padding: 0 20px;
  71. margin-top: 10px;
  72. background-color: #fff;
  73. .submit {
  74. height: 45px;
  75. width: 60%;
  76. line-height: 45px;
  77. margin: 0 auto;
  78. margin-top: 100px;
  79. background-color: #D12727;
  80. text-align: center;
  81. color: #fff;
  82. border-radius: 22px;
  83. font-size: 16px;
  84. }
  85. }
  86. </style>