Projects.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div>
  3. <a-card :bordered="false" class="ant-pro-components-tag-select">
  4. <a-form :form="form" layout="inline">
  5. <standard-form-row title="所属类目" block style="padding-bottom: 11px;">
  6. <a-form-item>
  7. <tag-select>
  8. <tag-select-option value="Category1">类目一</tag-select-option>
  9. <tag-select-option value="Category2">类目二</tag-select-option>
  10. <tag-select-option value="Category3">类目三</tag-select-option>
  11. <tag-select-option value="Category4">类目四</tag-select-option>
  12. <tag-select-option value="Category5">类目五</tag-select-option>
  13. <tag-select-option value="Category6">类目六</tag-select-option>
  14. <tag-select-option value="Category7">类目七</tag-select-option>
  15. <tag-select-option value="Category8">类目八</tag-select-option>
  16. <tag-select-option value="Category9">类目九</tag-select-option>
  17. <tag-select-option value="Category10">类目十</tag-select-option>
  18. </tag-select>
  19. </a-form-item>
  20. </standard-form-row>
  21. <standard-form-row title="其它选项" grid last>
  22. <a-row>
  23. <a-col :lg="8" :md="10" :sm="10" :xs="24">
  24. <a-form-item :wrapper-col="{ sm: { span: 16 }, xs: { span: 24 } }" label="作者">
  25. <a-select
  26. style="max-width: 200px; width: 100%;"
  27. mode="multiple"
  28. placeholder="不限"
  29. v-decorator="['author']"
  30. @change="handleChange"
  31. >
  32. <a-select-option value="lisa">王昭君</a-select-option>
  33. </a-select>
  34. </a-form-item>
  35. </a-col>
  36. <a-col :lg="8" :md="10" :sm="10" :xs="24">
  37. <a-form-item :wrapper-col="{ sm: { span: 16 }, xs: { span: 24 } }" label="好评度">
  38. <a-select
  39. style="max-width: 200px; width: 100%;"
  40. placeholder="不限"
  41. v-decorator="['rate']"
  42. >
  43. <a-select-option value="good">优秀</a-select-option>
  44. <a-select-option value="normal">普通</a-select-option>
  45. </a-select>
  46. </a-form-item>
  47. </a-col>
  48. </a-row>
  49. </standard-form-row>
  50. </a-form>
  51. </a-card>
  52. <div class="ant-pro-pages-list-projects-cardList">
  53. <a-list :loading="loading" :data-source="data" :grid="{ gutter: 24, xl: 4, lg: 3, md: 3, sm: 2, xs: 1 }">
  54. <a-list-item slot="renderItem" slot-scope="item">
  55. <a-card class="ant-pro-pages-list-projects-card" hoverable>
  56. <img slot="cover" :src="item.cover" :alt="item.title" />
  57. <a-card-meta :title="item.title">
  58. <template slot="description">
  59. <ellipsis :length="50">{{ item.description }}</ellipsis>
  60. </template>
  61. </a-card-meta>
  62. <div class="cardItemContent">
  63. <span>{{ item.updatedAt | fromNow }}</span>
  64. <div class="avatarList">
  65. <avatar-list size="small" :max-length="2">
  66. <avatar-list-item
  67. v-for="(member, i) in item.members"
  68. :key="`${item.id}-avatar-${i}`"
  69. :src="member.avatar"
  70. :tips="member.name"
  71. />
  72. </avatar-list>
  73. </div>
  74. </div>
  75. </a-card>
  76. </a-list-item>
  77. </a-list>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import moment from 'moment'
  83. import { TagSelect, StandardFormRow, Ellipsis, AvatarList } from '@/components'
  84. const TagSelectOption = TagSelect.Option
  85. const AvatarListItem = AvatarList.Item
  86. export default {
  87. components: {
  88. AvatarList,
  89. AvatarListItem,
  90. Ellipsis,
  91. TagSelect,
  92. TagSelectOption,
  93. StandardFormRow
  94. },
  95. data () {
  96. return {
  97. data: [],
  98. form: this.$form.createForm(this),
  99. loading: true
  100. }
  101. },
  102. filters: {
  103. fromNow (date) {
  104. return moment(date).fromNow()
  105. }
  106. },
  107. mounted () {
  108. this.getList()
  109. },
  110. methods: {
  111. handleChange (value) {
  112. console.log(`selected ${value}`)
  113. },
  114. getList () {
  115. this.$http.get('/list/article', { params: { count: 8 } }).then(res => {
  116. console.log('res', res)
  117. this.data = res.result
  118. this.loading = false
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="less" scoped>
  125. .ant-pro-components-tag-select {
  126. :deep(.ant-pro-tag-select .ant-tag) {
  127. margin-right: 24px;
  128. padding: 0 8px;
  129. font-size: 14px;
  130. }
  131. }
  132. .ant-pro-pages-list-projects-cardList {
  133. margin-top: 24px;
  134. :deep(.ant-card-meta-title) {
  135. margin-bottom: 4px;
  136. }
  137. :deep(.ant-card-meta-description) {
  138. height: 44px;
  139. overflow: hidden;
  140. line-height: 22px;
  141. }
  142. .cardItemContent {
  143. display: flex;
  144. height: 20px;
  145. margin-top: 16px;
  146. margin-bottom: -4px;
  147. line-height: 20px;
  148. > span {
  149. flex: 1 1;
  150. color: rgba(0,0,0,.45);
  151. font-size: 12px;
  152. }
  153. :deep(.ant-pro-avatar-list) {
  154. flex: 0 1 auto;
  155. }
  156. }
  157. }
  158. </style>