set.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="container">
  3. <uni-list>
  4. <uni-list-item title="个人资料" @click="navTo('/pages/userinfo/userinfo')"></uni-list-item>
  5. <!-- <uni-list-item title="修改密码" @click="navTo('/pages/set/password')"></uni-list-item> -->
  6. <uni-list-item title="绑定手机" @click="navTo('/pages/set/phone')"></uni-list-item>
  7. </uni-list>
  8. <view class="list-cell" @click="toLogout">
  9. <text class="cell-tit">退出登录</text>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import uniList from '@/components/uni-list/uni-list.vue';
  15. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  16. import { logout } from '@/api/set.js';
  17. import { mapMutations } from 'vuex';
  18. export default {
  19. components: {
  20. uniList,
  21. uniListItem
  22. },
  23. data() {
  24. return {};
  25. },
  26. methods: {
  27. ...mapMutations(['logout']),
  28. navTo(url) {
  29. uni.navigateTo({
  30. url: url
  31. });
  32. },
  33. //退出登录
  34. toLogout() {
  35. uni.showModal({
  36. content: '确定要退出登录么',
  37. success: e => {
  38. if (e.confirm) {
  39. this.logout();
  40. logout({})
  41. .then(e => {
  42. uni.navigateBack();
  43. })
  44. .catch(e => {
  45. this.$api.msg(e.message);
  46. console.log(e);
  47. });
  48. }
  49. }
  50. });
  51. },
  52. //switch切换触发方法
  53. switchChange(e) {
  54. console.log(e);
  55. let statusTip = e.value ? '打开' : '关闭';
  56. this.$api.msg(`${statusTip}消息推送`);
  57. }
  58. }
  59. };
  60. </script>
  61. <style lang="scss">
  62. page {
  63. background: $page-color-base;
  64. }
  65. .list-cell {
  66. margin-top: 80rpx;
  67. .cell-tit {
  68. display: flex;
  69. align-items: center;
  70. justify-content: center;
  71. text-align: center;
  72. width: 560rpx;
  73. height: 80rpx;
  74. color: #fff;
  75. background:#FF0000;
  76. border-radius: 40rpx;
  77. font-size: $font-base + 2rpx;
  78. margin: 0 auto;
  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>