index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="container">
  3. <page-title>账号管理</page-title>
  4. <view class="account-content">
  5. <view class="account-item" @click="goToPage('/pages/mine/change-account/index')">
  6. <view class="account-item-name">当前账号</view>
  7. <view class="account-item-content">{{accountNum || "--"}}</view>
  8. <!-- <u-icon name="arrow-right" color="#343437" size="14" customStyle="margin-left:20rpx"></u-icon> -->
  9. </view>
  10. </view>
  11. <view class="confirm-btn" @click="exitLogin()">
  12. 退出登录
  13. </view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import {
  18. ref
  19. } from "vue";
  20. import {
  21. onLoad
  22. } from "@dcloudio/uni-app"
  23. import {
  24. getInfo,
  25. logout
  26. } from "@/api/login.js"
  27. function backToBefore() {
  28. uni.navigateBack({})
  29. };
  30. let userInfo = ref({})
  31. let accountNum = ref(null)
  32. function goToPage(url) {
  33. return
  34. uni.navigateTo({
  35. url
  36. })
  37. }
  38. function exitLogin() {
  39. uni.showModal({
  40. title: "退出确认",
  41. content: "确定要退出登录吗?",
  42. confirmColor: "#f00",
  43. success: function(res) {
  44. if (res.confirm) {
  45. logout().then(res => {
  46. if (res.code === 200) {
  47. // uni.clearStorage();
  48. uni.removeStorageSync('__DC_STAT_UUID');
  49. uni.removeStorageSync('storage_data');
  50. uni.removeStorageSync('App-Token');
  51. uni.reLaunch({
  52. url: '/pages/login/index'
  53. })
  54. }
  55. })
  56. }
  57. }
  58. })
  59. }
  60. onLoad(() => {
  61. getInfo().then(res => {
  62. userInfo.value = res.data.user;
  63. accountNum.value = res.data.user.loginName;
  64. })
  65. })
  66. </script>
  67. <style lang="scss" scoped>
  68. .account-content {
  69. position: absolute;
  70. top: 226rpx;
  71. left: 4%;
  72. width: 92%;
  73. height: 120rpx;
  74. padding: 19rpx 28rpx;
  75. box-sizing: border-box;
  76. background-color: #fff;
  77. border-radius: 40rpx;
  78. }
  79. .account-item {
  80. display: flex;
  81. align-items: center;
  82. justify-content: space-between;
  83. width: 100%;
  84. height: 80rpx;
  85. font-size: 32rpx;
  86. font-weight: 400;
  87. color: #9E9E9E;
  88. .account-item-name {
  89. flex: 2;
  90. }
  91. .account-item-content {
  92. flex: 6;
  93. text-align: right;
  94. font-size: 32rpx;
  95. color: #343437;
  96. }
  97. }
  98. .confirm-btn {
  99. position: absolute;
  100. top: 396rpx;
  101. left: 4%;
  102. width: 92%;
  103. height: 84rpx;
  104. line-height: 84rpx;
  105. font-size: 36rpx;
  106. color: #fff;
  107. text-align: center;
  108. background: #FF530F;
  109. border-radius: 16rpx;
  110. }
  111. </style>