set.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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/password')" ></uni-list-item>
  6. <uni-list-item title="实名认证" @click="navTo('/pages/set/phone')" ></uni-list-item>
  7. <uni-list-item title="收货地址" @click="navTo('/pages/set/address')" ></uni-list-item>
  8. </uni-list>
  9. <!-- <uni-list class="margin-t-20">
  10. <uni-list-item title="消息推送" :switch-checked='true' :show-switch="true" :show-arrow="false" switch-color='#5dbc7c' @switchChange='switchChange'>
  11. </uni-list-item>
  12. </uni-list>
  13. <uni-list class="margin-t-20">
  14. <uni-list-item title="清除缓存" ></uni-list-item>
  15. <uni-list-item title="检查更新" >
  16. <template slot="right">
  17. 当前版本 1.0.3
  18. </template>
  19. </uni-list-item>
  20. </uni-list> -->
  21. <view class="list-cell log-out-btn" @click="toLogout">
  22. <text class="cell-tit">退出登录</text>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { logout } from '@/api/set.js';
  28. import {
  29. mapMutations
  30. } from 'vuex';
  31. export default {
  32. data() {
  33. return {
  34. };
  35. },
  36. methods:{
  37. ...mapMutations('user',['logout']),
  38. navTo(url){
  39. uni.navigateTo({
  40. url:url
  41. })
  42. },
  43. //退出登录
  44. toLogout(){
  45. let obj = this;
  46. uni.showModal({
  47. content: '确定要退出登录么',
  48. success: (e)=>{
  49. if(e.confirm){
  50. logout({}).then((e) => {
  51. uni.navigateBack();
  52. }).catch((e) => {
  53. console.log(e);
  54. })
  55. obj.logout();
  56. }
  57. }
  58. });
  59. },
  60. //switch切换触发方法
  61. switchChange(e){
  62. console.log(e);
  63. let statusTip = e.value ? '打开': '关闭';
  64. this.$msg(`${statusTip}消息推送`);
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang='scss'>
  70. page{
  71. background: $page-color-base;
  72. }
  73. .list-cell{
  74. display:flex;
  75. align-items:baseline;
  76. padding: 20rpx $page-row-spacing;
  77. line-height:60rpx;
  78. position:relative;
  79. background: #fff;
  80. justify-content: center;
  81. &.log-out-btn{
  82. margin-top: 40rpx;
  83. .cell-tit{
  84. color: $base-color;
  85. text-align: center;
  86. margin-right: 0;
  87. }
  88. }
  89. .cell-tit{
  90. flex: 1;
  91. font-size: $font-base + 2rpx;
  92. color: $font-color-dark;
  93. margin-right:10rpx;
  94. }
  95. .cell-tip{
  96. font-size: $font-base;
  97. color:$base-color;
  98. }
  99. switch{
  100. transform: translateX(16rpx) scale(.84);
  101. }
  102. }
  103. </style>