FloatSide.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="float-side-group">
  3. <div
  4. class="column-side"
  5. v-if="floatSide.showType"
  6. @click="toggleType(floatSide)"
  7. key="column"
  8. >
  9. <div :class="'type-icon--' + floatSide.colorClass">
  10. {{ floatSide.title.substr(0, 1) }}
  11. </div>
  12. <div class="type-title">{{ floatSide.title }}</div>
  13. <i class="el-icon-jy-caret-left"></i>
  14. </div>
  15. <div class="row-side" key="row" v-else>
  16. <div class="flex-r-c center sb top-group">
  17. <div
  18. class="flex-r-c center type-title"
  19. @click="floatSide.showType = true"
  20. >
  21. <div>{{ floatSide.title }}</div>
  22. <div class="flex-c-c center icon-caret-bottom">
  23. <i class="el-icon-jy-caret-bottom"></i>
  24. </div>
  25. </div>
  26. <div
  27. class="flex-r-c center more-text"
  28. v-if="floatSide.list && floatSide.list.length"
  29. @click="$emit('more', floatSide)"
  30. >
  31. <span>更多</span>
  32. <i class="el-icon-arrow-right"></i>
  33. </div>
  34. </div>
  35. <div class="content-group flex-c-c center">
  36. <div
  37. class="flex-w-100 info-card-group"
  38. v-if="floatSide.list && floatSide.list.length"
  39. >
  40. <div
  41. class="flex-c-c info-card-item"
  42. v-for="(item, index) in getList"
  43. :key="index"
  44. @click="$emit('info', item, floatSide)"
  45. >
  46. <div class="p-t-b-8 border-bottom-line flex-r-c center sb">
  47. <div class="flex-r-c center">
  48. <div :class="'type-icon--' + floatSide.colorClass">
  49. {{ item.index || floatSide.title.substr(0, 1) }}
  50. </div>
  51. <div class="text--title ellipsis">{{ item.title }}</div>
  52. <i class="icon-badge-red" v-if="!item.read"></i>
  53. </div>
  54. <div class="flex-r-c text--time">{{ item.date }}</div>
  55. </div>
  56. <div class="p-t-b-10 flex-r-c">
  57. <span class="text--time">{{ item.tip || '情报历史记录' }}</span>
  58. <div class="flex-r-c center">
  59. <span class="text--title">{{ item.total }}</span>
  60. <i class="el-icon-arrow-right"></i>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <span v-else class="empty-text">暂无{{ floatSide.title }}数据</span>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. export default {
  72. name: 'Home',
  73. components: {},
  74. props: {
  75. floatSide: {
  76. type: Object,
  77. required: true
  78. }
  79. },
  80. data() {
  81. return {}
  82. },
  83. methods: {
  84. toggleType(floatSide) {
  85. this.$emit('toggle', floatSide.showType)
  86. floatSide.showType = false
  87. }
  88. },
  89. computed: {
  90. getList() {
  91. return this.floatSide.list.slice(0, this.floatSide.maxLength)
  92. }
  93. },
  94. created() {}
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .float-side-group {
  99. .type-icon {
  100. width: 24px;
  101. height: 24px;
  102. line-height: 24px;
  103. text-align: center;
  104. border-radius: 50%;
  105. font-size: 13px;
  106. font-weight: 500;
  107. color: #ffffff;
  108. &--month {
  109. @extend .type-icon;
  110. background: #2abed1;
  111. }
  112. &--week {
  113. @extend .type-icon;
  114. background: #ff9f40;
  115. }
  116. &--ent {
  117. @extend .type-icon;
  118. background: #05a6f3;
  119. }
  120. }
  121. .column-side {
  122. width: 40px;
  123. display: flex;
  124. flex-direction: column;
  125. align-items: center;
  126. justify-content: center;
  127. background: #ffffff;
  128. border: 1px solid #ececec;
  129. border-radius: 5px;
  130. box-shadow: 0px 1px 8px 0px rgba(0, 0, 0, 0.08);
  131. padding: 12px 8px;
  132. box-sizing: border-box;
  133. cursor: pointer;
  134. .type-icon {
  135. & + * {
  136. margin-top: 8px;
  137. }
  138. }
  139. .type-title {
  140. width: 1em;
  141. color: #1d1d1d;
  142. font-size: 12px;
  143. font-weight: 400;
  144. line-height: 15px;
  145. & + * {
  146. margin-top: 4px;
  147. }
  148. }
  149. ::v-deep i.el-icon-caret-left {
  150. color: #9e9ea3;
  151. }
  152. }
  153. @include diy-icon('caret-left', 10, 10);
  154. @include diy-icon('caret-bottom', 6, 6);
  155. .row-side {
  156. border-radius: 4px;
  157. box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.06);
  158. box-sizing: border-box;
  159. overflow: hidden;
  160. background-color: #fff;
  161. .icon-caret-bottom {
  162. width: 12px;
  163. height: 12px;
  164. background: #b4b4bf;
  165. border-radius: 50%;
  166. margin-left: 8px;
  167. ::before {
  168. content: '' !important;
  169. }
  170. }
  171. .top-group {
  172. min-width: 280px;
  173. background: #f2f2f4;
  174. padding: 12px;
  175. padding-right: 8px;
  176. box-sizing: border-box;
  177. color: #1d1d1d;
  178. font-weight: 400;
  179. .type-title {
  180. font-size: 16px;
  181. line-height: 24px;
  182. cursor: pointer;
  183. }
  184. .more-text {
  185. font-size: 13px;
  186. line-height: 20px;
  187. cursor: pointer;
  188. }
  189. }
  190. .content-group {
  191. .empty-text {
  192. font-size: 14px;
  193. font-weight: 400;
  194. color: #999999;
  195. line-height: 118px;
  196. }
  197. }
  198. .icon-badge-red {
  199. display: inline-block;
  200. width: 8px;
  201. height: 8px;
  202. background: #fb483d;
  203. border: 1px solid #ffffff;
  204. border-radius: 50%;
  205. margin-left: 4px;
  206. ::before {
  207. content: '' !important;
  208. }
  209. }
  210. .color {
  211. &--gray {
  212. color: #c0c4cc;
  213. }
  214. }
  215. .text {
  216. &--title {
  217. font-size: 13px;
  218. font-weight: 400;
  219. color: #1d1d1d;
  220. line-height: 20px;
  221. }
  222. &--time {
  223. font-size: 12px;
  224. font-weight: 400;
  225. color: #999999;
  226. line-height: 20px;
  227. }
  228. }
  229. .p-t-b-8 {
  230. padding-top: 8px;
  231. padding-bottom: 8px;
  232. }
  233. .p-t-b-10 {
  234. padding-top: 10px;
  235. padding-bottom: 10px;
  236. }
  237. .border-bottom-line {
  238. border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  239. }
  240. .info-card-group {
  241. background: #f2f2f4;
  242. cursor: pointer;
  243. }
  244. .info-card-item {
  245. background-color: #fff;
  246. width: 100%;
  247. padding: 0 12px;
  248. box-sizing: border-box;
  249. & + .info-card-item {
  250. margin-top: 4px;
  251. }
  252. .el-icon-arrow-right {
  253. margin-left: 12px;
  254. font-size: 13px;
  255. color: #c0c4cc;
  256. }
  257. .text--title {
  258. margin-left: 8px;
  259. max-width: 127px;
  260. }
  261. }
  262. }
  263. }
  264. </style>