set.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="container">
  3. <!-- <view class="list-cell b-b m-t" @click="navTo('个人资料')" 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 b-b" @click="navTo('收货地址')" hover-class="cell-hover" :hover-stay-time="50">
  8. <text class="cell-tit">收货地址</text>
  9. <text class="cell-more yticon icon-you"></text>
  10. </view>
  11. <view class="list-cell" @click="navTo('实名认证')" hover-class="cell-hover" :hover-stay-time="50">
  12. <text class="cell-tit">实名认证</text>
  13. <text class="cell-more yticon icon-you"></text>
  14. </view> -->
  15. <view class="list-cell m-t">
  16. <text class="cell-tit">消息推送</text>
  17. <switch checked color="#fa436a" @change="switchChange" />
  18. </view>
  19. <view class="list-cell m-t b-b" @click="navTo('清除缓存')" hover-class="cell-hover" :hover-stay-time="50">
  20. <text class="cell-tit">清除缓存</text>
  21. <text class="cell-more yticon icon-you"></text>
  22. </view>
  23. <!-- <view class="list-cell b-b" @click="navTo('关于Dcloud')" hover-class="cell-hover" :hover-stay-time="50">
  24. <text class="cell-tit">关于Dcloud</text>
  25. <text class="cell-more yticon icon-you"></text>
  26. </view> -->
  27. <view class="list-cell">
  28. <text class="cell-tit">检查更新</text>
  29. <text class="cell-tip">当前版本 1.0.3</text>
  30. <text class="cell-more yticon icon-you"></text>
  31. </view>
  32. <view class="list-cell log-out-btn" @click="toLogout">
  33. <text class="cell-tit">退出登录</text>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. mapMutations
  40. } from 'vuex';
  41. export default {
  42. data() {
  43. return {
  44. };
  45. },
  46. methods:{
  47. ...mapMutations(['logout']),
  48. navTo(url){
  49. this.$api.msg(`跳转到${url}`);
  50. },
  51. //退出登录
  52. toLogout(){
  53. uni.showModal({
  54. content: '确定要退出登录么',
  55. success: (e)=>{
  56. if(e.confirm){
  57. this.logout();
  58. uni.removeStorageSync("addresses")
  59. uni.removeStorageSync("userInfo")
  60. setTimeout(()=>{
  61. uni.switchTab({
  62. url:"../index/index"
  63. })
  64. }, 200)
  65. }
  66. }
  67. });
  68. },
  69. //switch
  70. switchChange(e){
  71. let statusTip = e.detail.value ? '打开': '关闭';
  72. this.$api.msg(`${statusTip}消息推送`);
  73. },
  74. }
  75. }
  76. </script>
  77. <style lang='scss'>
  78. page{
  79. background: $page-color-base;
  80. }
  81. .list-cell{
  82. display:flex;
  83. align-items:baseline;
  84. padding: 20upx $page-row-spacing;
  85. line-height:60upx;
  86. position:relative;
  87. background: #fff;
  88. justify-content: center;
  89. &.log-out-btn{
  90. margin-top: 40upx;
  91. .cell-tit{
  92. color: $uni-color-primary;
  93. text-align: center;
  94. margin-right: 0;
  95. }
  96. }
  97. &.cell-hover{
  98. background:#fafafa;
  99. }
  100. &.b-b:after{
  101. left: 30upx;
  102. }
  103. &.m-t{
  104. margin-top: 16upx;
  105. }
  106. .cell-more{
  107. align-self: baseline;
  108. font-size:$font-lg;
  109. color:$font-color-light;
  110. margin-left:10upx;
  111. }
  112. .cell-tit{
  113. flex: 1;
  114. font-size: $font-base + 2upx;
  115. color: $font-color-dark;
  116. margin-right:10upx;
  117. }
  118. .cell-tip{
  119. font-size: $font-base;
  120. color: $font-color-light;
  121. }
  122. switch{
  123. transform: translateX(16upx) scale(.84);
  124. }
  125. }
  126. </style>