index.tpl 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <style scoped>
  2. .banner {
  3. text-align: center;
  4. }
  5. .banner-desc {
  6. padding-top: 20px;
  7. h1 {
  8. font-size: <%= titleSize >px;
  9. margin: 0;
  10. line-height: 48px;
  11. color: #555;
  12. }
  13. p {
  14. font-size: <%= paraSize >px;
  15. line-height: 28px;
  16. color: #888;
  17. margin: 10px 0 5px;
  18. }
  19. }
  20. .sponsors {
  21. display: flex;
  22. justify-content: center;
  23. }
  24. .sponsor {
  25. margin: 0 20px 50px;
  26. display: inline-flex;
  27. width: 300px;
  28. height: 100px;
  29. justify-content: center;
  30. img {
  31. margin-right: 20px;
  32. }
  33. div {
  34. display: flex;
  35. flex-direction: column;
  36. justify-content: center;
  37. }
  38. p {
  39. margin: 0;
  40. line-height: 1.8;
  41. color: #999;
  42. font-size: 14px;
  43. }
  44. }
  45. .jumbotron {
  46. width: 890px;
  47. margin: 30px auto;
  48. position: relative;
  49. img {
  50. width: 100%;
  51. }
  52. .jumbotron-red {
  53. transition: height .1s;
  54. background: #FFF;
  55. position: absolute;
  56. left: 0;
  57. top:0;
  58. overflow: hidden;
  59. }
  60. }
  61. .cards {
  62. margin: 0 auto 110px;
  63. width: 1140px;
  64. .container {
  65. padding: 0;
  66. margin: 0 -11px;
  67. width: auto;
  68. &::before, &::after {
  69. display: table;
  70. content: "";
  71. }
  72. &::after {
  73. clear: both;
  74. }
  75. }
  76. li {
  77. width: 25%;
  78. padding: 0 19px;
  79. box-sizing: border-box;
  80. float: left;
  81. list-style: none;
  82. }
  83. img {
  84. width: 160px;
  85. height: 120px;
  86. }
  87. }
  88. .card {
  89. height: 430px;
  90. width: 100%;
  91. background:#ffffff;
  92. border:1px solid #eaeefb;
  93. border-radius:5px;
  94. box-sizing: border-box;
  95. text-align: center;
  96. position: relative;
  97. transition: all .3s ease-in-out;
  98. bottom: 0;
  99. img {
  100. margin: 66px auto 60px;
  101. }
  102. h3 {
  103. margin: 0;
  104. font-size: 18px;
  105. color: #1f2f3d;
  106. font-weight: normal;
  107. }
  108. p {
  109. font-size: 14px;
  110. color: #99a9bf;
  111. padding: 0 25px;
  112. line-height: 20px;
  113. }
  114. a {
  115. height: 53px;
  116. line-height: 52px;
  117. font-size: 14px;
  118. color: #409EFF;
  119. text-align: center;
  120. border: 0;
  121. border-top: 1px solid #eaeefb;
  122. padding: 0;
  123. cursor: pointer;
  124. width: 100%;
  125. position: absolute;
  126. bottom: 0;
  127. left: 0;
  128. background-color: #fff;
  129. border-radius: 0 0 5px 5px;
  130. transition: all .3s;
  131. text-decoration: none;
  132. display: block;
  133. &:hover {
  134. color: #fff;
  135. background: #409EFF;
  136. }
  137. }
  138. &:hover {
  139. bottom: 6px;
  140. box-shadow: 0 6px 18px 0 rgba(232,237,250,0.50);
  141. }
  142. }
  143. @media (max-width: 1140px) {
  144. .cards {
  145. width: 100%;
  146. .container {
  147. width: 100%;
  148. margin: 0;
  149. }
  150. }
  151. .banner .container {
  152. width: 100%;
  153. box-sizing: border-box;
  154. }
  155. .banner img {
  156. right: 0;
  157. }
  158. }
  159. @media (max-width: 1000px) {
  160. .banner .container {
  161. img {
  162. display: none;
  163. }
  164. }
  165. .jumbotron {
  166. display: none;
  167. }
  168. }
  169. @media (max-width: 768px) {
  170. .cards {
  171. li {
  172. width: 80%;
  173. margin: 0 auto 20px;
  174. float: none;
  175. }
  176. .card {
  177. height: auto;
  178. padding-bottom: 54px;
  179. }
  180. }
  181. .banner-stars {
  182. display: none;
  183. }
  184. .banner-desc {
  185. #line2 {
  186. display: none;
  187. }
  188. h2 {
  189. font-size: 32px;
  190. }
  191. p {
  192. width: auto;
  193. }
  194. }
  195. }
  196. .theme-intro-b {
  197. position: fixed;
  198. left: 0;
  199. right: 0;
  200. top: 0;
  201. bottom: 0;
  202. z-index: 200;
  203. .intro-banner {
  204. position: absolute
  205. }
  206. img {
  207. width: 300px;
  208. }
  209. .title {
  210. position: absolute;
  211. top: 0;
  212. bottom: 0;
  213. left: 0;
  214. right: 0;
  215. color: #FFF;
  216. text-align: center;
  217. font-weight: bold;
  218. font-size: 24px;
  219. display: flex;
  220. justify-content: center;
  221. align-items: center;
  222. p {
  223. padding: 0;
  224. margin: 10px 0;
  225. }
  226. }
  227. }
  228. .theme-intro-a {
  229. position: fixed;
  230. left: 0;
  231. right: 0;
  232. top: 0;
  233. bottom: 0;
  234. z-index: 200;
  235. .mask{
  236. position: fixed;
  237. left: 0;
  238. right: 0;
  239. top: 0;
  240. bottom: 0;
  241. background: #000;
  242. opacity: .5;
  243. }
  244. .intro-banner {
  245. top: 50%;
  246. left: 50%;
  247. position: fixed;
  248. -webkit-transform: translate(-50%, -50%);
  249. transform: translate(-50%, -50%);
  250. box-sizing: border-box;
  251. text-align: center;
  252. z-index: 100;
  253. img {
  254. width: 100%;
  255. }
  256. .intro-text {
  257. position: absolute;
  258. top: 50%;
  259. left: 0;
  260. right: 0;
  261. p {
  262. padding: 0;
  263. margin: 0;
  264. font-size: 48px;
  265. font-weight: bold;
  266. color: #FFF;
  267. }
  268. }
  269. }
  270. }
  271. </style>
  272. <template>
  273. <div>
  274. <div class="banner">
  275. <div class="banner-desc">
  276. <h1><%= 1 ></h1>
  277. <p><%= 2 ></p>
  278. </div>
  279. </div>
  280. <div class="jumbotron" ref="indexMainImg">
  281. <img src="~examples/assets/images/theme-index-blue.png" alt="">
  282. <div class="jumbotron-red" :style="{
  283. height: mainImgOffset + 'px'
  284. }">
  285. <img src="~examples/assets/images/theme-index-red.png" alt="">
  286. </div>
  287. </div>
  288. <div class="sponsors">
  289. <a class="sponsor" href="https://tipe.io/?ref=element" target="_blank" v-show="lang !== 'zh-CN'">
  290. <img width="35px" src="~examples/assets/images/tipe.svg" alt="tipe.io">
  291. <div>
  292. <p>Sponsored by Tipe.io</p>
  293. <p>Next Generation API-first CMS</p>
  294. </div>
  295. </a>
  296. <a class="sponsor" href="https://www.duohui.cn/?utm_source=element&utm_medium=web&utm_campaign=element-index" target="_blank">
  297. <img width="45px" src="~examples/assets/images/duohui.svg" alt="duohui">
  298. <div>
  299. <p>Sponsored by 多会</p>
  300. <p>炫酷的新一代活动票务系统</p>
  301. </div>
  302. </a>
  303. </div>
  304. <div class="cards">
  305. <ul class="container">
  306. <li>
  307. <div class="card">
  308. <img src="~examples/assets/images/guide.png" alt="">
  309. <h3><%= 3 ></h3>
  310. <p><%= 4 ></p>
  311. <router-link
  312. active-class="active"
  313. to="/<%= lang >/guide/design"
  314. exact><%= 5 >
  315. </router-link>
  316. </div>
  317. </li>
  318. <li>
  319. <div class="card">
  320. <img src="~examples/assets/images/component.png" alt="">
  321. <h3><%= 6 ></h3>
  322. <p><%= 7 ></p>
  323. <router-link
  324. active-class="active"
  325. to="/<%= lang >/component/layout"
  326. exact><%= 5 >
  327. </router-link>
  328. </div>
  329. </li>
  330. <li>
  331. <div class="card">
  332. <img src="~examples/assets/images/theme-index-icon.svg" alt="">
  333. <h3><%= 10 ></h3>
  334. <p><%= 11 ></p>
  335. <router-link
  336. active-class="active"
  337. to="/<%= lang >/theme"
  338. exact><%= 5 >
  339. </router-link>
  340. </div>
  341. </li>
  342. <li>
  343. <div class="card">
  344. <img src="~examples/assets/images/resource.png" alt="">
  345. <h3><%= 8 ></h3>
  346. <p><%= 9 ></p>
  347. <router-link
  348. active-class="active"
  349. to="/<%= lang >/resource"
  350. exact><%= 5 >
  351. </router-link>
  352. </div>
  353. </li>
  354. </ul>
  355. </div>
  356. <div class="theme-intro-a" v-if="showIntroA" @click="hideIntroA">
  357. <div class="intro-banner">
  358. <img src="~examples/assets/images/theme-intro.png" alt="">
  359. <div class="intro-text">
  360. <p><%= 12 ></p>
  361. </div>
  362. </div>
  363. <div class="mask"></div>
  364. </div>
  365. <div
  366. class="theme-intro-b"
  367. @click="hideIntroB"
  368. v-if="showIntroB"
  369. >
  370. <div class="intro-banner"
  371. :style="{
  372. left: introBX + 'px',
  373. top: introBY + 'px'
  374. }"
  375. >
  376. <img src="~examples/assets/images/intro-theme-b.png" alt="">
  377. <div class="title">
  378. <div>
  379. <p><%= 13 ></p>
  380. <p><%= 14 ></p>
  381. </div>
  382. </div>
  383. </div>
  384. </div>
  385. </div>
  386. </template>
  387. <script>
  388. import throttle from 'throttle-debounce/throttle';
  389. import { addClass, removeClass } from 'element-ui/src/utils/dom';
  390. export default {
  391. created() {
  392. this.throttledHandleScroll = throttle(10, true, index => {
  393. this.handleScroll(index);
  394. });
  395. },
  396. methods: {
  397. handleScroll(index) {
  398. const ele = this.$refs.indexMainImg;
  399. const rect = ele.getBoundingClientRect();
  400. const eleHeight = ele.clientHeight + 55;
  401. let calHeight = (180 - rect.top) * 2;
  402. if (calHeight < 0) calHeight = 0;
  403. if (calHeight > eleHeight) calHeight = eleHeight;
  404. this.mainImgOffset = calHeight;
  405. },
  406. hideIntroB() {
  407. removeClass(document.body, 'el-loading-parent--hidden');
  408. localStorage.setItem('KNOW_THEME', 'true');
  409. this.showIntroB = false;
  410. },
  411. hideIntroA() {
  412. this.showIntroA = false;
  413. this.showIntroB = true;
  414. }
  415. },
  416. data() {
  417. return {
  418. lang: this.$route.meta.lang,
  419. mainImgOffset: 0,
  420. showIntroA: false,
  421. showIntroB: false,
  422. introBY: 0,
  423. introBX: 0
  424. };
  425. },
  426. beforeDestroy() {
  427. window.removeEventListener('scroll', this.throttledHandleScroll);
  428. },
  429. mounted() {
  430. window.addEventListener('scroll', this.throttledHandleScroll);
  431. if (localStorage.getItem('KNOW_THEME')) return;
  432. const themeTab = document.querySelector('.nav-item-theme');
  433. this.introBX = themeTab.offsetLeft + (themeTab.clientWidth * 0.5) - (300 / 2);
  434. this.introBY = themeTab.offsetTop + 40;
  435. this.showIntroA = true;
  436. addClass(document.body, 'el-loading-parent--hidden');
  437. }
  438. };
  439. </script>