set.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="container">
  3. <uni-list>
  4. <uni-list-item title="个人资料" @click="navTo('/pages/set/userinfo')"></uni-list-item>
  5. <!-- <uni-list-item title="收货地址" @click="navTo('/pages/set/address')"></uni-list-item> -->
  6. <!-- <uni-list-item title="交易密码" @click="navTo('/pages/money/moneyPwd')"></uni-list-item> -->
  7. <uni-list-item title="修改登录密码" @click="navTo('/pages/public/forget')"></uni-list-item>
  8. </uni-list>
  9. <view class="list-cell log-out-btn" @click="toLogout"><text class="cell-tit">退出登录</text></view>
  10. </view>
  11. </template>
  12. <script>
  13. import uniList from '@/components/uni-list/uni-list.vue';
  14. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  15. import { logout } from '@/api/set.js';
  16. import { mapMutations } from 'vuex';
  17. export default {
  18. components: {
  19. uniList,
  20. uniListItem
  21. },
  22. data() {
  23. return {};
  24. },
  25. methods: {
  26. ...mapMutations('user', ['logout']),
  27. navTo(url) {
  28. uni.navigateTo({
  29. url: url
  30. });
  31. },
  32. //退出登录
  33. toLogout() {
  34. let obj = this;
  35. uni.showModal({
  36. content: '确定要退出登录么',
  37. success: e => {
  38. if (e.confirm) {
  39. logout({})
  40. .then(e => {
  41. uni.navigateBack();
  42. })
  43. .catch(e => {
  44. console.log(e);
  45. });
  46. obj.logout();
  47. }
  48. }
  49. });
  50. },
  51. //switch切换触发方法
  52. switchChange(e) {
  53. console.log(e);
  54. let statusTip = e.value ? '打开' : '关闭';
  55. this.$api.msg(`${statusTip}消息推送`);
  56. }
  57. }
  58. };
  59. </script>
  60. <style lang="scss">
  61. page {
  62. background: $page-color-base;
  63. }
  64. .list-cell {
  65. display: flex;
  66. align-items: baseline;
  67. padding: 20rpx $page-row-spacing;
  68. line-height: 60rpx;
  69. position: relative;
  70. background: #fff;
  71. justify-content: center;
  72. &.log-out-btn {
  73. margin-top: 40rpx;
  74. .cell-tit {
  75. color: #E6C79D;
  76. text-align: center;
  77. margin-right: 0;
  78. }
  79. }
  80. .cell-tit {
  81. flex: 1;
  82. font-size: $font-base + 2rpx;
  83. color: $font-color-dark;
  84. margin-right: 10rpx;
  85. }
  86. .cell-tip {
  87. font-size: $font-base;
  88. color: $font-color-light;
  89. }
  90. switch {
  91. transform: translateX(16rpx) scale(0.84);
  92. }
  93. }
  94. </style>