Main.vue 15 KB

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