Main.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  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">京东风格的轻量级移动端 Vue 组件库</div>
  9. <div class="content-button">
  10. <div class="leftButton" @click="toIntro">
  11. <div class="leftButtonText">开始使用</div>
  12. </div>
  13. <div class="rightButton">
  14. <div class="rightButtonText">扫码体验</div>
  15. <div class="qrcodepart">
  16. <div class="qrcode-text"> 请使用手机扫码体验 </div>
  17. <div class="qrcode"> </div>
  18. </div>
  19. </div>
  20. <iframe
  21. style="margin-left: 20px"
  22. src="https://ghbtns.com/github-btn.html?user=jdf2e&repo=nutui&type=star&count=true&size=large"
  23. frameborder="0"
  24. scrolling="0"
  25. width="170"
  26. height="30"
  27. title="GitHub"
  28. ></iframe>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="doc-content-features">
  33. <div class="doc-content-hd">
  34. <h4 class="doc-content-title">平台特色</h4>
  35. </div>
  36. <ul class="features-list">
  37. <li class="features-item">
  38. <img src="../../assets/images/img-home-features1.png" />
  39. <p class="features-title">京东风格</p>
  40. <p class="features-desc">遵循京东 App 9.0 设计规范</p>
  41. </li>
  42. <li class="features-item">
  43. <img src="../../assets/images/img-home-features5.png" />
  44. <p class="features-title">适配多端</p>
  45. <p class="features-desc a-l"
  46. >基于taro使用 nutui 组件库场景覆盖多端小程序、h5等,taro
  47. 官方推荐框架</p
  48. >
  49. </li>
  50. <li class="features-item">
  51. <img src="../../assets/images/img-home-features2.png" />
  52. <p class="features-title">组件丰富</p>
  53. <p class="features-desc a-l"
  54. >提供 70+ 组件,丰富的 demo
  55. 快速体验交互细节,覆盖各类场景满足各种功能的需求</p
  56. >
  57. </li>
  58. <li class="features-item">
  59. <img src="../../assets/images/img-home-features3.png" />
  60. <p class="features-title">前沿技术</p>
  61. <p class="features-desc">vue3 vite2.x typescript</p>
  62. </li>
  63. <li class="features-item">
  64. <img src="../../assets/images/img-home-features4.png" />
  65. <p class="features-title">贴心通道</p>
  66. <p class="features-desc">社区维护 高效服务<br />技术支持 经验沉淀</p>
  67. </li>
  68. </ul>
  69. </div>
  70. <!-- taro楼层 -->
  71. <div class="doc-content-taro">
  72. <div class="doc-content-hd">
  73. <h4 class="doc-content-title">一处代码 多端运行</h4>
  74. </div>
  75. <div class="taro-content">
  76. <div class="taro-left"> </div>
  77. <div class="taro-right">
  78. <div class="right-img"></div>
  79. <p class="taro-desc"
  80. >Taro 官方推荐框架,基于Taro 使用 nutui组件库,场景<br />覆盖多端小程序、h5等</p
  81. >
  82. </div>
  83. </div>
  84. </div>
  85. <div class="doc-content-cases" v-if="casesImages.length">
  86. <div class="doc-content-hd">
  87. <h4 class="doc-content-title">赋能案例</h4>
  88. </div>
  89. <div class="doc-content-cases-content">
  90. <div class="doc-content-cases-content__main">
  91. <div
  92. class="doc-content-cases-content__main-lefticon"
  93. @click="onLeft"
  94. ></div>
  95. <div class="doc-content-cases-content__main-iconinfo">
  96. <h4>{{ currentCaseItem.product_name }}</h4>
  97. <p>{{ currentCaseItem.product_info }}</p>
  98. <img :src="currentCaseItem.logo" />
  99. </div>
  100. <div class="doc-content-cases-content__main-iphone"></div>
  101. <div
  102. class="doc-content-cases-content__main-righticon"
  103. @click="onRight"
  104. ></div>
  105. </div>
  106. <ul class="doc-content-cases-content__list">
  107. <li v-for="img in casesImages">
  108. <img :src="img" />
  109. </li>
  110. </ul>
  111. </div>
  112. </div>
  113. <div class="doc-content-more" v-if="articleList.length">
  114. <div class="doc-content-hd">
  115. <h4 class="doc-content-title">更多内容</h4>
  116. <a class="sub-more" href="#/resource">More</a>
  117. </div>
  118. <ul class="more-list">
  119. <li
  120. class="more-item"
  121. v-for="item in articleList.slice(0, 4)"
  122. :key="item.id"
  123. @click="toLink(item.id)"
  124. >
  125. <img :src="item.cover_image" />
  126. <p class="more-title" v-hover>{{ item.title }}</p>
  127. </li>
  128. </ul>
  129. </div>
  130. </div>
  131. <doc-footer></doc-footer>
  132. </template>
  133. <script lang="ts">
  134. import { defineComponent, onMounted, reactive, toRefs, computed } from 'vue';
  135. import Header from '@/sites/doc/components/Header.vue';
  136. import Footer from '@/sites/doc/components/Footer.vue';
  137. import router from '../router';
  138. import { RefData } from '@/sites/assets/util/ref';
  139. import { ApiService } from '@/sites/service/ApiService';
  140. export default defineComponent({
  141. name: 'main',
  142. components: {
  143. [Header.name]: Header,
  144. [Footer.name]: Footer
  145. },
  146. setup() {
  147. const articleList: any[] = [];
  148. let casesList: any[] = [];
  149. const casesImages: string[] = [];
  150. const currentCaseItem: any = {};
  151. const data = reactive({
  152. // theme: 'white',
  153. articleList,
  154. casesImages,
  155. currentCaseItem
  156. });
  157. onMounted(() => {
  158. // 文章列表接口
  159. const apiService = new ApiService();
  160. apiService.getArticle().then((res) => {
  161. if (res?.state == 0) {
  162. data.articleList = (res.value.data.arrays as any[])
  163. .map((item) => {
  164. if (item.type == 1) {
  165. return item;
  166. }
  167. })
  168. .filter((i) => i);
  169. }
  170. });
  171. apiService.getCases().then((res) => {
  172. if (res?.state == 0) {
  173. data.casesImages = (res.value.data.arrays as any[])
  174. .map((item) => {
  175. return item.cover_image.split(',');
  176. })
  177. .toString()
  178. .split(',');
  179. casesList = res.value.data.arrays as any[];
  180. data.currentCaseItem = casesList[0];
  181. }
  182. });
  183. });
  184. const findCasesItem = (url: string) => {
  185. data.currentCaseItem = casesList.find((i) => i.cover_image.includes(url));
  186. };
  187. const onLeft = () => {
  188. let url = data.casesImages.shift() as string;
  189. findCasesItem(url);
  190. data.casesImages.push(url);
  191. };
  192. const onRight = () => {
  193. let url = data.casesImages.pop() as string;
  194. findCasesItem(url);
  195. data.casesImages.unshift(url);
  196. };
  197. const themeName = computed(() => {
  198. return function () {
  199. return `doc-content-${RefData.getInstance().themeColor.value}`;
  200. };
  201. });
  202. const toLink = (id: number) => {
  203. window.open('//jelly.jd.com/article/' + id);
  204. };
  205. function toIntro() {
  206. router.push({ path: '/intro' });
  207. }
  208. return {
  209. toIntro,
  210. ...toRefs(data),
  211. themeName,
  212. toLink,
  213. onLeft,
  214. onRight
  215. };
  216. }
  217. });
  218. </script>
  219. <style lang="scss">
  220. @keyframes fadeInLeft {
  221. from {
  222. opacity: 0;
  223. transform: translate3d(-100%, 0, 0);
  224. }
  225. to {
  226. opacity: 1;
  227. transform: translate3d(0, 0, 0);
  228. }
  229. }
  230. .doc-content-index {
  231. .content-left {
  232. background: url(https://storage.360buyimg.com/imgtools/a423faab46-8b142e80-8bb1-11eb-853a-6fded8704e77.png)
  233. no-repeat;
  234. background-size: 1126px 568px;
  235. background-position-x: right;
  236. background-position-y: 150px;
  237. .content-title {
  238. animation: fadeInLeft 1s both;
  239. }
  240. .content-smile {
  241. animation: fadeInLeft 1s both 0.5s;
  242. }
  243. .content-subTitle {
  244. animation: fadeInLeft 1s both 0.5s;
  245. }
  246. .content-button {
  247. iframe {
  248. animation: fadeInLeft 1s both 1.2s;
  249. }
  250. .leftButton {
  251. animation: fadeInLeft 1s both 1.2s;
  252. }
  253. .rightButton {
  254. animation: fadeInLeft 1s both 1.2s;
  255. }
  256. }
  257. }
  258. }
  259. </style>
  260. <style lang="scss" scoped>
  261. .doc-content {
  262. &-hd {
  263. height: 52px;
  264. line-height: 52px;
  265. margin-bottom: 50px;
  266. text-align: center;
  267. position: relative;
  268. .sub-more {
  269. position: absolute;
  270. right: 0;
  271. font-size: 14px;
  272. color: $theme-red;
  273. }
  274. }
  275. &-title {
  276. display: inline-block;
  277. font-size: 26px;
  278. }
  279. &-features {
  280. width: 1200px;
  281. margin: 0 auto 90px;
  282. .features-list {
  283. display: flex;
  284. justify-content: space-between;
  285. margin-top: 50px;
  286. }
  287. .features-item {
  288. width: 198px;
  289. text-align: center;
  290. img {
  291. width: 100px;
  292. height: 100px;
  293. margin-bottom: 20px;
  294. }
  295. }
  296. .features-title {
  297. margin-bottom: 20px;
  298. font-size: 24px;
  299. }
  300. .features-desc {
  301. font-size: 14px;
  302. line-height: 18px;
  303. }
  304. }
  305. &-taro {
  306. width: 1200px;
  307. margin: 0 auto 90px;
  308. .taro-content {
  309. display: flex;
  310. .taro-left {
  311. margin-left: 50px;
  312. width: 453px;
  313. height: 386px;
  314. background: url('../../assets/images/img-taro-left.png') no-repeat;
  315. background-size: cover;
  316. }
  317. .taro-right {
  318. margin-left: 145px;
  319. .right-img {
  320. width: 436px;
  321. height: 213px;
  322. background: url('../../assets/images/img-taro-right.png') no-repeat;
  323. background-size: cover;
  324. margin-bottom: 58px;
  325. }
  326. .taro-desc {
  327. color: #f2f2f2;
  328. font-weight: lighter;
  329. font-size: 18px;
  330. line-height: 30px;
  331. }
  332. }
  333. }
  334. }
  335. &-cases {
  336. width: 1200px;
  337. overflow: hidden;
  338. margin: 0 auto 90px;
  339. &-content {
  340. height: 463px;
  341. display: flex;
  342. align-items: center;
  343. &__main {
  344. padding: 0 22px;
  345. width: 590px;
  346. height: 463px;
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. background: #959fb1;
  351. border-radius: 29px 20px 20px 29px;
  352. &-iphone {
  353. width: 210px;
  354. height: 420px;
  355. background-image: url('../../assets/images/iphone-cases.png');
  356. background-repeat: no-repeat;
  357. background-size: 100% 100%;
  358. z-index: 1;
  359. }
  360. &-lefticon {
  361. margin-right: 20px;
  362. width: 36px;
  363. height: 36px;
  364. background-image: url('../../assets/images/right-arrow.png');
  365. transform: rotate(180deg);
  366. background-repeat: no-repeat;
  367. background-size: 100% 100%;
  368. cursor: pointer;
  369. &:hover {
  370. transform: rotate(0);
  371. background-image: url('../../assets/images/left-arrow.png');
  372. }
  373. }
  374. &-righticon {
  375. margin-left: 20px;
  376. width: 36px;
  377. height: 36px;
  378. background-image: url('../../assets/images/right-arrow.png');
  379. background-repeat: no-repeat;
  380. background-size: 100% 100%;
  381. cursor: pointer;
  382. z-index: 1;
  383. &:hover {
  384. transform: rotate(180deg);
  385. background-image: url('../../assets/images/left-arrow.png');
  386. }
  387. }
  388. &-iconinfo {
  389. width: 190px;
  390. flex-shrink: 0;
  391. display: flex;
  392. flex-direction: column;
  393. > h4 {
  394. line-height: 42px;
  395. font-size: 26px;
  396. color: rgba(255, 255, 255, 1);
  397. }
  398. > p {
  399. font-size: 18px;
  400. margin-bottom: 20px;
  401. color: rgba(255, 255, 255, 1);
  402. }
  403. > img {
  404. width: 114px;
  405. height: 114px;
  406. overflow: hidden;
  407. border-radius: 29px;
  408. }
  409. }
  410. }
  411. &__list {
  412. flex: 1;
  413. display: flex;
  414. margin-left: -275px;
  415. > li {
  416. width: 180px;
  417. height: 390px;
  418. flex-shrink: 0;
  419. margin-right: 20px;
  420. box-shadow: 0px 1px 7px 0px #edeef1;
  421. transition: all 0.5s;
  422. &:first-child {
  423. margin-right: 139px;
  424. transform: scale(1.04);
  425. }
  426. > img {
  427. width: 100%;
  428. height: 100%;
  429. }
  430. }
  431. }
  432. }
  433. }
  434. &-more {
  435. width: 1200px;
  436. margin: 0 auto 80px;
  437. .more-list {
  438. display: flex;
  439. flex-wrap: wrap;
  440. }
  441. .more-item {
  442. width: 280px;
  443. margin-right: 26px;
  444. cursor: pointer;
  445. &:nth-child(4n) {
  446. margin-right: 0;
  447. }
  448. img {
  449. width: 280px;
  450. height: 170px;
  451. margin-bottom: 20px;
  452. border-radius: 6px;
  453. box-shadow: 0px 1px 7px 0px rgba(237, 238, 241, 1);
  454. }
  455. }
  456. .more-title {
  457. width: 280px;
  458. height: 44px;
  459. line-height: 22px;
  460. font-size: 14px;
  461. overflow: hidden;
  462. text-overflow: ellipsis;
  463. -webkit-line-clamp: 2;
  464. line-clamp: 2;
  465. -webkit-box-orient: vertical;
  466. }
  467. }
  468. }
  469. .doc-content-index {
  470. display: flex;
  471. height: 926px;
  472. margin-bottom: 70px;
  473. background-color: #070505;
  474. min-width: 1200px;
  475. .content-left {
  476. padding: 15% 0 0 8.8%;
  477. // margin: auto 0;
  478. flex: 1;
  479. min-width: 550px;
  480. .content-title {
  481. // line-height: 36px;
  482. font-size: 42px;
  483. color: rgba(255, 255, 255, 1);
  484. }
  485. .content-smile {
  486. margin-top: 10px;
  487. width: 44px;
  488. height: 17px;
  489. background: url(https://storage.360buyimg.com/imgtools/09516173b9-9b32b9d0-3864-11eb-9a56-0104487ad2b0.png)
  490. no-repeat;
  491. background-size: cover;
  492. }
  493. .content-subTitle {
  494. margin-top: 12px;
  495. font-size: 20px;
  496. color: rgba(255, 255, 255, 1);
  497. }
  498. .content-button {
  499. position: relative;
  500. display: flex;
  501. margin-top: 40px;
  502. iframe {
  503. align-self: center;
  504. }
  505. .leftButton {
  506. display: flex;
  507. .leftButtonText {
  508. align-self: center;
  509. margin: auto;
  510. font-size: 14px;
  511. color: rgba(255, 255, 255, 1);
  512. }
  513. width: 150px;
  514. height: 40px;
  515. background: linear-gradient(
  516. 135deg,
  517. rgba(250, 25, 44, 1) 0%,
  518. rgba(250, 39, 40, 1) 45%,
  519. rgba(250, 56, 31, 1) 83%,
  520. rgba(250, 63, 25, 1) 100%
  521. );
  522. border-radius: 29px;
  523. cursor: pointer;
  524. }
  525. .rightButton {
  526. display: flex;
  527. position: relative;
  528. .rightButtonText {
  529. align-self: center;
  530. margin: auto;
  531. font-size: 14px;
  532. color: rgba(227, 44, 54, 1);
  533. }
  534. margin-left: 26px;
  535. width: 150px;
  536. height: 40px;
  537. border: 1px solid rgba(250, 44, 25, 1);
  538. border-radius: 29px;
  539. background-color: #000000;
  540. cursor: pointer;
  541. &:hover {
  542. .qrcodepart {
  543. display: block;
  544. }
  545. }
  546. }
  547. .qrcodepart {
  548. display: none;
  549. position: absolute;
  550. right: -10px;
  551. top: 50px;
  552. padding: 4px;
  553. width: 166px;
  554. border-radius: 6px;
  555. background: rgba(255, 255, 255, 1);
  556. box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.11);
  557. .qrcode-text {
  558. font-size: 14px;
  559. color: rgba(51, 51, 51, 1);
  560. text-align: center;
  561. }
  562. .qrcode {
  563. width: 160px;
  564. height: 160px;
  565. margin: 0 auto;
  566. background: url(https://img12.360buyimg.com/imagetools/jfs/t1/162421/39/13392/9425/6052ea60E592310a9/264bdff23ef5fe95.png)
  567. no-repeat;
  568. background-size: cover;
  569. }
  570. }
  571. }
  572. }
  573. }
  574. .doc-content-black {
  575. background: $theme-black-content-bg;
  576. color: white;
  577. .doc-content-title {
  578. color: white;
  579. }
  580. .doc-content-features {
  581. .features-title {
  582. color: white;
  583. }
  584. .features-desc {
  585. color: #a5a5a5;
  586. }
  587. }
  588. .doc-content-more {
  589. .more-title {
  590. color: #fff;
  591. }
  592. }
  593. .doc-content-cases-content__main {
  594. background: #474753;
  595. }
  596. .doc-content-cases-content__list {
  597. li {
  598. box-shadow: none;
  599. }
  600. }
  601. .doc-content-more {
  602. .more-item img {
  603. box-shadow: none;
  604. }
  605. }
  606. }
  607. .doc-content-white,
  608. .doc-content-red {
  609. background: white;
  610. color: white;
  611. .doc-content-title {
  612. color: $theme-white-footer-word3;
  613. }
  614. .doc-content-features {
  615. .features-title {
  616. color: $theme-white-word;
  617. }
  618. .features-desc {
  619. color: $theme-white-index-desc;
  620. }
  621. }
  622. .doc-content-more {
  623. .more-title {
  624. color: $theme-white-footer-word3;
  625. }
  626. }
  627. .taro-content {
  628. display: flex;
  629. .taro-left {
  630. margin-left: 50px;
  631. width: 453px;
  632. height: 386px;
  633. background: url('../../assets/images/img-taro-left-white.png') no-repeat;
  634. background-size: cover;
  635. }
  636. .taro-right {
  637. margin-left: 145px;
  638. .right-img {
  639. width: 436px;
  640. height: 213px;
  641. background: url('../../assets/images/img-taro-right-white.png')
  642. no-repeat;
  643. background-size: cover;
  644. margin-bottom: 58px;
  645. }
  646. .taro-desc {
  647. color: #1a1a1a;
  648. font-weight: lighter;
  649. font-size: 18px;
  650. line-height: 30px;
  651. }
  652. }
  653. }
  654. }
  655. .a-l {
  656. text-align: left;
  657. }
  658. </style>