my-userlist.vue 3.3 KB

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