app.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div id="layout-wrapper" class="layout-wrapper" :class="inverse">
  3. <Header></Header>
  4. <div class="main-container">
  5. <!-- <NuxtPage /> -->
  6. <router-view></router-view>
  7. <template v-if="language == ''">
  8. <div class="layout-link">
  9. <div class="email">
  10. <n-popover trigger="hover" placement="left-start">
  11. <template #trigger>
  12. <div class="email-icon link-icon">
  13. <n-icon :component="IosCall" :size="30" color="#fff" />
  14. </div>
  15. </template>
  16. <div class="email-cnt link-content">
  17. <div class="email-title link-title">
  18. {{ t('common.link.phone') }}
  19. </div>
  20. <div class="link-way">
  21. <a href="tel:86-027-85566566">86-027-85307885</a>
  22. </div>
  23. </div>
  24. </n-popover>
  25. </div>
  26. <div class="telphone">
  27. <n-popover trigger="hover" placement="left-start">
  28. <template #trigger>
  29. <div class="email-icon link-icon">
  30. <n-icon :component="IosPhonePortrait" :size="30" color="#fff" />
  31. </div>
  32. </template>
  33. <div class="link-content">
  34. <div class="link-title">{{ t('common.link.telphone') }}</div>
  35. <div class="link-way">
  36. <a href="tel:17320528525">{{ t('common.link.servicer01') }} 17320528525</a>
  37. <a href="tel:17320528335">{{ t('common.link.servicer02') }} 17320528335</a>
  38. </div>
  39. </div>
  40. </n-popover>
  41. </div>
  42. <div class="wx">
  43. <n-popover trigger="hover" placement="left-start">
  44. <template #trigger>
  45. <div class="email-icon link-icon">
  46. <n-icon :component="IosChatbubbles" :size="30" color="#fff" />
  47. </div>
  48. </template>
  49. <div class="link-content">
  50. <div class="link-title">{{ t('common.wx.service') }}</div>
  51. <div class="link-way">
  52. <img src="@/assets/images/wx-02.jpg" />
  53. </div>
  54. </div>
  55. </n-popover>
  56. </div>
  57. </div>
  58. </template>
  59. </div>
  60. <Footer v-if="showFooter"></Footer>
  61. <n-back-top :right="5" :bottom="150" color="#fff" icon-color="#fff" :theme-overrides="{ iconColor: '#fff' }" style="width: 45px; height: 45px; background-color: #18a058; color: #fff; border-radius: 100%" />
  62. </div>
  63. </template>
  64. <script lang="ts" setup>
  65. import { ref, onMounted, watch, onUnmounted } from "vue";
  66. import {
  67. IosMail,
  68. IosPhonePortrait,
  69. IosChatbubbles,
  70. IosCall,
  71. } from "@vicons/ionicons4";
  72. import { useRoute } from "vue-router";
  73. import { useI18n } from "#imports";
  74. import { useUserStore } from "@/store/user";
  75. const { t } = useI18n();
  76. const route = useRoute();
  77. const inverse = ref<string>("");
  78. const code = ref<string>("none"); // 二维码
  79. const closeStatus = ref<string>("");
  80. const scrollTop = ref<number>(0); // 滚动距离
  81. const color = ref<string>("#fff"); // 导航栏字体颜色
  82. const showFooter = ref<boolean>(true);
  83. const userStore = useUserStore();
  84. const language = ref("");
  85. const nuxtApp = useNuxtApp();
  86. onMounted(async () => {
  87. language.value = userStore.getLang;
  88. renderNavbar(route.path);
  89. window.addEventListener("scroll", onScroll);
  90. try {
  91. const script = document.createElement("script");
  92. script.src = "/wow.js";
  93. script.onload = () => {
  94. if (window.WOW) {
  95. new window.WOW().init();
  96. window.__WOW_INITIALIZED__ = true; // 设置标志防止重复初始化
  97. }
  98. };
  99. document.head.appendChild(script);
  100. } catch (error) {
  101. console.log(error);
  102. }
  103. });
  104. onUnmounted(() => {
  105. window.removeEventListener("scroll", onScroll);
  106. });
  107. watch(() => route.name, renderNavbar);
  108. // 导航栏切换
  109. function renderNavbar(routePath: any | null | undefined) {
  110. if (
  111. (routePath === "/" || "/market" === route.path) &&
  112. scrollTop.value === 0
  113. ) {
  114. inverse.value = "inverse";
  115. code.value = "none";
  116. color.value = "#fff";
  117. } else {
  118. inverse.value = "";
  119. code.value = "block";
  120. color.value = "#000";
  121. }
  122. showFooter.value = ["mineUpdatePwd", "payBack"].includes(routePath)
  123. ? false
  124. : true;
  125. ["reports", "newsCategories", "bulletinThinkTank"].includes(routePath)
  126. ? userStore.setSearchType(routePath)
  127. : userStore.setSearchType("");
  128. }
  129. // 滚动条事件
  130. function onScroll() {
  131. scrollTop.value = document.documentElement.scrollTop;
  132. if (
  133. scrollTop.value === 0 &&
  134. (route.name === "index___zh" ||
  135. route.name === "index___en" ||
  136. "/market" === route.path)
  137. ) {
  138. inverse.value = "inverse";
  139. code.value = "none";
  140. color.value = "#fff";
  141. } else {
  142. inverse.value = "";
  143. if (closeStatus.value != "click") {
  144. code.value = "block";
  145. }
  146. color.value = "#000";
  147. }
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. .main-container {
  152. margin-top: 140px;
  153. min-height: calc(100vh - 140px);
  154. //background-color: #edf0f5;
  155. .limit-width {
  156. width: 1220px;
  157. margin: 0 auto;
  158. }
  159. }
  160. .inverse :deep(.app-header) {
  161. background-color: transparent !important;
  162. }
  163. .main-container {
  164. margin-top: 0;
  165. }
  166. .layout-link {
  167. position: fixed;
  168. bottom: 200px;
  169. right: 5px;
  170. z-index: 3;
  171. display: v-bind("code");
  172. > div {
  173. padding-bottom: 5px;
  174. cursor: pointer;
  175. }
  176. .link-icon {
  177. width: 45px;
  178. height: 45px;
  179. border-radius: 5px;
  180. background-color: #18a058;
  181. .n-icon {
  182. line-height: 55px;
  183. width: 100%;
  184. text-align: center;
  185. }
  186. }
  187. }
  188. .link-content {
  189. padding: 8px;
  190. text-align: center;
  191. border: 1px solid #18a058;
  192. font-size: 16px;
  193. .link-title {
  194. border-bottom: 1px solid #18a058;
  195. padding-bottom: 4px;
  196. color: #18a058;
  197. }
  198. .link-way {
  199. font-weight: 600;
  200. padding-top: 4px;
  201. > img {
  202. width: 150px;
  203. height: 150px;
  204. }
  205. > a {
  206. display: block;
  207. }
  208. }
  209. }
  210. .v-binder-follower-content {
  211. top: 23px;
  212. }
  213. </style>
  214. <style lang="scss">
  215. #nav-item .txt,
  216. .home-tel,
  217. .lang-select,
  218. .lang .n-icon,
  219. .userInfo {
  220. color: v-bind("color");
  221. }
  222. .home-tel {
  223. .n-icon {
  224. border: 1px solid v-bind("color");
  225. }
  226. }
  227. #nav-item {
  228. &.router-link-active {
  229. &::after {
  230. background-color: v-bind("color");
  231. }
  232. }
  233. &:hover {
  234. &::after {
  235. background-color: v-bind("color");
  236. }
  237. }
  238. }
  239. </style>