set.vue 2.7 KB

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