Resource.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <doc-header></doc-header>
  3. <div class="resource-main">
  4. <div class="resource-main-content">
  5. <h3 class="sub-title">资源</h3>
  6. <p class="sub-desc">这里汇总了Nut UI 相关的所有的资源</p>
  7. </div>
  8. </div>
  9. <!-- 设计资源 -->
  10. <div class="resource-content">
  11. <div class="resource-block" v-if="articleList.length === 0">
  12. <h4 class="sub-title">设计资源</h4>
  13. <p class="sub-desc"
  14. >这里提供 NUT UI
  15. 相关设计资源和设计工具的下载,更多设计资源正在整理和完善中。你可以在这个<span
  16. class="sub-red"
  17. >地址</span
  18. >中反馈对新版本 Sketch Symbols 组件的意见。</p
  19. >
  20. <div class="no-data">
  21. <img class="nodata-img-joy" src="../../assets/images/img-joy.png" />
  22. <p class="nodata-desc">敬请期待</p>
  23. </div>
  24. </div>
  25. <div class="resource-block" v-else>
  26. <h4 class="sub-title">设计资源</h4>
  27. <p class="sub-desc"
  28. >想要了解 Nut Ui 设计体系背后的故事?如何才能更好的应用 Ant
  29. Design?你可以查阅下述我们为你精挑细选的文章。也欢迎关注Nut Ui
  30. 官方专栏,这里常有关于Nut Ui 设计体系下相关话题内容的最新分享和讨论.</p
  31. >
  32. <div class="tab-box">
  33. <div class="tab-hd">
  34. <div
  35. class="tab-hd-item"
  36. :class="{ active: activeIndex === index }"
  37. v-for="(item, index) in tabData"
  38. :key="index"
  39. @click="clickTab(index)"
  40. >
  41. {{ item.title }}
  42. </div>
  43. </div>
  44. <div class="tab-bd" v-show="activeIndex === 0">
  45. <div
  46. class="design-item"
  47. v-for="item in articleList"
  48. :key="item.id"
  49. @click="toLink(item.id)"
  50. >
  51. <img class="img-design" :src="item.cover_image" />
  52. <p class="design-title">{{ item.title }}</p>
  53. </div>
  54. </div>
  55. <div class="tab-bd" v-show="activeIndex === 1">
  56. <div class="design-item">
  57. <img class="img-design" src="../../assets/images/img-article.jpg" />
  58. <p class="design-title"
  59. >NutUI 落地实践-让组件库服务慧采协同采购业务</p
  60. >
  61. </div>
  62. <div class="design-item">
  63. <img class="img-design" src="../../assets/images/img-article.jpg" />
  64. <p class="design-title"
  65. >NutUI 落地实践-让组件库服务慧采协同采购业务</p
  66. >
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <!-- 社区文章 -->
  72. <div class="resource-block">
  73. <h4 class="sub-title">社区文章</h4>
  74. <p class="sub-desc"
  75. >想要了解 Nut Ui 设计体系背后的故事?如何才能更好的应用 Nut
  76. Ui?你可以查阅下述我们为你精挑细选的文章。也欢迎关注Nut Ui
  77. 官方专栏,这里常有关于Nut Ui 设计体系下相关话题内容的最新分享和讨论.</p
  78. >
  79. <ul class="article-box">
  80. <li class="article-item">
  81. <a class="article-link">
  82. NutUI - 由京东出品,适合快速开发商城类h5、小程序的移动端 UI 组件库
  83. </a>
  84. </li>
  85. <li class="article-item">
  86. <a class="article-link">
  87. NutUI - 由京东出品,适合快速开发商城类h5、小程序的移动端 UI 组件库
  88. </a>
  89. </li>
  90. </ul>
  91. </div>
  92. </div>
  93. <doc-footer></doc-footer>
  94. </template>
  95. <script lang="ts">
  96. import { defineComponent, onMounted, reactive, toRefs } from 'vue';
  97. import {
  98. onBeforeRouteUpdate,
  99. RouteLocationNormalized,
  100. useRoute
  101. } from 'vue-router';
  102. import Header from '@/sites/doc/components/Header.vue';
  103. import Footer from '@/sites/doc/components/Footer.vue';
  104. import { currentRoute } from '@/sites/assets/util/ref';
  105. import { ArticleApiService } from '@/sites/service/ArticleApiService';
  106. export default defineComponent({
  107. name: 'doc',
  108. components: {
  109. [Header.name]: Header,
  110. [Footer.name]: Footer
  111. },
  112. setup() {
  113. const articleList: any[] = [];
  114. const data = reactive({
  115. articleList,
  116. tabData: [
  117. {
  118. title: '全部文章'
  119. }
  120. // {
  121. // title: '性能体验'
  122. // },
  123. // {
  124. // title: '性能体验'
  125. // }
  126. ],
  127. activeIndex: 0
  128. });
  129. const watchDemoUrl = (router: RouteLocationNormalized) => {
  130. currentRoute.value = router.name as string;
  131. };
  132. onMounted(() => {
  133. // 路由
  134. const route = useRoute();
  135. watchDemoUrl(route);
  136. // 文章列表接口
  137. const articleApiService = new ArticleApiService();
  138. articleApiService.getArticle().then(res => {
  139. if (res?.state == 0) {
  140. data.articleList = res.value.data.arrays as any[];
  141. }
  142. });
  143. });
  144. onBeforeRouteUpdate(to => {
  145. watchDemoUrl(to);
  146. });
  147. const clickTab = (index: number) => {
  148. data.activeIndex = index;
  149. };
  150. const toLink = (id: number) => {
  151. window.open('//jelly.jd.com/article/' + id);
  152. };
  153. return {
  154. ...toRefs(data),
  155. clickTab,
  156. toLink
  157. };
  158. }
  159. });
  160. </script>
  161. <style lang="scss" scoped>
  162. $mainRed: #fa685d;
  163. .resource {
  164. &-main {
  165. background-color: #1d1d1d;
  166. &-content {
  167. max-width: 1200px;
  168. margin: 0 auto;
  169. padding-top: 48px;
  170. padding-bottom: 53px;
  171. background: url('../../assets/images/bg-article.png') no-repeat;
  172. background-size: 307px 200px;
  173. background-position: right 280px top 0;
  174. .sub-title {
  175. margin-left: 8px;
  176. margin-bottom: 40px;
  177. line-height: 36px;
  178. font-size: 30px;
  179. color: $white;
  180. }
  181. .sub-desc {
  182. line-height: 22px;
  183. font-size: 16px;
  184. color: $white;
  185. }
  186. }
  187. }
  188. &-content {
  189. max-width: 1200px;
  190. margin: 0 auto;
  191. padding: 50px 0;
  192. }
  193. &-block {
  194. margin-bottom: 50px;
  195. text-align: left;
  196. .sub-title {
  197. margin-bottom: 15px;
  198. line-height: 42px;
  199. font-size: 30px;
  200. color: #1a1a1a;
  201. }
  202. .sub-desc {
  203. margin-bottom: 40px;
  204. line-height: 22px;
  205. font-size: 16px;
  206. color: #959fb1;
  207. }
  208. .sub-red {
  209. color: #fa2c19;
  210. }
  211. }
  212. }
  213. .no-data {
  214. text-align: center;
  215. .nodata-img-joy {
  216. width: 269px;
  217. height: 153px;
  218. margin-bottom: 30px;
  219. }
  220. .nodata-desc {
  221. font-size: 16px;
  222. color: #959fb1;
  223. }
  224. }
  225. .tab {
  226. &-box {
  227. }
  228. &-hd {
  229. display: flex;
  230. margin-bottom: 30px;
  231. }
  232. &-bd {
  233. display: flex;
  234. width: 100%;
  235. flex-wrap: wrap;
  236. justify-content: flex-start;
  237. }
  238. &-hd-item {
  239. margin-right: 40px;
  240. line-height: 25px;
  241. font-size: 18px;
  242. color: #808080;
  243. cursor: pointer;
  244. &:first-child {
  245. color: #1a1a1a;
  246. }
  247. &.active {
  248. color: #e32c36;
  249. }
  250. }
  251. }
  252. .design {
  253. &-item {
  254. width: 280px;
  255. margin-right: 26px;
  256. margin-bottom: 45px;
  257. cursor: pointer;
  258. &:nth-child(4n) {
  259. margin-right: 0;
  260. }
  261. .img-design {
  262. width: 280px;
  263. height: 170px;
  264. margin-bottom: 20px;
  265. border-radius: 5px;
  266. }
  267. }
  268. &-title {
  269. width: 280px;
  270. height: 44px;
  271. line-height: 22px;
  272. font-size: 16px;
  273. color: #1d1d21;
  274. text-overflow: -o-ellipsis-lastline;
  275. overflow: hidden;
  276. text-overflow: ellipsis;
  277. display: -webkit-box;
  278. -webkit-line-clamp: 2;
  279. line-clamp: 2;
  280. -webkit-box-orient: vertical;
  281. }
  282. }
  283. .article {
  284. &-item {
  285. position: relative;
  286. padding-left: 34px;
  287. margin-bottom: 20px;
  288. color: $mainRed;
  289. &:before {
  290. content: '';
  291. display: inline-block;
  292. position: absolute;
  293. top: 50%;
  294. left: 0;
  295. margin-top: -8px;
  296. width: 12px;
  297. height: 12px;
  298. border: 2px solid #fa2c19;
  299. border-radius: 50%;
  300. }
  301. }
  302. &-link {
  303. line-height: 22px;
  304. font-size: 14px;
  305. color: $mainRed;
  306. cursor: pointer;
  307. }
  308. }
  309. </style>