index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <div>
  3. <SldHomeTopSearch />
  4. <NavCatHeader />
  5. <div class="bottom_line"></div>
  6. <Home></Home>
  7. <OpenScreen @closeScreen="closeScreen" v-if="show_open_screen && openScreenData.data.show_switch"
  8. :openScreenData="openScreenData.data"></OpenScreen>
  9. </div>
  10. </template>
  11. <script setup>
  12. const show_open_screen = ref(false);
  13. const openScreenData = reactive({ data: {} }); //开屏数据
  14. const getBaseInfo = async () => {
  15. const { data: value } = await useFetch(
  16. apiUrl +
  17. "v3/system/front/setting/getSettings",
  18. {
  19. params: {
  20. names: "sys_seo_title,sys_seo_desc,sys_seo_keywords",
  21. },
  22. }
  23. );
  24. let res = value._rawValue;
  25. if (res.state == 200) {
  26. useHead({
  27. title: res.data[0],
  28. meta: [
  29. {
  30. name: "description",
  31. content: res.data[1],
  32. },
  33. {
  34. name: "keywords",
  35. content: res.data[2],
  36. },
  37. ],
  38. });
  39. }
  40. }
  41. getBaseInfo()
  42. const getAdv = () => {
  43. get("v3/system/front/deco/firstAdv").then((res) => {
  44. if (res.state == 200) {
  45. openScreenData.data = JSON.parse(res.data.data.replace(/&quot;/g, '"'));
  46. show_open_screen.value = true
  47. }
  48. });
  49. };
  50. getAdv();
  51. const closeScreen = () => {
  52. show_open_screen.value = false;
  53. document.body.style.overflow = "";
  54. };
  55. onMounted(() => {
  56. setTimeout(() => {
  57. sldStatEvent({
  58. behaviorType: "pv",
  59. pageUrl: defaultUrl,
  60. referrerPageUrl: apiUrl,
  61. });
  62. }, 3000);
  63. });
  64. </script>
  65. <style lang="scss">
  66. .bottom_line {
  67. width: 100%;
  68. height: 2px;
  69. background: $colorMain;
  70. margin-top: -2px;
  71. }
  72. .home_adv_con {
  73. overflow: hidden;
  74. height: 80px;
  75. position: relative;
  76. margin: 0 auto;
  77. }
  78. .home_adv {
  79. width: 1920px;
  80. height: 80px;
  81. background-position: center center;
  82. background-size: cover;
  83. background-repeat: no-repeat;
  84. position: absolute;
  85. left: 50%;
  86. top: 0;
  87. margin-left: -960px;
  88. }
  89. .adv1200 {
  90. width: 1200px;
  91. height: 80px;
  92. margin: 0 auto;
  93. position: relative;
  94. }
  95. .close1 {
  96. top: 10px;
  97. right: 10px;
  98. z-index: 2;
  99. position: absolute;
  100. background: rgba(0, 0, 0, 0.5);
  101. width: 22px;
  102. height: 22px;
  103. line-height: 22px;
  104. color: #fff;
  105. cursor: pointer;
  106. text-align: center;
  107. font-size: 17px;
  108. /*font-family: cursive;*/
  109. }
  110. </style>