Main.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <doc-header></doc-header>
  3. <div class="doc-content" :class="themeName()">
  4. <div class="doc-content-index">
  5. <div class="content-left">
  6. <div class="content-title"> NutUI 3.0 </div>
  7. <div class="content-smile"> </div>
  8. <div class="content-subTitle"
  9. >一套京东风格的轻量级移动端 Vue 组件库</div
  10. >
  11. <div class="content-button">
  12. <div class="leftButton" @click="toIntro">
  13. <div class="leftButtonText">开始使用</div>
  14. </div>
  15. <div class="rightButton">
  16. <div class="rightButtonText">扫码体验</div>
  17. <div class="qrcodepart">
  18. <div class="qrcode-text"> 请使用手机扫码体验 </div>
  19. <div class="qrcode"> </div>
  20. </div>
  21. </div>
  22. <iframe
  23. style="margin-left: 20px"
  24. src="https://ghbtns.com/github-btn.html?user=jdf2e&repo=nutui&type=star&count=true&size=large"
  25. frameborder="0"
  26. scrolling="0"
  27. width="170"
  28. height="30"
  29. title="GitHub"
  30. ></iframe>
  31. </div>
  32. </div>
  33. <div class="content-right"></div>
  34. </div>
  35. <div class="doc-content-features">
  36. <div class="doc-content-hd">
  37. <h4 class="doc-content-title">平台特色</h4>
  38. </div>
  39. <ul class="features-list">
  40. <li class="features-item">
  41. <img src="../../assets/images/img-home-features1.png" />
  42. <p class="features-title">京东风格</p>
  43. <p class="features-desc">遵循京东 App 9.0 设计规范</p>
  44. </li>
  45. <li class="features-item">
  46. <img src="../../assets/images/img-home-features2.png" />
  47. <p class="features-title">组件丰富</p>
  48. <p class="features-desc a-l"
  49. >提供 70+ 组件,丰富的 demo
  50. 快速体验交互细节,覆盖各类场景满足各种功能的需求</p
  51. >
  52. </li>
  53. <li class="features-item">
  54. <img src="../../assets/images/img-home-features3.png" />
  55. <p class="features-title">前沿技术</p>
  56. <p class="features-desc">vue3 vite2.x typescript</p>
  57. </li>
  58. <li class="features-item">
  59. <img src="../../assets/images/img-home-features4.png" />
  60. <p class="features-title">贴心通道</p>
  61. <p class="features-desc">社区维护 高效服务<br />技术支持 经验沉淀</p>
  62. </li>
  63. </ul>
  64. </div>
  65. <div class="doc-content-more" v-if="articleList.length > 0">
  66. <div class="doc-content-hd">
  67. <h4 class="doc-content-title">更多内容</h4>
  68. <a class="sub-more" href="#/resource">More</a>
  69. </div>
  70. <ul class="more-list">
  71. <li
  72. class="more-item"
  73. v-for="item in articleList.slice(0, 4)"
  74. :key="item.id"
  75. @click="toLink(item.id)"
  76. >
  77. <img :src="item.cover_image" />
  78. <p class="more-title">{{ item.title }}</p>
  79. </li>
  80. </ul>
  81. </div>
  82. </div>
  83. <doc-footer></doc-footer>
  84. </template>
  85. <script lang="ts">
  86. import { defineComponent, onMounted, reactive, toRefs, computed } from 'vue';
  87. import Header from '@/sites/doc/components/Header.vue';
  88. import Footer from '@/sites/doc/components/Footer.vue';
  89. import router from '../router';
  90. import { themeColor } from '@/sites/assets/util/ref';
  91. import { ArticleApiService } from '@/sites/service/ArticleApiService';
  92. export default defineComponent({
  93. name: 'main',
  94. components: {
  95. [Header.name]: Header,
  96. [Footer.name]: Footer
  97. },
  98. setup() {
  99. const articleList: any[] = [];
  100. const data = reactive({
  101. // theme: 'white',
  102. articleList
  103. });
  104. onMounted(() => {
  105. // 文章列表接口
  106. const articleApiService = new ArticleApiService();
  107. articleApiService.getArticle().then(res => {
  108. if (res?.state == 0) {
  109. data.articleList = (res.value.data.arrays as any[])
  110. .map(item => {
  111. if (item.type == 1) {
  112. return item;
  113. }
  114. })
  115. .filter(i => i);
  116. }
  117. });
  118. });
  119. const themeName = computed(() => {
  120. return function() {
  121. return `doc-content-${themeColor.value}`;
  122. };
  123. });
  124. const toLink = (id: number) => {
  125. window.open('//jelly.jd.com/article/' + id);
  126. };
  127. function toIntro() {
  128. router.push({ path: '/intro' });
  129. }
  130. return {
  131. toIntro,
  132. ...toRefs(data),
  133. themeName,
  134. toLink
  135. };
  136. }
  137. });
  138. </script>
  139. <style lang="scss">
  140. @keyframes fadeInLeft {
  141. from {
  142. opacity: 0;
  143. transform: translate3d(-100%, 0, 0);
  144. }
  145. to {
  146. opacity: 1;
  147. transform: translate3d(0, 0, 0);
  148. }
  149. }
  150. .doc-content-index {
  151. .content-left {
  152. .content-title {
  153. animation: fadeInLeft 1s both;
  154. }
  155. .content-smile {
  156. animation: fadeInLeft 1s both 0.5s;
  157. }
  158. .content-subTitle {
  159. animation: fadeInLeft 1s both 0.5s;
  160. }
  161. .content-button {
  162. iframe {
  163. animation: fadeInLeft 1s both 1.2s;
  164. }
  165. .leftButton {
  166. animation: fadeInLeft 1s both 1.2s;
  167. }
  168. .rightButton {
  169. animation: fadeInLeft 1s both 1.2s;
  170. }
  171. }
  172. }
  173. }
  174. </style>
  175. <style lang="scss" scoped>
  176. .doc-content {
  177. &-hd {
  178. height: 52px;
  179. line-height: 52px;
  180. margin-bottom: 50px;
  181. text-align: center;
  182. position: relative;
  183. .sub-more {
  184. position: absolute;
  185. right: 0;
  186. font-size: 14px;
  187. color: $theme-red;
  188. }
  189. }
  190. &-title {
  191. display: inline-block;
  192. font-size: 26px;
  193. font-family: PingFangSC-Medium;
  194. }
  195. &-features {
  196. width: 1200px;
  197. margin: 0 auto 90px;
  198. .features-list {
  199. display: flex;
  200. justify-content: space-between;
  201. margin-top: 50px;
  202. }
  203. .features-item {
  204. width: 296px;
  205. text-align: center;
  206. img {
  207. width: 100px;
  208. height: 100px;
  209. margin-bottom: 20px;
  210. }
  211. }
  212. .features-title {
  213. margin-bottom: 20px;
  214. font-family: PingFangSC-Medium;
  215. font-size: 24px;
  216. }
  217. .features-desc {
  218. font-size: 14px;
  219. line-height: 18px;
  220. }
  221. }
  222. &-more {
  223. width: 1200px;
  224. margin: 0 auto 80px;
  225. .more-list {
  226. display: flex;
  227. flex-wrap: wrap;
  228. }
  229. .more-item {
  230. width: 280px;
  231. margin-right: 26px;
  232. cursor: pointer;
  233. &:nth-child(4n) {
  234. margin-right: 0;
  235. }
  236. img {
  237. width: 280px;
  238. height: 170px;
  239. margin-bottom: 20px;
  240. border-radius: 6px;
  241. box-shadow: 0px 1px 7px 0px rgba(237, 238, 241, 1);
  242. }
  243. }
  244. .more-title {
  245. width: 280px;
  246. height: 44px;
  247. line-height: 22px;
  248. font-size: 14px;
  249. overflow: hidden;
  250. text-overflow: ellipsis;
  251. -webkit-line-clamp: 2;
  252. line-clamp: 2;
  253. -webkit-box-orient: vertical;
  254. }
  255. }
  256. }
  257. .doc-content-index {
  258. display: flex;
  259. height: 926px;
  260. margin-bottom: 70px;
  261. background-color: #070505;
  262. min-width: 1200px;
  263. .content-left {
  264. padding: 15% 0 0 8.8%;
  265. // margin: auto 0;
  266. flex: 1;
  267. min-width: 550px;
  268. .content-title {
  269. // line-height: 36px;
  270. font-family: PingFangSC-Medium;
  271. font-size: 42px;
  272. color: rgba(255, 255, 255, 1);
  273. }
  274. .content-smile {
  275. margin-top: 10px;
  276. width: 44px;
  277. height: 17px;
  278. background: url(https://storage.360buyimg.com/imgtools/09516173b9-9b32b9d0-3864-11eb-9a56-0104487ad2b0.png)
  279. no-repeat;
  280. background-size: cover;
  281. }
  282. .content-subTitle {
  283. margin-top: 12px;
  284. font-family: PingFangSC-Regular;
  285. font-size: 20px;
  286. color: rgba(255, 255, 255, 1);
  287. }
  288. .content-button {
  289. position: relative;
  290. display: flex;
  291. margin-top: 40px;
  292. iframe {
  293. align-self: center;
  294. }
  295. .leftButton {
  296. display: flex;
  297. .leftButtonText {
  298. align-self: center;
  299. margin: auto;
  300. font-size: 14px;
  301. color: rgba(255, 255, 255, 1);
  302. }
  303. font-family: PingFangSC-Regular;
  304. width: 150px;
  305. height: 40px;
  306. background: linear-gradient(
  307. 135deg,
  308. rgba(250, 25, 44, 1) 0%,
  309. rgba(250, 39, 40, 1) 45%,
  310. rgba(250, 56, 31, 1) 83%,
  311. rgba(250, 63, 25, 1) 100%
  312. );
  313. border-radius: 29px;
  314. cursor: pointer;
  315. }
  316. .rightButton {
  317. display: flex;
  318. position: relative;
  319. .rightButtonText {
  320. align-self: center;
  321. margin: auto;
  322. font-size: 14px;
  323. color: rgba(227, 44, 54, 1);
  324. }
  325. margin-left: 26px;
  326. width: 150px;
  327. height: 40px;
  328. border: 1px solid rgba(250, 44, 25, 1);
  329. border-radius: 29px;
  330. background-color: #000000;
  331. cursor: pointer;
  332. &:hover {
  333. .qrcodepart {
  334. display: block;
  335. }
  336. }
  337. }
  338. .qrcodepart {
  339. display: none;
  340. position: absolute;
  341. right: -10px;
  342. top: 50px;
  343. padding: 4px;
  344. width: 166px;
  345. border-radius: 6px;
  346. background: rgba(255, 255, 255, 1);
  347. box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.11);
  348. .qrcode-text {
  349. font-size: 14px;
  350. color: rgba(51, 51, 51, 1);
  351. text-align: center;
  352. }
  353. .qrcode {
  354. width: 160px;
  355. height: 160px;
  356. margin: 0 auto;
  357. background: url(https://img12.360buyimg.com/imagetools/jfs/t1/162421/39/13392/9425/6052ea60E592310a9/264bdff23ef5fe95.png)
  358. no-repeat;
  359. background-size: cover;
  360. }
  361. }
  362. }
  363. }
  364. .content-right {
  365. flex: 2;
  366. background: url(https://storage.360buyimg.com/imgtools/a423faab46-8b142e80-8bb1-11eb-853a-6fded8704e77.png)
  367. no-repeat;
  368. background-size: contain;
  369. background-position: center;
  370. }
  371. }
  372. .doc-content-black {
  373. background: $theme-black-content-bg;
  374. color: white;
  375. .doc-content-title {
  376. color: white;
  377. }
  378. .doc-content-feature {
  379. .features-title {
  380. color: white;
  381. }
  382. .features-desc {
  383. color: white;
  384. }
  385. }
  386. .doc-content-more {
  387. .more-title {
  388. color: #fff;
  389. }
  390. }
  391. }
  392. .doc-content-white,
  393. .doc-content-red {
  394. background: white;
  395. color: white;
  396. .doc-content-title {
  397. color: $theme-white-footer-word3;
  398. }
  399. .doc-content-features {
  400. .features-title {
  401. color: $theme-white-word;
  402. }
  403. .features-desc {
  404. color: $theme-white-index-desc;
  405. }
  406. }
  407. .doc-content-more {
  408. .more-title {
  409. color: $theme-white-footer-word3;
  410. }
  411. }
  412. }
  413. .a-l {
  414. text-align: left;
  415. }
  416. </style>