my-userlist.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <uni-list ref="list" class="list" :border="false">
  3. <view class="list-header uni-row">
  4. <text class="item-rankNum border-right">序号</text>
  5. <text class="item-box border-right" style="text-align: center;">玩家</text>
  6. <text class="item-phone">电话</text>
  7. </view>
  8. <uni-list-item v-for="(item,index) in userRs" :key="index" :border="false" class="list-item uni-row"
  9. :class="getListItemClass(item,index)">
  10. <template v-slot:body>
  11. <text class="item-rankNum">{{index+1}}</text>
  12. <view class="uni-row item-box">
  13. <text class="item-userName">{{item.name}}</text>
  14. <image class="item-inGame" v-if="item.isInGame == 1" mode="aspectFit"
  15. src="/static/common/ingame.gif"></image>
  16. <image class="item-finish" v-else-if="item.isFinishGame == 1" mode="aspectFit"
  17. src="/static/common/finishgame.png"></image>
  18. </view>
  19. <a class="item-phone" :href="'tel:' + item.phone" style='text-decoration: none;'>{{item.phone}}</a>
  20. </template>
  21. </uni-list-item>
  22. </uni-list>
  23. </template>
  24. <script>
  25. import tools from '/utils/tools.js';
  26. export default {
  27. name: "my-userlist",
  28. props: {
  29. userRs: {},
  30. },
  31. data() {
  32. return {};
  33. },
  34. mounted() {
  35. // console.log("userRs", this.userRs);
  36. },
  37. methods: {
  38. getListItemClass(item, index) {
  39. // console.log("item", item);
  40. if (item == undefined) {
  41. return "";
  42. }
  43. let classStr = "";
  44. if (item.isSelf) {
  45. classStr += " list-item-isself"
  46. }
  47. return classStr;
  48. },
  49. fmtTime(time) {
  50. if (time > 0)
  51. return tools.convertSecondsToHMS(time, 1);
  52. else
  53. return '--';
  54. },
  55. // 格式化 距离
  56. fmtDistanct(val) {
  57. return Math.round(val * 100 / 1000) / 100;
  58. // if (val < 1000)
  59. // return Math.round(val * 10 / 1000) / 10;
  60. // else
  61. // return Math.round(val / 1000);
  62. },
  63. // 格式化 配速
  64. fmtPace(val) {
  65. if (val > 0)
  66. return tools.convertSecondsToHMS(val, 2);
  67. else
  68. return '--';
  69. },
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .list {
  75. width: 90%;
  76. height: 43vh;
  77. flex-grow: 1;
  78. overflow: scroll;
  79. margin-top: 8px;
  80. margin-bottom: 8px;
  81. }
  82. .list-header {
  83. width: 100%;
  84. height: 28px;
  85. justify-content: space-between;
  86. font-size: 14px;
  87. line-height: 28px;
  88. color: #ffffff;
  89. background: #2e85ec;
  90. border-radius: 18px;
  91. }
  92. .border-right {
  93. border-right: #ffffff solid 1px;
  94. }
  95. .list-item {
  96. width: 100%;
  97. height: 35px;
  98. border-bottom: #ececea 1px solid;
  99. justify-content: space-between;
  100. font-size: 14px;
  101. }
  102. ::v-deep .uni-list-item__container {
  103. padding: 0 0px;
  104. }
  105. .list-item-isself {
  106. background-color: #ececea !important;
  107. border-radius: 6px;
  108. }
  109. .item-rankNum {
  110. width: 50px;
  111. margin-right: 5px;
  112. line-height: 35px;
  113. text-align: center;
  114. }
  115. .item-box {
  116. width: 60%;
  117. flex-grow: 1;
  118. }
  119. .item-userName {
  120. line-height: 35px;
  121. white-space: nowrap;
  122. overflow: hidden;
  123. text-overflow: ellipsis;
  124. }
  125. .item-inGame {
  126. width: 18px;
  127. height: 25px;
  128. margin-left: 3px;
  129. }
  130. .item-finish {
  131. width: 18px;
  132. height: 25px;
  133. margin-left: 3px;
  134. }
  135. .item-phone {
  136. width: 110px;
  137. line-height: 35px;
  138. text-align: center;
  139. // font-weight: 550;
  140. white-space: nowrap;
  141. }
  142. .nowrap {
  143. white-space: nowrap;
  144. overflow: hidden;
  145. text-overflow: ellipsis;
  146. }
  147. </style>