rankList.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. mapState,
  25. mapGetters
  26. } from 'vuex';
  27. import tools from '/utils/tools.js';
  28. import card from '/utils/card.js';
  29. // import { tplStyleList, userLevel, pubState } from '/utils/define.js';
  30. import {
  31. apiCompInfoDetail,
  32. apiCardRankDetailQuery,
  33. checkResCode
  34. } from '/utils/api.js';
  35. export default {
  36. data() {
  37. return {
  38. queryObj: {},
  39. queryString: "",
  40. compId: 0, // 赛事ID
  41. dispArrStr: "totalDistance,totalCp,totalSysPoint,fastPace", // 要显示的集合范围
  42. tabItems: ["总里程", "打点数", "百味豆", "配速"],
  43. rankTypeList: ["totalDistance", "totalCp", "totalSysPoint", "fastPace"],
  44. tabCurrent: 0,
  45. tabItemsMark: null,
  46. // tabItemsMark: [{
  47. // textColor: "#ff6203",
  48. // icon: "static/common/award.png"
  49. // }],
  50. rankRsList: ["totalDistanceRs", "totalCpRs", "totalSysPointRs", "fastPaceRs"],
  51. rankList: {}, // 排名列表
  52. actRs: card.actRs,
  53. /* actRs: {
  54. otherInfo: {
  55. compIdd: 1,
  56. pubState: "内测",
  57. playNum: 26,
  58. signupState: false,
  59. createTime: 1735530373
  60. },
  61. config: {
  62. "tplInfo": {
  63. "styleId": 0,
  64. "matchLogo": "/static/run.png",
  65. "matchBanner": "static/banner/banner1.png",
  66. },
  67. "matchInfo": {
  68. "compName": "小飞龙系列定向赛",
  69. "description": " · 小飞龙定向赛再次来袭!这次有五个场地哟~<br> · 小飞龙定向赛再次来袭!这次有五个场地哟~<br> · 小飞龙定向赛再次来袭!这次有五个场地哟~<br> · 小飞龙定向赛再次来袭!这次有五个场地哟~<br> · 神秘“蛋叔”闪亮登场~<br> · 蛋叔放大招,百味豆换鸡蛋!<br> · 时不可待!冲鸭!<br><br> · 能不能把蛋叔整郁闷,就看你的啦~<br> · 还等啥?火速报名吧!",
  70. "rules": "<li>随时参赛、不限完赛次数、起点任选、实时排名 <li>起点 -各途经点 -结束点完整打卡为一次有效完赛",
  71. "maxNum": 20,
  72. "contactName": "王老师",
  73. "phone": "13335116666",
  74. "regBeginSecond": 1735530373,
  75. "regEndSecond": 1735950373,
  76. "compBeginSecond": 1736050373,
  77. "compEndSecond": 1736950373,
  78. }
  79. }
  80. } */
  81. }
  82. },
  83. computed: {
  84. ...mapState([
  85. 'username', // 映射 this.username 为 store.state.username
  86. 'userlevel',
  87. 'token'
  88. ]),
  89. ...mapGetters([
  90. 'metadata'
  91. ]),
  92. },
  93. onLoad(query) {
  94. // console.log(query);
  95. this.queryObj = query;
  96. this.queryString = tools.objectToQueryString(this.queryObj);
  97. // console.log(queryString);
  98. this.compId = query["compId"] ?? 0;
  99. this.compInfoDetail();
  100. this.cardRankDetailQuery();
  101. },
  102. methods: {
  103. getBannerStyle() {
  104. return card.getBannerStyle(this.actRs);
  105. },
  106. getActtime() {
  107. return tools.fmtMcTime3(this.actRs.config.matchInfo.compBeginSecond, this.actRs.config.matchInfo.compEndSecond);
  108. },
  109. // 自助赛事详情查询
  110. compInfoDetail() {
  111. uni.request({
  112. url: apiCompInfoDetail,
  113. header: this.metadata,
  114. method: "POST",
  115. data: {
  116. compId: this.compId,
  117. },
  118. success: (res) => {
  119. // console.log("compInfoDetail", res);
  120. if (checkResCode(res)) {
  121. const data = res.data.data;
  122. this.actRs = data;
  123. }
  124. },
  125. fail: (err) => {
  126. console.log("compInfoDetail err", err);
  127. },
  128. });
  129. },
  130. // 排名查询
  131. cardRankDetailQuery() {
  132. uni.request({
  133. url: apiCardRankDetailQuery,
  134. header: this.metadata,
  135. method: "POST",
  136. data: {
  137. compId: this.compId,
  138. dispArrStr: this.dispArrStr
  139. },
  140. success: (res) => {
  141. // console.log("cardRankDetailQuery", res);
  142. if (checkResCode(res)) {
  143. const data = res.data.data;
  144. this.rankList = data;
  145. }
  146. },
  147. fail: (err) => {
  148. console.log("cardRankDetailQuery err", err);
  149. },
  150. });
  151. },
  152. btnBack() {
  153. const url = "/pages/actManage/actDetail?" + this.queryString;
  154. tools.appAction(url, "uni.navigateTo");
  155. },
  156. btnRankList() {
  157. // this.queryObj.actId = data.actId;
  158. // this.queryString = tools.objectToQueryString(this.queryObj);
  159. const url = '/pages/actManage/rankList?' + this.queryString;
  160. tools.appAction(url, "uni.navigateTo");
  161. },
  162. onTabClick(val) {
  163. // console.log("onTabClick: ", val);
  164. this.tabCurrent = val;
  165. }
  166. }
  167. }
  168. </script>
  169. <style scoped>
  170. .top {
  171. height: 170px;
  172. padding-top: 16px;
  173. flex-shrink: 0;
  174. background-repeat: no-repeat;
  175. background-size: cover;
  176. }
  177. .main {
  178. }
  179. .tab-view {
  180. width: 100%;
  181. flex-grow: 1;
  182. }
  183. /* ::v-deep .tab-active{
  184. background-color: #a43a07 !important;
  185. } */
  186. </style>