set.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="container">
  3. <!-- #ifdef APP-PLUS -->
  4. <view class="top_bar" @click="switchTab('/pages/user/user')">
  5. <view class="top_img" >
  6. <image src="../../static/img/img30.png" ></image>
  7. </view>
  8. <view class="top_tit">
  9. 设置
  10. </view>
  11. </view>
  12. <!-- #endif -->
  13. <uni-list class="margin-top20">
  14. <uni-list-item class="item-1" title="个人资料" @click="navTo('/pages/userinfo/userinfo')"></uni-list-item>
  15. <uni-list-item class="item-1" title="修改密码" @click="navTo('/pages/set/password')"></uni-list-item>
  16. <!-- <uni-list-item title="绑定手机" @click="navTo('/pages/set/phone')"></uni-list-item> -->
  17. </uni-list>
  18. <view class="list-cell" @click="toLogout">
  19. <text class="cell-tit">退出登录</text>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import uniList from '@/components/uni-list/uni-list.vue';
  25. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  26. import { logout } from '@/api/set.js';
  27. import { mapMutations } from 'vuex';
  28. export default {
  29. components: {
  30. uniList,
  31. uniListItem
  32. },
  33. data() {
  34. return {};
  35. },
  36. methods: {
  37. ...mapMutations(['logout']),
  38. navTo(url) {
  39. uni.navigateTo({
  40. url: url
  41. });
  42. },
  43. switchTab(url) {
  44. uni.switchTab({
  45. url: url
  46. });
  47. },
  48. //退出登录
  49. toLogout() {
  50. uni.showModal({
  51. content: '确定要退出登录么',
  52. success: e => {
  53. console.log(e);
  54. if (e.confirm) {
  55. this.logout();
  56. logout({})
  57. .then(e => {
  58. uni.navigateBack();
  59. })
  60. .catch(e => {
  61. this.$api.msg(e.message);
  62. console.log(e);
  63. });
  64. }
  65. }
  66. });
  67. },
  68. //switch切换触发方法
  69. switchChange(e) {
  70. console.log(e);
  71. let statusTip = e.value ? '打开' : '关闭';
  72. this.$api.msg(`${statusTip}消息推送`);
  73. }
  74. }
  75. };
  76. </script>
  77. <style lang="scss">
  78. page {
  79. background: $page-color-base;
  80. }
  81. .top_bar{
  82. width: 750rpx;
  83. overflow: hidden;
  84. background-color: #FFFFFF;
  85. padding: 15rpx 15rpx;
  86. .top_img{
  87. float: left;
  88. width: 40rpx;
  89. height: 40rpx;
  90. image{
  91. width: 40rpx;
  92. height: 40rpx
  93. }
  94. }
  95. .top_tit{
  96. color: #333333;
  97. float: left;
  98. width:90%;
  99. text-align: center;
  100. font-size:32rpx;
  101. line-height: 50rpx;
  102. }
  103. }
  104. .margin-top20{
  105. margin-top: 20rpx;
  106. .item-1{
  107. padding-left: 0;
  108. }
  109. }
  110. .uni-list-item__container{
  111. padding: 11px 14px;
  112. }
  113. .list-cell {
  114. margin-top: 55rpx;
  115. .cell-tit {
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. text-align: center;
  120. width: 100%;
  121. height: 95rpx;
  122. color: #333333;
  123. background:#FFFFFF;
  124. font-size: $font-lg;
  125. margin: 0 auto;
  126. }
  127. // .cell-tit {
  128. // flex: 1;
  129. // font-size: $font-base + 2rpx;
  130. // color: $font-color-dark;
  131. // margin-right: 10rpx;
  132. // }
  133. // .cell-tip {
  134. // font-size: $font-base;
  135. // color: $font-color-light;
  136. // }
  137. // switch {
  138. // transform: translateX(16rpx) scale(0.84);
  139. // }
  140. }
  141. </style>