set.vue 2.7 KB

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