Home.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div
  3. class="home"
  4. :style="{ backgroundImage: `url(${require('@/assets/images/bg.jpg')})` }"
  5. >
  6. <div class="title">
  7. <img :src="require('@/assets/images/poster-title1.png')" alt="" />
  8. <img :src="require('@/assets/images/4DWall.png')" alt="" />
  9. </div>
  10. <div class="con">
  11. <lunbo
  12. v-if="active"
  13. :id="'top'"
  14. :active="active"
  15. :data="topItem"
  16. class="top"
  17. @openIframe="openIframe"
  18. />
  19. <lunbo
  20. v-if="active && reInit"
  21. :id="'bottom'"
  22. :active="active"
  23. class="bottom"
  24. :data="bottomItem"
  25. @openIframe="openIframe"
  26. :isReverse="true"
  27. />
  28. </div>
  29. <div id="iframe-container" v-if="iframeShow">
  30. <div class="namebox">
  31. <img src="@/assets/images/namebox.png" />
  32. <div class="name">{{ name }}</div>
  33. </div>
  34. <iframe id="iframe" :src="iframeUrl" />
  35. <img id="iframeback" src="@/assets/images/iframeback.png" />
  36. <div id="iframeCancel" @click="iframeShow = false">
  37. <img src="@/assets/images/iframeCancel.png" />
  38. </div>
  39. <span id="companyText" class="loading animated"
  40. >四维时代提供技术支持</span
  41. >
  42. </div>
  43. <ul class="list">
  44. <li
  45. @click="handleItem(item)"
  46. :class="{ active: active == item.id }"
  47. v-for="(item, i) in menu"
  48. :key="i"
  49. >
  50. {{ item.name }}
  51. </li>
  52. </ul>
  53. </div>
  54. </template>
  55. <script>
  56. import lunbo from "@/components/lunbo";
  57. import { menu } from "@/data/data";
  58. function divideArr(arr) {
  59. var front = [];
  60. var back = [];
  61. for (var i = 0; i < arr.length / 2; i++) {
  62. let f = arr[i * 2];
  63. let b = arr[i * 2 + 1];
  64. f && front.push(f);
  65. b && back.push(b);
  66. }
  67. return { front, back };
  68. }
  69. export default {
  70. components: { lunbo },
  71. data() {
  72. return {
  73. menu,
  74. active: "gaochun",
  75. iframeShow: false,
  76. iframeUrl: "",
  77. name: "",
  78. reInit: true,
  79. };
  80. },
  81. methods: {
  82. openIframe(data) {
  83. this.iframeUrl = data.url;
  84. this.iframeShow = data.isShow;
  85. this.name = data.name;
  86. },
  87. handleItem(item) {
  88. this.active = "";
  89. this.iframeShow = false;
  90. setTimeout(() => {
  91. this.active = item.id;
  92. });
  93. },
  94. },
  95. computed: {
  96. topItem() {
  97. let tmp = menu.find((item) => item.id == this.active);
  98. return divideArr(tmp.list).front;
  99. },
  100. bottomItem() {
  101. let tmp = menu.find((item) => item.id == this.active);
  102. return divideArr(tmp.list).back;
  103. },
  104. },
  105. mounted() {
  106. this.$nextTick(() => {
  107. document.addEventListener("visibilitychange", () => {
  108. this.reInit = false;
  109. setTimeout(() => {
  110. this.reInit = true;
  111. });
  112. });
  113. });
  114. },
  115. };
  116. </script>
  117. <style lang="less" scoped>
  118. .home {
  119. width: 100%;
  120. height: 100%;
  121. background-size: cover;
  122. background-repeat: no-repeat;
  123. background-position: center center;
  124. .title {
  125. padding-top: 3.6vw;
  126. > img {
  127. display: block;
  128. margin: 0 auto;
  129. }
  130. }
  131. .con {
  132. .top {
  133. width: 100%;
  134. margin-right: 0;
  135. }
  136. .bottom {
  137. width: 100%;
  138. margin-left: 0;
  139. }
  140. }
  141. #iframe-container {
  142. position: fixed;
  143. top: 50%;
  144. left: 50%;
  145. transform: translate(-50%, -50%);
  146. width: 995px;
  147. height: 591px;
  148. background-color: #787878;
  149. margin: 0;
  150. z-index: 99999999;
  151. #iframeback {
  152. position: absolute;
  153. bottom: 0;
  154. left: 0;
  155. width: 100%;
  156. pointer-events: none;
  157. z-index: 999999999;
  158. }
  159. #companyText {
  160. position: absolute;
  161. z-index: 1;
  162. font-size: 16px;
  163. color: rgb(153, 153, 153);
  164. font-weight: 100;
  165. left: 50%;
  166. transform: translateX(-50%);
  167. bottom: 20px;
  168. letter-spacing: 1px;
  169. text-shadow: rgb(51 51 51) 0px 1px 1px;
  170. }
  171. .namebox {
  172. position: absolute;
  173. top: 57px;
  174. right: 124px;
  175. width: 57px;
  176. height: 337px;
  177. z-index: 999999999;
  178. .name {
  179. position: absolute;
  180. top: 50%;
  181. left: 50%;
  182. transform: translate(-50%, -50%);
  183. width: 18px;
  184. margin: 0 auto;
  185. word-wrap: break-word;
  186. word-break: break-all;
  187. font-family: Microsoft YaHei;
  188. font-weight: 400;
  189. line-height: 23px;
  190. color: #ffffff;
  191. text-shadow: 0px 0px 6px #000000;
  192. letter-spacing: 24px;
  193. }
  194. }
  195. #iframe {
  196. position: absolute;
  197. top: 0;
  198. left: 0;
  199. width: 100%;
  200. height: 100%;
  201. }
  202. #iframeCancel {
  203. position: absolute;
  204. top: 13px;
  205. right: 13px;
  206. width: 18px;
  207. height: 18px;
  208. color: #ffffff;
  209. font-size: 20px;
  210. &:hover {
  211. cursor: pointer;
  212. }
  213. > img {
  214. position: absolute;
  215. top: 50%;
  216. left: 50%;
  217. transform: translate(-50%, -50%);
  218. }
  219. }
  220. }
  221. .list {
  222. position: absolute;
  223. bottom: 2.8vw;
  224. left: 50%;
  225. transform: translateX(-50%);
  226. display: flex;
  227. justify-content: center;
  228. align-items: center;
  229. > li {
  230. display: inline-block;
  231. margin: 0 10px;
  232. color: rgba(255, 255, 255, 0.65);
  233. font-weight: bold;
  234. font-size: 16px;
  235. letter-spacing: 1px;
  236. &.active,
  237. &:hover {
  238. color: #9c8e4f;
  239. cursor: pointer;
  240. }
  241. }
  242. }
  243. }
  244. </style>