top-window.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <header class="cwg-pc-header bg-body" :class="{ 'dark': isDark }">
  3. <div class="left">
  4. <image class="left-img" v-if="!isDark" src="/static/images/vu/logo-full.svg" mode="widthFix" alt="logo"
  5. @click="openLeftDrawer" />
  6. <image class="left-img" v-else src="/static/images/vu/logo-full-white.svg" mode="widthFix" alt="logo"
  7. @click="openLeftDrawer" />
  8. <div class="cid" v-if="visible" @click="copy(cId)">{{t('newSignin.item1')}} {{ cId}}</div>
  9. </div>
  10. <div class="right" v-if="visible">
  11. <cwg-payment />
  12. <cwg-system event-source="top"/>
  13. <cwg-language />
  14. <cwg-notice />
  15. <cwg-right-drawer />
  16. </div>
  17. </header>
  18. </template>
  19. <script setup lang="ts">
  20. import { ref, computed, watch, onMounted } from 'vue'
  21. import { storeToRefs } from 'pinia'
  22. import useUserStore from '@/stores/use-user-store'
  23. import { useI18n } from 'vue-i18n'
  24. const userStore = useUserStore()
  25. const { userInfo } = storeToRefs(userStore)
  26. import useGlobalStore from '@/stores/use-global-store'
  27. const globalStore = useGlobalStore()
  28. const isDark = computed(() => globalStore.theme === 'dark')
  29. const visible = ref(true)
  30. const { t } = useI18n()
  31. watch(() => userInfo.value, (val) => {
  32. visible.value = !!val
  33. })
  34. const props = defineProps({
  35. sidebarVisible: {
  36. type: Boolean,
  37. default: false,
  38. },
  39. })
  40. const cId = computed(() => {
  41. const info = userStore.userInfo?.customInfo || {}
  42. return info.cId || info.id || '--'
  43. })
  44. onMounted(()=>{
  45. uni.$emit('updateSystemList','top')
  46. })
  47. // 复制文本
  48. const copy = (text: string) => {
  49. uni.setClipboardData({
  50. data: text,
  51. success: function () {
  52. uni.showToast({
  53. title: t('Btn.item8'),
  54. icon: 'none',
  55. duration: 2000
  56. });
  57. }
  58. });
  59. };
  60. </script>
  61. <style scoped lang="scss">
  62. @import "@/uni.scss";
  63. .cwg-pc-header {
  64. display: flex;
  65. align-items: center;
  66. justify-content: space-between;
  67. height: px2rpx(55);
  68. border-bottom: 1px solid var(--bs-border-color);
  69. padding: 0 px2rpx(16);
  70. position: relative;
  71. z-index: 10;
  72. }
  73. .left {
  74. display: flex;
  75. align-items: center;
  76. .cid{
  77. margin-left: px2rpx(50);
  78. cursor: pointer;
  79. }
  80. }
  81. .center {
  82. flex: 1;
  83. }
  84. .right {
  85. display: flex;
  86. align-items: center;
  87. gap: 0;
  88. }
  89. .bell .dot {
  90. position: absolute;
  91. top: 0;
  92. right: -2px;
  93. width: 7px;
  94. height: 7px;
  95. background: #27ae60;
  96. border-radius: 50%;
  97. display: inline-block;
  98. }
  99. .left-img {
  100. width: px2rpx(120);
  101. }
  102. .avatar .img {
  103. width: 32px;
  104. height: 32px;
  105. border-radius: 50%;
  106. background: #eee;
  107. }
  108. .logo .img {
  109. width: 36px;
  110. height: 36px;
  111. border-radius: 50%;
  112. background: #fff;
  113. }
  114. </style>