userList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="body">
  3. <view class="content uni-column">
  4. <view class="uni-column top" :style="getBannerStyle()">
  5. <my-topbar :title="actRs.config.matchInfo.compName" @btnBackClick="btnBack"></my-topbar>
  6. <view class="top-content uni-row">
  7. </view>
  8. </view>
  9. <view class="main uni-column">
  10. <!-- <my-tab ref="tab" :tabItems="tabItems" :tabItemsMark="tabItemsMark" :type="0"
  11. :initActIndex=0 @onTabClick="onTabClick" :fontSize="12"></my-tab> -->
  12. <!-- <view class="tab-view uni-column">
  13. <template v-for="(item, index) in rankRsList" :key="index">
  14. <my-ranklist v-show="tabCurrent === index" :rankRs="rankList[item]"
  15. :rank-type="rankTypeList[index]"></my-ranklist>
  16. </template>
  17. </view> -->
  18. <my-userlist :userRs="userList" :admin="userlevel > 0"></my-userlist>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. mapState,
  26. mapGetters
  27. } from 'vuex';
  28. import tools from '/utils/tools.js';
  29. import card from '/utils/card.js';
  30. // import { tplStyleList, userLevel, pubState } from '/utils/define.js';
  31. import {
  32. apiCompInfoDetail,
  33. apiCardUserListQuery,
  34. checkResCode
  35. } from '/utils/api.js';
  36. export default {
  37. data() {
  38. return {
  39. queryObj: {},
  40. queryString: "",
  41. compId: 0, // 赛事ID
  42. // dispArrStr: "totalDistance,totalCp,totalSysPoint,fastPace", // 要显示的集合范围
  43. // tabItems: ["总里程", "打点数", "百味豆", "配速"],
  44. // rankTypeList: ["totalDistance", "totalCp", "totalSysPoint", "fastPace"],
  45. // tabCurrent: 0,
  46. // tabItemsMark: null,
  47. // tabItemsMark: [{
  48. // textColor: "#ff6203",
  49. // icon: "static/common/award.png"
  50. // }],
  51. // rankRsList: ["totalDistanceRs", "totalCpRs", "totalSysPointRs", "fastPaceRs"],
  52. userList: {}, // 玩家列表
  53. actRs: card.actRs,
  54. }
  55. },
  56. computed: {
  57. ...mapState([
  58. 'username', // 映射 this.username 为 store.state.username
  59. 'userlevel',
  60. 'token'
  61. ]),
  62. ...mapGetters([
  63. 'metadata'
  64. ]),
  65. },
  66. onLoad(query) {
  67. // console.log(query);
  68. this.queryObj = query;
  69. this.queryString = tools.objectToQueryString(this.queryObj);
  70. // console.log(queryString);
  71. this.compId = query["compId"] ?? 0;
  72. this.compInfoDetail();
  73. this.cardUserListQuery();
  74. },
  75. methods: {
  76. getBannerStyle() {
  77. return card.getBannerStyle(this.actRs);
  78. },
  79. getActtime() {
  80. return tools.fmtMcTime3(this.actRs.config.matchInfo.compBeginSecond, this.actRs.config.matchInfo.compEndSecond);
  81. },
  82. // 自助赛事详情查询
  83. compInfoDetail() {
  84. uni.request({
  85. url: apiCompInfoDetail,
  86. header: this.metadata,
  87. method: "POST",
  88. data: {
  89. compId: this.compId,
  90. },
  91. success: (res) => {
  92. // console.log("compInfoDetail", res);
  93. if (checkResCode(res)) {
  94. const data = res.data.data;
  95. this.actRs = data;
  96. }
  97. },
  98. fail: (err) => {
  99. console.log("compInfoDetail err", err);
  100. },
  101. });
  102. },
  103. // 自助赛用户列表查询
  104. cardUserListQuery() {
  105. uni.request({
  106. url: apiCardUserListQuery,
  107. header: this.metadata,
  108. method: "POST",
  109. data: {
  110. compId: this.compId,
  111. // dispArrStr: this.dispArrStr
  112. },
  113. success: (res) => {
  114. console.log("cardUserListQuery", res);
  115. if (checkResCode(res)) {
  116. const data = res.data.data;
  117. this.userList = data;
  118. }
  119. },
  120. fail: (err) => {
  121. console.log("cardUserListQuery err", err);
  122. },
  123. });
  124. },
  125. btnBack() {
  126. const url = "/pages/actManage/actDetail?" + this.queryString;
  127. tools.appAction(url, "uni.navigateTo");
  128. },
  129. btnRankList() {
  130. // this.queryObj.actId = data.actId;
  131. // this.queryString = tools.objectToQueryString(this.queryObj);
  132. const url = '/pages/actManage/rankList?' + this.queryString;
  133. tools.appAction(url, "uni.navigateTo");
  134. },
  135. onTabClick(val) {
  136. // console.log("onTabClick: ", val);
  137. this.tabCurrent = val;
  138. }
  139. }
  140. }
  141. </script>
  142. <style scoped>
  143. .top {
  144. height: 170px;
  145. padding-top: 16px;
  146. flex-shrink: 0;
  147. background-repeat: no-repeat;
  148. background-size: cover;
  149. background-position: center;
  150. }
  151. .main {
  152. }
  153. .tab-view {
  154. width: 100%;
  155. flex-grow: 1;
  156. }
  157. /* ::v-deep .tab-active{
  158. background-color: #a43a07 !important;
  159. } */
  160. </style>