set.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="container">
  3. <uni-list>
  4. <uni-list-item title="个人资料" clickable showArrow @click="navTo('/pages/user/set/userinfo')" ></uni-list-item>
  5. <uni-list-item title="修改密码" clickable showArrow @click="navTo('/pages/user/set/password')" ></uni-list-item>
  6. <uni-list-item title="交易密码" clickable showArrow @click="navTo('/pages/user/set/transaction')" ></uni-list-item>
  7. </uni-list>
  8. <view class="list-cell log-out-btn" @click="toLogout">
  9. <text class="cell-tit">退出登录</text>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import { logout } from '@/api/set.js';
  15. import {
  16. mapMutations
  17. } from 'vuex';
  18. export default {
  19. data() {
  20. return {
  21. };
  22. },
  23. methods:{
  24. ...mapMutations('user',['logout']),
  25. navTo(url){
  26. uni.navigateTo({
  27. url:url,
  28. fail(red) {
  29. console.log(red);
  30. }
  31. })
  32. },
  33. //退出登录
  34. toLogout(){
  35. let obj = this;
  36. uni.showModal({
  37. content: '确定要退出登录么',
  38. success: (e)=>{
  39. if(e.confirm){
  40. logout({}).then((e) => {
  41. uni.navigateBack();
  42. }).catch((e) => {
  43. console.log(e);
  44. })
  45. obj.logout();
  46. }
  47. }
  48. });
  49. },
  50. //switch切换触发方法
  51. switchChange(e){
  52. console.log(e);
  53. let statusTip = e.value ? '打开': '关闭';
  54. this.$api.msg(`${statusTip}消息推送`);
  55. },
  56. }
  57. }
  58. </script>
  59. <style lang='scss'>
  60. page{
  61. background: #f3f3f3;
  62. }
  63. .list-cell{
  64. display:flex;
  65. align-items:baseline;
  66. padding: 20rpx $page-row-spacing;
  67. line-height:60rpx;
  68. position:relative;
  69. background: #fff;
  70. justify-content: center;
  71. &.log-out-btn{
  72. margin-top: 40rpx;
  73. .cell-tit{
  74. text-align: center;
  75. margin-right: 0;
  76. }
  77. }
  78. .cell-tit{
  79. flex: 1;
  80. font-size: $font-base + 2rpx;
  81. color: $font-color-dark;
  82. margin-right:10rpx;
  83. }
  84. .cell-tip{
  85. font-size: $font-base;
  86. color: $font-color-light;
  87. }
  88. switch{
  89. transform: translateX(16rpx) scale(.84);
  90. }
  91. }
  92. </style>