chat.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="title" />
  4. <view class="chat-wrapper">
  5. <web-view v-if="chatUrl" :src="chatUrl" :webview-styles="webviewStyles" />
  6. </view>
  7. </cwg-page-wrapper>
  8. </template>
  9. <script setup lang="ts">
  10. import { computed } from 'vue'
  11. import { useI18n } from 'vue-i18n'
  12. import { lang } from '@/composables/config'
  13. import useGlobalStore from '@/stores/use-global-store'
  14. const { t } = useI18n()
  15. const globalStore = useGlobalStore()
  16. const title = computed(() => t('Label.CustomerService') || '在线客服')
  17. const statusBarHeight = computed(() => globalStore.statusBarHeight || 0)
  18. const webviewStyles = computed(() => ({
  19. progress: { color: '#ea002a' },
  20. }))
  21. const chatUrl = computed(() => {
  22. const currentLang = lang.value || 'cn'
  23. const base = 'https://secure.cwgmx.com/mobile/zopim.html'
  24. const query = `lang=${encodeURIComponent(currentLang)}&statusBarHeight=${encodeURIComponent(String(statusBarHeight.value))}`
  25. return `${base}?${query}`
  26. })
  27. </script>
  28. <style scoped lang="scss">
  29. @import "@/uni.scss";
  30. .chat-wrapper {
  31. width: 100%;
  32. min-height: calc(100vh - 56px);
  33. }
  34. </style>