Projects.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 :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="mini">
  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.AvatarItem
  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. }
  100. },
  101. filters: {
  102. fromNow (date) {
  103. return moment(date).fromNow()
  104. }
  105. },
  106. mounted () {
  107. this.getList()
  108. },
  109. methods: {
  110. handleChange (value) {
  111. console.log(`selected ${value}`)
  112. },
  113. getList () {
  114. this.$http.get('/list/article', { params: { count: 8 } }).then(res => {
  115. console.log('res', res)
  116. this.data = res.result
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less" scoped>
  123. .ant-pro-components-tag-select {
  124. /deep/ .ant-pro-tag-select .ant-tag {
  125. margin-right: 24px;
  126. padding: 0 8px;
  127. font-size: 14px;
  128. }
  129. }
  130. .ant-pro-pages-list-projects-cardList {
  131. margin-top: 24px;
  132. /deep/ .ant-card-meta-title {
  133. margin-bottom: 4px;
  134. }
  135. /deep/ .ant-card-meta-description {
  136. height: 44px;
  137. overflow: hidden;
  138. line-height: 22px;
  139. }
  140. .cardItemContent {
  141. display: flex;
  142. height: 20px;
  143. margin-top: 16px;
  144. margin-bottom: -4px;
  145. line-height: 20px;
  146. > span {
  147. flex: 1 1;
  148. color: rgba(0,0,0,.45);
  149. font-size: 12px;
  150. }
  151. /deep/ .ant-pro-avatar-list {
  152. flex: 0 1 auto;
  153. }
  154. }
  155. }
  156. </style>