| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <template>
- <header class="cwg-pc-header bg-body" :class="{ 'dark': isDark }">
- <div class="left">
- <image class="left-img" v-if="!isDark" src="/static/images/vu/logo-full.svg" mode="widthFix" alt="logo"
- @click="openLeftDrawer" />
- <image class="left-img" v-else src="/static/images/vu/logo-full-white.svg" mode="widthFix" alt="logo"
- @click="openLeftDrawer" />
- <div class="cid" v-if="visible" @click="copy(cId)">{{t('newSignin.item1')}} {{name?(name + ' - '):''}}{{ cId}}</div>
- </div>
- <div class="right" v-if="visible">
- <cwg-download />
- <cwg-payment />
- <cwg-system event-source="top"/>
- <cwg-language />
- <cwg-notice />
- <cwg-right-drawer />
- </div>
- </header>
- </template>
- <script setup lang="ts">
- import { ref, computed, watch, onMounted } from 'vue'
- import { storeToRefs } from 'pinia'
- import useUserStore from '@/stores/use-user-store'
- import { useI18n } from 'vue-i18n'
- const userStore = useUserStore()
- const { userInfo } = storeToRefs(userStore)
- import useGlobalStore from '@/stores/use-global-store'
- const globalStore = useGlobalStore()
- const isDark = computed(() => globalStore.theme === 'dark')
- const visible = ref(true)
- const { t } = useI18n()
- watch(() => userInfo.value, (val) => {
- visible.value = !!val
- })
- const props = defineProps({
- sidebarVisible: {
- type: Boolean,
- default: false,
- },
- })
- const cId = computed(() => {
- const info = userStore.userInfo?.customInfo || {}
- return info.cId || info.id || '--'
- })
- const name = computed(() => {
- const info = userStore.userInfo?.customInfo || {}
- return info.firstName&&info.lastName?`${info.firstName} ${info.lastName}`:''
- })
- onMounted(()=>{
- uni.$emit('updateSystemList','top')
- })
- // 复制文本
- const copy = (text: string) => {
- uni.setClipboardData({
- data: text,
- success: function () {
- uni.showToast({
- title: t('Btn.item8'),
- icon: 'none',
- duration: 2000
- });
- }
- });
- };
- </script>
- <style scoped lang="scss">
- @import "@/uni.scss";
- .cwg-pc-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: px2rpx(55);
- border-bottom: 1px solid var(--bs-border-color);
- padding: 0 px2rpx(16);
- position: relative;
- z-index: 10;
- }
- .left {
- display: flex;
- align-items: center;
- .cid{
- margin-left: px2rpx(50);
- cursor: pointer;
- }
- }
- .center {
- flex: 1;
- }
- .right {
- display: flex;
- align-items: center;
- gap: 0;
- }
- .bell .dot {
- position: absolute;
- top: 0;
- right: -2px;
- width: 7px;
- height: 7px;
- background: #27ae60;
- border-radius: 50%;
- display: inline-block;
- }
- .left-img {
- width: px2rpx(120);
- }
- .avatar .img {
- width: 32px;
- height: 32px;
- border-radius: 50%;
- background: #eee;
- }
- .logo .img {
- width: 36px;
- height: 36px;
- border-radius: 50%;
- background: #fff;
- }
- </style>
|