set.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="container">
  3. <view class="list-cell b-b m-t" @click="navTo('/pages/userinfo/userinfo')" hover-class="cell-hover" :hover-stay-time="50">
  4. <text class="cell-tit">个人资料</text>
  5. <text class="cell-more yticon icon-you"></text>
  6. </view>
  7. <view class="list-cell log-out-btn" @click="toLogout">
  8. <text class="cell-tit">退出登录</text>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import {
  14. mapMutations
  15. } from 'vuex';
  16. export default {
  17. data() {
  18. return {
  19. };
  20. },
  21. methods:{
  22. ...mapMutations(['logout']),
  23. navTo(url){
  24. uni.navigateTo({
  25. url:url
  26. });
  27. },
  28. //退出登录
  29. toLogout(){
  30. uni.showModal({
  31. content: '确定要退出登录么',
  32. success: (e)=>{
  33. if(e.confirm){
  34. this.logout();
  35. setTimeout(()=>{
  36. uni.navigateBack();
  37. }, 200)
  38. }
  39. }
  40. });
  41. },
  42. //switch
  43. switchChange(e){
  44. let statusTip = e.detail.value ? '打开': '关闭';
  45. this.$api.msg(`${statusTip}消息推送`);
  46. },
  47. }
  48. }
  49. </script>
  50. <style lang='scss'>
  51. page{
  52. background: $page-color-base;
  53. }
  54. .list-cell{
  55. display:flex;
  56. align-items:baseline;
  57. padding: 20upx $page-row-spacing;
  58. line-height:60upx;
  59. position:relative;
  60. background: #fff;
  61. justify-content: center;
  62. &.log-out-btn{
  63. margin-top: 40upx;
  64. .cell-tit{
  65. color: $uni-color-primary;
  66. text-align: center;
  67. margin-right: 0;
  68. }
  69. }
  70. &.cell-hover{
  71. background:#fafafa;
  72. }
  73. &.b-b:after{
  74. left: 30upx;
  75. }
  76. &.m-t{
  77. margin-top: 16upx;
  78. }
  79. .cell-more{
  80. align-self: baseline;
  81. font-size:$font-lg;
  82. color:$font-color-light;
  83. margin-left:10upx;
  84. }
  85. .cell-tit{
  86. flex: 1;
  87. font-size: $font-base + 2upx;
  88. color: $font-color-dark;
  89. margin-right:10upx;
  90. }
  91. .cell-tip{
  92. font-size: $font-base;
  93. color: $font-color-light;
  94. }
  95. switch{
  96. transform: translateX(16upx) scale(.84);
  97. }
  98. }
  99. </style>