set.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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/address')"></uni-list-item>
  6. <uni-list-item title="交易密码" @click="navTo('/pages/money/moneyPwd')"></uni-list-item>
  7. <uni-list-item title="修改登录密码" @click="navTo('/pages/public/forget')"></uni-list-item>
  8. <uni-list-item title="隐私协议" @click="navTo('/pages/user/about')"></uni-list-item>
  9. <uni-list-item title="注销账户" @click="detailPhone()"></uni-list-item>
  10. </uni-list>
  11. <view class="list-cell log-out-btn" @click="toLogout"><text class="cell-tit">退出登录</text></view>
  12. </view>
  13. </template>
  14. <script>
  15. import uniList from '@/components/uni-list/uni-list.vue';
  16. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  17. import { logout } from '@/api/set.js';
  18. import { mapMutations } from 'vuex';
  19. export default {
  20. components: {
  21. uniList,
  22. uniListItem
  23. },
  24. data() {
  25. return {};
  26. },
  27. methods: {
  28. ...mapMutations('user', ['logout']),
  29. detailPhone(){
  30. uni.showModal({
  31. title: '提示',
  32. content: '账号注销后无法恢复是否申请注销',
  33. success: res => {
  34. uni.showModal({
  35. title: '请输入注销理由',
  36. editable:true,
  37. success: res => {
  38. uni.showLoading({})
  39. setTimeout(()=>{
  40. uni.hideLoading()
  41. uni.showModal({
  42. title: '提示',
  43. content: '账号注销申请已提交,如需要取消注销请三个工作日内联系管理员,三个工作日后该账户将无法使用且无法恢复',
  44. showCancel:false
  45. });
  46. },1000)
  47. },
  48. });
  49. },
  50. });
  51. },
  52. navTo(url) {
  53. uni.navigateTo({
  54. url: url
  55. });
  56. },
  57. //退出登录
  58. toLogout() {
  59. let obj = this;
  60. uni.showModal({
  61. content: '确定要退出登录么',
  62. success: e => {
  63. if (e.confirm) {
  64. logout({})
  65. .then(e => {
  66. uni.navigateBack();
  67. })
  68. .catch(e => {
  69. console.log(e);
  70. });
  71. obj.logout();
  72. }
  73. }
  74. });
  75. },
  76. //switch切换触发方法
  77. switchChange(e) {
  78. console.log(e);
  79. let statusTip = e.value ? '打开' : '关闭';
  80. this.$api.msg(`${statusTip}消息推送`);
  81. }
  82. }
  83. };
  84. </script>
  85. <style lang="scss">
  86. page {
  87. background: $page-color-base;
  88. }
  89. .list-cell {
  90. display: flex;
  91. align-items: baseline;
  92. padding: 20rpx $page-row-spacing;
  93. line-height: 60rpx;
  94. position: relative;
  95. background: #fff;
  96. justify-content: center;
  97. &.log-out-btn {
  98. margin-top: 40rpx;
  99. .cell-tit {
  100. color: $base-color;
  101. text-align: center;
  102. margin-right: 0;
  103. }
  104. }
  105. .cell-tit {
  106. flex: 1;
  107. font-size: $font-base + 2rpx;
  108. color: $font-color-dark;
  109. margin-right: 10rpx;
  110. }
  111. .cell-tip {
  112. font-size: $font-base;
  113. color: $font-color-light;
  114. }
  115. switch {
  116. transform: translateX(16rpx) scale(0.84);
  117. }
  118. }
  119. </style>