index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <Page title="我的" styleReset="backNone">
  3. <template v-slot:body>
  4. <div class="w-full h-full flex flex-col items-center">
  5. <div class="headPortrait">
  6. <img src="/src/assets/image/camera.png" class="w-full h-full">
  7. </div>
  8. <div class="flex-1">
  9. <div class="xinming">
  10. <TranslationComponent :openId="userInfo.userInfo.name" />
  11. </div>
  12. <div class="flex flex-col justify-center text-[#5D5D5D] leading-6">
  13. <div class="text-center">公司: {{ userInfo.userInfo?.company?.companyName }}</div>
  14. <div class="text-center">角色: {{ userInfo.userInfo?.roleName }}</div>
  15. </div>
  16. </div>
  17. <div class="w-full mb-40 px-24" v-if="!isCorpWX">
  18. <van-button type="primary" @click="signOut" class="w-full">退出登录</van-button>
  19. </div>
  20. </div>
  21. <!-- <van-button type="primary" @click="signOut">退出</van-button> -->
  22. </template>
  23. <template v-slot:footer>
  24. <Footer />
  25. </template>
  26. </Page>
  27. </template>
  28. <script setup>
  29. import { ref } from "vue";
  30. import { useLifecycle } from "@hooks/useCommon.js";
  31. import useRouterStore from "@store/useRouterStore.js";
  32. import useInfoStore from "@store/useInfoStore.js";
  33. import Footer from "@components/page/footer.vue";
  34. const router = useRouterStore()
  35. const userInfo = useInfoStore()
  36. const isCorpWX = ref(false)
  37. function signOut() {
  38. router.redirectTo({
  39. pathName: 'login',
  40. success: () => {
  41. localStorage.clear()
  42. sessionStorage.clear()
  43. window.location.reload();
  44. }
  45. })
  46. }
  47. function judgingTheEnvironment() {
  48. const currentEnvironment = navigator.userAgent.toLowerCase();
  49. isCorpWX.value = currentEnvironment.indexOf("wxwork") > 0 ? true : false
  50. }
  51. useLifecycle({
  52. load: () => {
  53. judgingTheEnvironment()
  54. }
  55. });
  56. </script>
  57. <style lang="scss" scoped>
  58. .backNone {
  59. background: linear-gradient(to bottom, #E0EFFF, #F8F8F8 30%) !important;
  60. :deep(.van-nav-bar) {
  61. background: none;
  62. }
  63. }
  64. .headPortrait {
  65. width: 80px;
  66. height: 80px;
  67. border-radius: 50%;
  68. position: relative;
  69. margin-top: 20px;
  70. margin-bottom: 10px;
  71. &::after {
  72. content: "";
  73. width: 24px;
  74. height: 24px;
  75. background-image: url('@/assets/image/camera.png');
  76. background-size: cover;
  77. position: absolute;
  78. bottom: 0;
  79. right: 0;
  80. }
  81. }
  82. .xinming {
  83. color: #000000;
  84. font-family: PingFang SC;
  85. font-weight: semibold;
  86. font-size: 18px;
  87. line-height: normal;
  88. letter-spacing: 0px;
  89. text-align: left;
  90. margin-bottom: 6px;
  91. text-align: center;
  92. }
  93. </style>