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.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div class="item">
  3. <div class="title-c">
  4. <div class="avatar-c">
  5. <img v-if="data.RelAvatarLink" class="avatar" :src="data.RelAvatarLink" />
  6. <img v-else class="avatar" :avatar="data.OwnerName" />
  7. </div>
  8. <div class="title">
  9. <span>{{ data.Alias }}</span>
  10. </div>
  11. </div>
  12. <div class="descr">
  13. {{ data.Description }}
  14. </div>
  15. <div class="topics">
  16. <a v-for="(item, index) in data.Topics" :key="index" class="topic"
  17. :href="`/explore/repos?q=&topic=${item.topic}&sort=hot`">{{ item }}</a>
  18. </div>
  19. <div class="footer">
  20. <div class="contractor">鹏城实验室</div>
  21. <div class="update-time">
  22. <span>{{ $t('repos.updated') }}</span>
  23. <el-tooltip effect="dark" :content="dateFormat(data.UpdatedUnix)" placement="top-start">
  24. <span>{{ calcFromNow(data.UpdatedUnix) }}</span>
  25. </el-tooltip>
  26. </div>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. import dayjs from 'dayjs';
  32. import { lang } from '~/langs';
  33. import { timeSinceUnix } from '~/utils';
  34. export default {
  35. name: "PrjResultsItem",
  36. props: {
  37. data: { type: Object, default: () => ({}) },
  38. },
  39. components: {},
  40. data() {
  41. return {
  42. };
  43. },
  44. methods: {
  45. calcFromNow(unix) {
  46. return timeSinceUnix(unix, Date.now() / 1000);
  47. },
  48. dateFormat(unix) {
  49. return lang == 'zh-CN' ? dayjs(unix * 1000).format('YYYY年MM月DD日 HH时mm分ss秒') :
  50. dayjs(unix * 1000).format('ddd, D MMM YYYY HH:mm:ss [CST]');
  51. }
  52. },
  53. mounted() { },
  54. };
  55. </script>
  56. <style scoped lang="less">
  57. .item {
  58. border-color: rgb(232, 224, 236);
  59. border-width: 1px;
  60. border-style: solid;
  61. box-shadow: rgba(168, 157, 226, 0.2) 0px 5px 10px 0px;
  62. 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");
  63. overflow: hidden;
  64. padding: 15px;
  65. }
  66. .title-c {
  67. display: flex;
  68. align-items: center;
  69. .avatar-c {
  70. height: 28px;
  71. width: 28px;
  72. margin-right: 6px;
  73. img {
  74. border-radius: 100%;
  75. height: 100%;
  76. width: 100%;
  77. }
  78. }
  79. .title {
  80. flex: 1;
  81. overflow: hidden;
  82. text-overflow: ellipsis;
  83. white-space: nowrap;
  84. span {
  85. color: rgb(16, 16, 16);
  86. font-size: 16px;
  87. font-weight: 400;
  88. }
  89. }
  90. }
  91. .descr {
  92. height: 40px;
  93. margin-top: 8px;
  94. font-size: 12px;
  95. font-weight: 300;
  96. color: rgb(136, 136, 136);
  97. text-overflow: ellipsis;
  98. word-break: break-all;
  99. display: -webkit-box;
  100. -webkit-box-orient: vertical;
  101. -webkit-line-clamp: 2;
  102. max-height: 41px;
  103. overflow: hidden;
  104. }
  105. .topics {
  106. overflow: hidden;
  107. text-overflow: ellipsis;
  108. white-space: nowrap;
  109. margin-top: 5px;
  110. height: 20px;
  111. .topic {
  112. color: rgba(16, 16, 16, 0.8);
  113. border-radius: 4px;
  114. font-size: 12px;
  115. background: rgba(232, 232, 232, 0.6);
  116. padding: 2px 6px;
  117. margin-right: 8px;
  118. }
  119. }
  120. .footer {
  121. margin-top: 12px;
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. height: 20px;
  126. .contractor {
  127. font-size: 14px;
  128. font-weight: 400;
  129. color: rgba(0, 40, 192, 0.73);
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. white-space: nowrap;
  133. }
  134. .update-time {
  135. text-align: right;
  136. min-width: 140px;
  137. font-size: 12px;
  138. font-weight: 300;
  139. color: rgb(136, 136, 136);
  140. }
  141. }
  142. </style>