You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

PrjResultsItem.vue 4.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="item">
  3. <div class="title-c">
  4. <div class="avatar-c">
  5. <img v-if="data.rel_avatar_link" class="avatar" :src="data.rel_avatar_link" />
  6. <img v-else class="avatar" :avatar="data.owner_name" />
  7. </div>
  8. <div class="title">
  9. <a target="_blank" :href="`/${data.owner_name}/${data.name}`">
  10. <span :title="data.alias">{{ data.alias }}</span>
  11. </a>
  12. </div>
  13. </div>
  14. <div class="descr" :title="data.description">
  15. {{ data.description }}
  16. </div>
  17. <div class="topics">
  18. <a v-for="(item, index) in data.topics" :key="index" class="topic" target="_blank"
  19. :href="`/explore/repos?q=&topic=${item}&sort=hot`">{{ item }}</a>
  20. </div>
  21. <div class="footer">
  22. <div class="contractor" :title="data.institution.split(',').join('、')">{{ data.institution.split(',').join('、') }}
  23. </div>
  24. <div class="update-time">
  25. <span>{{ $t('repos.updated') }}</span>
  26. <el-tooltip effect="dark" :content="dateFormat(data.updated_unix)" placement="top-start">
  27. <span>{{ calcFromNow(data.updated_unix) }}</span>
  28. </el-tooltip>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import dayjs from 'dayjs';
  35. import { lang } from '~/langs';
  36. import { timeSinceUnix } from '~/utils';
  37. export default {
  38. name: "PrjResultsItem",
  39. props: {
  40. data: { type: Object, default: () => ({}) },
  41. },
  42. components: {},
  43. data() {
  44. return {};
  45. },
  46. methods: {
  47. calcFromNow(unix) {
  48. return timeSinceUnix(unix, Date.now() / 1000);
  49. },
  50. dateFormat(unix) {
  51. return lang == 'zh-CN' ? dayjs(unix * 1000).format('YYYY年MM月DD日 HH时mm分ss秒') :
  52. dayjs(unix * 1000).format('ddd, D MMM YYYY HH:mm:ss [CST]');
  53. }
  54. },
  55. mounted() { },
  56. };
  57. </script>
  58. <style scoped lang="less">
  59. .item {
  60. border-color: rgb(232, 224, 236);
  61. border-width: 1px;
  62. border-style: solid;
  63. box-shadow: rgba(168, 157, 226, 0.2) 0px 5px 10px 0px;
  64. background: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(-0.01900000000000005%2C%200.997%2C%20-0.12862587255310284%2C%20-0.01900000000000005%2C%200.995%2C%200.014)%22%3E%3Cstop%20stop-color%3D%22%23f2edf5%22%20stop-opacity%3D%221%22%20offset%3D%220.01%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23ffffff%22%20stop-opacity%3D%221%22%20offset%3D%220.31%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E");
  65. overflow: hidden;
  66. padding: 15px;
  67. }
  68. .title-c {
  69. display: flex;
  70. align-items: center;
  71. .avatar-c {
  72. height: 28px;
  73. width: 28px;
  74. margin-right: 6px;
  75. img {
  76. border-radius: 100%;
  77. height: 100%;
  78. width: 100%;
  79. }
  80. }
  81. .title {
  82. flex: 1;
  83. overflow: hidden;
  84. text-overflow: ellipsis;
  85. white-space: nowrap;
  86. span {
  87. color: rgb(16, 16, 16);
  88. font-size: 16px;
  89. font-weight: 400;
  90. }
  91. }
  92. }
  93. .descr {
  94. height: 40px;
  95. margin-top: 8px;
  96. font-size: 12px;
  97. font-weight: 300;
  98. color: rgb(136, 136, 136);
  99. text-overflow: ellipsis;
  100. word-break: break-all;
  101. display: -webkit-box;
  102. -webkit-box-orient: vertical;
  103. -webkit-line-clamp: 2;
  104. max-height: 41px;
  105. overflow: hidden;
  106. }
  107. .topics {
  108. overflow: hidden;
  109. text-overflow: ellipsis;
  110. white-space: nowrap;
  111. margin-top: 5px;
  112. height: 20px;
  113. .topic {
  114. color: rgba(16, 16, 16, 0.8);
  115. border-radius: 4px;
  116. font-size: 12px;
  117. background: rgba(232, 232, 232, 0.6);
  118. padding: 2px 6px;
  119. margin-right: 8px;
  120. }
  121. }
  122. .footer {
  123. margin-top: 12px;
  124. display: flex;
  125. align-items: center;
  126. justify-content: space-between;
  127. height: 20px;
  128. .contractor {
  129. font-size: 14px;
  130. font-weight: 400;
  131. color: rgba(0, 40, 192, 0.73);
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. white-space: nowrap;
  135. }
  136. .update-time {
  137. text-align: right;
  138. min-width: 140px;
  139. font-size: 12px;
  140. font-weight: 300;
  141. color: rgb(136, 136, 136);
  142. }
  143. }
  144. </style>