default.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <div class="com-body">
  3. <div style="margin-bottom: 56px">
  4. <img
  5. style="max-width: 100%; max-height: 100%; opacity: 0"
  6. :src="`${websitelogo}`"
  7. alt="Logo-2" />
  8. </div>
  9. <pc-header></pc-header>
  10. <nuxt />
  11. <pc-footer></pc-footer>
  12. <loginDialog></loginDialog>
  13. </div>
  14. </template>
  15. <script>
  16. import { removeKeyboardKey, addKeyboardKey } from '@/utils/keyboard'
  17. export default {
  18. data() {
  19. return {
  20. websitelogo: '',
  21. }
  22. },
  23. async fetch() {
  24. await this.$store.dispatch('getShopInfo', 'layout').then(res => {
  25. console.log(res.logo, 'layout logo log')
  26. this.websitelogo = !this.$mediaRegExp.test(res.logo)
  27. ? this.$OSS_PREFIX +
  28. (/^\/.+/.test(res.logo) ? res.logo : `/${res.logo}`)
  29. : res.logo
  30. })
  31. },
  32. mounted() {
  33. // this.openZoho()
  34. // 添加监听
  35. window.addEventListener('keydown', addKeyboardKey)
  36. window.addEventListener('keyup', removeKeyboardKey)
  37. // 记住添加事件和卸载事件老是成对存在
  38. this.$once('hook:beforeDestroy', () => {
  39. window.removeEventListener('keydown', addKeyboardKey)
  40. window.removeEventListener('keyup', removeKeyboardKey)
  41. })
  42. },
  43. methods: {
  44. openZoho() {
  45. window.$zoho = window.$zoho || {}
  46. // eslint-disable-next-line
  47. $zoho.salesiq = $zoho.salesiq || {
  48. widgetcode:
  49. 'c5155e8cbfdb63f0a2b6f6f2cd50bdf2d3a9287755a068674324ed7d483e092e1baa6b2e7ee5c67d53c187e030d5c1f5',
  50. values: {},
  51. ready: function () {},
  52. }
  53. const d = document
  54. const s = d.createElement('script')
  55. s.type = 'text/javascript'
  56. s.id = 'zsiqscript'
  57. s.defer = true
  58. s.src = 'https://salesiq.zoho.com/widget'
  59. const t = d.getElementsByTagName('script')[0]
  60. t.parentNode.insertBefore(s, t)
  61. d.write("<div id='zsiqwidget'></div>")
  62. },
  63. },
  64. }
  65. </script>
  66. <style lang="scss" scoped></style>