index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="container">
  3. <view class="user">
  4. <u-icon name="https://b.yzcdn.cn/vant/icon-demo-1126.png" size="100rpx" style="margin-right:20rpx" />
  5. <view class="user-name">
  6. <view class="userName">
  7. {{userName}}
  8. </view>
  9. <view class="">
  10. 登录时间:{{lastLoginTime}}
  11. </view>
  12. </view>
  13. </view>
  14. <view class="list">
  15. <uni-list>
  16. <uni-list-item title="权限等级" thumb="../../static/image/qxgl.png" thumb-size="medium" link
  17. to="/pages/user/auth-level/index">
  18. </uni-list-item>
  19. <uni-list-item title="口令设置" thumb="../../static/image/klsz.png" thumb-size="medium" link
  20. to="/pages/user/edit-password/index">
  21. </uni-list-item>
  22. <uni-list-item title="系统信息" to="/pages/user/system-info/index" thumb="../../static/image/xtgl.png"
  23. thumb-size="medium" link>
  24. </uni-list-item>
  25. </uni-list>
  26. </view>
  27. <view class="btn">
  28. <u-button type="primary" text="退出登录" @click="show=true" size="large"></u-button>
  29. </view>
  30. <view>
  31. <u-modal :show="show" content='确定退出登录吗?' showCancelButton @confirm="loginOut" @cancel="show=false"
  32. width="270">
  33. </u-modal>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. //模态框
  42. show: false,
  43. };
  44. },
  45. computed: {
  46. userName() {
  47. return this.$store.getters.userName
  48. },
  49. lastLoginTime() {
  50. return this.$store.getters.lastLoginTime
  51. }
  52. },
  53. methods: {
  54. //退出登录
  55. loginOut() {
  56. this.$store.dispatch('user/logout').then(res => {
  57. if (res.data.code === 200) {
  58. uni.redirectTo({
  59. url: "/pages/login/index"
  60. })
  61. }
  62. })
  63. },
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped>
  68. .container {
  69. background: #EEEDF2;
  70. }
  71. .user {
  72. display: flex;
  73. align-items: center;
  74. padding: 60rpx 40rpx;
  75. margin-bottom: 20rpx;
  76. background: #ffffff;
  77. }
  78. .user-name {
  79. font-weight: bold;
  80. .userName {
  81. font-size: 44rpx
  82. }
  83. }
  84. .list {}
  85. .btn {
  86. position: absolute;
  87. bottom: 100rpx;
  88. left: 0;
  89. right: 0;
  90. padding: 0 80rpx;
  91. }
  92. ::v-deep .uni-list-item__container {
  93. padding: 40rpx 60rpx;
  94. }
  95. ::v-deep .uni-list-item__content-title {
  96. font-size: 44rpx;
  97. }
  98. ::v-deep .uniui-arrowright {
  99. color: #000000 !important;
  100. font-size: 52rpx !important;
  101. }
  102. ::v-deep .u-modal__content__text {
  103. text-align: center;
  104. }
  105. </style>