set.vue 2.8 KB

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