match_card.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <script setup>
  2. import { Tooltip } from 'ant-design-vue';
  3. const parseEventKey = (key) => {
  4. if (key == 'm') {
  5. return '独赢';
  6. }
  7. else if (key?.startsWith('wm')) {
  8. const ratio = key.split('_')[1];
  9. return `净胜 ${ratio}`;
  10. }
  11. else if (key?.startsWith('ou')) {
  12. const ratio = key.split('_')[1];
  13. return `大/小 ${ratio}`;
  14. }
  15. else if (key?.startsWith('ot')) {
  16. const ratio = key.split('_')[1];
  17. return `进球数 ${ratio}`;
  18. }
  19. return key;
  20. }
  21. defineProps({
  22. eventId: {
  23. type: Number,
  24. required: true
  25. },
  26. teamHomeName: {
  27. type: String,
  28. required: true
  29. },
  30. teamAwayName: {
  31. type: String,
  32. required: true
  33. },
  34. events: {
  35. type: Array,
  36. required: true
  37. },
  38. // matchNumStr: {
  39. // type: String,
  40. // required: false
  41. // },
  42. selected: {
  43. type: Array,
  44. required: false
  45. },
  46. iorGroups: {
  47. type: Array,
  48. required: false
  49. },
  50. })
  51. </script>
  52. <template>
  53. <div class="match-card">
  54. <template v-if="eventId">
  55. <div class="team-name">
  56. <span class="home-name">{{ teamHomeName }}</span>
  57. <em>VS</em>
  58. <span class="away-name">{{ teamAwayName }}</span>
  59. </div>
  60. <div class="events-list" v-if="events.length">
  61. <table>
  62. <tr v-for="item in events">
  63. <th>{{ parseEventKey(item[0]) }}</th>
  64. <td>
  65. <span class="value-box" :class="{
  66. 'selected': selected.includes(item[1]?.key),
  67. 'highlight': iorGroups?.includes(item[1]?.key),
  68. 'strikethrough': item[1]?.qualified === 0,
  69. 'subsidy': item[1]?.source && !item[1]?.returnRate,
  70. 'adjusted': item[1]?.returnRate
  71. }">
  72. <Tooltip>
  73. <template #title v-if="item[1]?.source">
  74. {{ item[1].source }} <span v-if="item[1]?.returnRate">({{ item[1].returnRate }}%)</span>
  75. </template>
  76. {{ item[1]?.value ? item[1].value : '-' }}
  77. </Tooltip>
  78. </span>
  79. <em class="origin-box" v-if="item[1]?.origin">{{ item[1].origin }}</em>
  80. </td>
  81. <td>
  82. <span class="value-box" :class="{
  83. 'selected': selected.includes(item[2]?.key),
  84. 'highlight': iorGroups?.includes(item[2]?.key),
  85. 'strikethrough': item[2]?.qualified === 0,
  86. 'subsidy': item[2]?.source && !item[2]?.returnRate,
  87. 'adjusted': item[2]?.returnRate
  88. }">
  89. <Tooltip>
  90. <template #title v-if="item[2]?.source">
  91. {{ item[2].source }} <span v-if="item[2]?.returnRate">({{ item[2].returnRate }}%)</span>
  92. </template>
  93. {{ item[2]?.value ? item[2].value : '-' }}
  94. </Tooltip>
  95. </span>
  96. <em class="origin-box" v-if="item[2]?.origin">{{ item[2].origin }}</em>
  97. </td>
  98. <td>
  99. <span class="value-box" :class="{
  100. 'selected': selected.includes(item[3]?.key),
  101. 'highlight': iorGroups?.includes(item[3]?.key),
  102. 'strikethrough': item[3]?.qualified === 0,
  103. 'subsidy': item[3]?.source && !item[3]?.returnRate,
  104. 'adjusted': item[3]?.returnRate
  105. }">
  106. <Tooltip>
  107. <template #title v-if="item[3]?.source">
  108. {{ item[3].source }} <span v-if="item[3]?.returnRate">({{ item[3].returnRate }}%)</span>
  109. </template>
  110. {{ item[3]?.value ? item[3].value : '-' }}
  111. </Tooltip>
  112. </span>
  113. <em class="origin-box" v-if="item[3]?.origin">{{ item[3].origin }}</em>
  114. </td>
  115. </tr>
  116. </table>
  117. </div>
  118. <div class="events-empty" v-else>无盘口数据</div>
  119. </template>
  120. <div class="events-empty" v-else>无关联比赛</div>
  121. </div>
  122. </template>
  123. <style lang="scss" scoped>
  124. .match-card {
  125. display: flex;
  126. flex-direction: column;
  127. padding: 20px;
  128. }
  129. .team-name {
  130. display: flex;
  131. align-items: center;
  132. font-size: 14px;
  133. .disabled & {
  134. display: none;
  135. }
  136. span, em {
  137. display: block;
  138. }
  139. span {
  140. flex: 1;
  141. white-space: nowrap;
  142. overflow: hidden;
  143. text-overflow: ellipsis;
  144. &:first-child {
  145. text-align: left;
  146. }
  147. &:last-child {
  148. text-align: right;
  149. }
  150. }
  151. em {
  152. margin: 0 10px;
  153. font-style: normal;
  154. color: #ff9d4a;
  155. }
  156. .home-name {
  157. color: hsl(var(--primary));
  158. }
  159. .away-name {
  160. color: hsl(var(--destructive));
  161. }
  162. }
  163. .events-list {
  164. margin-top: 10px;
  165. .disabled & {
  166. display: none;
  167. }
  168. table {
  169. width: 100%;
  170. border-collapse: collapse;
  171. border-spacing: 0;
  172. table-layout: fixed;
  173. th, td {
  174. padding: 5px;
  175. border: 1px solid hsl(var(--border));
  176. text-align: center;
  177. }
  178. th {
  179. width: 80px;
  180. font-weight: normal;
  181. }
  182. td {
  183. width: calc((100% - 64px) / 2);
  184. font-size: 0;
  185. }
  186. .value-box {
  187. display: inline-block;
  188. height: 20px;
  189. padding: 0 5px;
  190. line-height: 20px;
  191. vertical-align: middle;
  192. font-size: 14px;
  193. border-radius: 4px;
  194. &.highlight {
  195. background-color: hsl(var(--primary) / 0.15);
  196. color: hsl(var(--primary));
  197. }
  198. &.selected {
  199. background-color: hsl(var(--primary));
  200. color: hsl(var(--primary-foreground));
  201. }
  202. &.strikethrough {
  203. text-decoration: line-through;
  204. color: hsl(var(--foreground) / 0.35);
  205. }
  206. &.subsidy {
  207. color: #c16d00;
  208. &.highlight {
  209. background-color: #ffe2bc;
  210. }
  211. &.selected {
  212. color: #fff;
  213. background-color: #c16d00;
  214. }
  215. }
  216. &.adjusted {
  217. color: #039f00;
  218. &.highlight {
  219. background-color: #e2fce1;
  220. }
  221. &.selected {
  222. color: #fff;
  223. background-color: #039f00;
  224. }
  225. }
  226. }
  227. .origin-box {
  228. display: block;
  229. height: 18px;
  230. margin-top: -3px;
  231. line-height: 18px;
  232. font-style: normal;
  233. font-size: 12px;
  234. color: hsl(var(--foreground) / 0.5);
  235. }
  236. }
  237. }
  238. .events-empty {
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. height: 34px;
  243. margin-top: 10px;
  244. font-size: 14px;
  245. border: 1px solid hsl(var(--border));
  246. }
  247. </style>