setting.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="container">
  3. <u-navbar titleStyle="color:#333;fontSize:36rpx;" :autoBack="true" bgColor="#fff" :placeholder="true"
  4. title="设置"></u-navbar>
  5. <view class="content">
  6. <u-cell-group :border="false">
  7. <u-cell title="修改密码" :isLink="true" @click="pwdShow=true">
  8. </u-cell>
  9. <u-cell title="退出登录" :isLink="true" @click="loginOut">
  10. </u-cell>
  11. </u-cell-group>
  12. </view>
  13. <xpopup :show="pwdShow" @close="pwdClose" @confirm="pwdSubmit" :showBtn="true" title="修改密码">
  14. <view class="pwd-popup-content flex align-center">
  15. <view>新密码:</view>
  16. <view>
  17. <u--input placeholder="请输入新密码" type="password" border="surround" v-model="newpassword"></u--input>
  18. </view>
  19. </view>
  20. </xpopup>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. updateUserInfo
  26. } from "@/api/system/user.js"
  27. export default {
  28. data() {
  29. return {
  30. newpassword: '',
  31. pwdShow: false,
  32. }
  33. },
  34. methods: {
  35. changePwd() {
  36. this.pwdShow = true
  37. },
  38. pwdSubmit() {
  39. if (this.newpassword) {
  40. updateUserInfo({
  41. password: this.newpassword
  42. }).then(res => {
  43. this.$modal.showToast('修改成功~')
  44. })
  45. this.pwdClose()
  46. } else {
  47. this.$modal.msg('请输入新密码!')
  48. }
  49. },
  50. pwdClose() {
  51. this.pwdShow = false
  52. },
  53. loginOut() {
  54. this.$store.dispatch('LogOut').then(res => {
  55. this.$tab.reLaunch('/pages/login')
  56. })
  57. },
  58. },
  59. }
  60. </script>
  61. <style scoped lang="scss">
  62. .container {
  63. .content {
  64. min-height: 100vh;
  65. background-color: #fff;
  66. padding:24rpx;
  67. /deep/ .u-cell__body {
  68. padding: 30rpx 6rpx;
  69. }
  70. }
  71. .pwd-popup-content {
  72. padding: 24rpx;
  73. >view:nth-child(1) {
  74. width: 160rpx;
  75. }
  76. >view:nth-child(2) {
  77. width: 100%;
  78. }
  79. }
  80. }
  81. </style>