rankList.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. <!--
  2. [模板] 样式2 - 排名列表
  3. http://localhost:5173/card/#/pages/tpl/style3/rankList
  4. https://oss-mbh5.colormaprun.com/card/#/pages/tpl/style3/rankList
  5. -->
  6. <template>
  7. <view class="body">
  8. <view v-if="pageReady" class="content uni-column">
  9. <view class="uni-column page-top">
  10. <my-topbar :mcName="mcName" class="topbar-color" :showMessage="cardConfigData.popupMessageList.length > 0"
  11. @btnBackClick="btnBack" @btnInfoClick="btnInfo" @btnMessageClick="btnMessage"></my-topbar>
  12. <view class="topcontent uni-column uni-jcsa">
  13. <view class="tcview uni-row uni-jcsb">
  14. <view class="tcbox uni-column uni-jcc">
  15. <text class="tcbox-label">赛事总里程</text>
  16. <text class="tcbox-value">{{fmtDistanct(all_totalDistance)}} 千米</text>
  17. </view>
  18. <view class="tcbox uni-column uni-jcc">
  19. <text class="tcbox-label">{{configParam.labelRightAnswerNum}}</text>
  20. <text class="tcbox-value">{{all_totalAnswerNum}} 次</text>
  21. </view>
  22. </view>
  23. <text class="today" :data-content="today">{{today}}</text>
  24. </view>
  25. <view class="topcontent2 uni-column uni-jcsa">
  26. <view class="logo"></view>
  27. <text v-if="configParam.subTitle && configParam.subTitle.length > 0" class="top-acttime">{{configParam.subTitle}}</text>
  28. </view>
  29. <!-- <view class="topcontent uni-column uni-jcsa">
  30. <view class="logo"></view>
  31. <view class="tcbar uni-row uni-jcsb">
  32. <text class="tcbar-text">赛事总里程:{{fmtDistanct(all_totalDistance)}} 千米</text>
  33. <text class="tcbar-text">{{configParam.labelRightAnswerNum}}:{{all_totalAnswerNum}} 次</text>
  34. </view>
  35. </view> -->
  36. <view class="topbtm uni-row">
  37. <view class="topbtm-egg" @click="btnMyEgg">{{configParam.labelTicketName}}</view>
  38. <text class="topbtm-name">{{nickName}}</text>
  39. <view class="topbtm-egg" v-if="configParam.labelGoodsList && configParam.labelGoodsList.length > 0" @click="btnGoodsList">{{configParam.labelGoodsList}}</view>
  40. <view class="topbtm-egg" v-else @click="btnExchg">{{configParam.labelAwardAddress}}</view>
  41. </view>
  42. </view>
  43. <view class="main uni-column">
  44. <view class="main-bar uni-row uni-jcse">
  45. <text>题目输出:{{all_totalAnswerNum}}</text>
  46. <text>总里程:{{fmtDistanct(all_totalDistance)}}km</text>
  47. <text>总打点:{{all_totalCp}}</text>
  48. <text>总百味豆:{{all_totalSysPoint}}</text>
  49. </view>
  50. <my-tab ref="tab1" :tabItems="tab1Items" :type="1" @onTabClick="onTab1Click"
  51. :initActIndex=configParam.tab1InitActIndex @onSelectChange="onSelectChange" :fontSize="14"></my-tab>
  52. <my-tab ref="tab2" :tabItems="tab2Items" :tabItemsMark="tab2ItemsMark" :type="0"
  53. :initActIndex=configParam.tab2InitActIndex @onTabClick="onTab2Click" :fontSize="12"></my-tab>
  54. <view class="tab-view uni-column">
  55. <!-- 团体成绩列表 -->
  56. <template v-if="tab1Current==0" v-for="(item, index) in rank1List" :key="index">
  57. <my-ranklist v-show="tab2Current === index" :rankRs="rankList[item]"
  58. :rank-type="rankTypeList[index]"></my-ranklist>
  59. </template>
  60. <!-- 个人成绩区域排名列表 -->
  61. <template v-if="tab1Current==1" v-for="(item, index) in rank2List" :key="index">
  62. <my-ranklist v-show="tab2Current === index" :rankRs="rankList[item]"
  63. :rank-type="rankTypeList[index]"></my-ranklist>
  64. </template>
  65. </view>
  66. <button class="btnBack bgcolor-main" @click="btnStartGame">{{btnStartGameText}}</button>
  67. </view>
  68. <my-popup ref="mypopup" :config="cardConfigData.popupRuleConfig" :dataList="cardConfigData.popupRuleList" :acttime="acttime"></my-popup>
  69. <my-popup ref="mypopupExchg" :config="cardConfigData.popupExchgConfig" :dataList="cardConfigData.popupExchgList"></my-popup>
  70. <my-popup ref="mypopupMessage" :config="cardConfigData.popupMessageConfig" :dataList="cardConfigData.popupMessageList" @noMoreRemindersClick="onNoMoreRemindersClick"></my-popup>
  71. <my-popup ref="mypopupWarn" :config="cardConfigData.popupWarnConfig" :dataList="cardConfigData.popupWarnList"></my-popup>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import tools from '/common/tools';
  77. import cardfunc from '../../../common/cardfunc';
  78. import { localCardConfig } from "./cardconfig/test.js";
  79. import { teamName } from '/common/define';
  80. import {
  81. token,
  82. apiMatchRsDetailQuery,
  83. apiCardRankDetailQuery,
  84. apiUserCurrentRankNumQuery,
  85. apiIsAllowMcSignUp,
  86. apiUserJoinCardQuery,
  87. apiMapListQuery,
  88. apiCompStatisticQuery,
  89. checkResCode
  90. } from '/common/api';
  91. export default {
  92. data() {
  93. return {
  94. cardConfigData: cardfunc.cardConfigData,
  95. pageReady: false,
  96. pageName: "rankList",
  97. firstEnterKey: 'firstEnter-tpl-style3',
  98. rankKey: "rank-tpl-style3",
  99. mapKey: "rank-tpl-style3-map",
  100. messageKey: "message-tpl-style3",
  101. queryObj: {},
  102. queryString: "",
  103. token: "",
  104. ovtype: "",
  105. ecId: 0, // 卡片id
  106. mcId: 0, // 赛事id
  107. mcType: 0, // 赛事类型 1 普通活动 2 线下赛 3 线上赛
  108. mcName: "", // 赛事名称
  109. acttime: "", // 活动时间
  110. beginSecond: null, // 活动或赛事开始时间戳,单位秒
  111. endSecond: null, // 活动或赛事结束时间戳,单位秒
  112. ocaId: 0, // 关联id,带入到App活动详情页面
  113. nickName: "", // 昵称
  114. isJoin: null, // 是否报名
  115. btnStartGameText: "",
  116. today: "",
  117. mapList: [], // 卡片对应地图列表详情
  118. all_totalDistance: 0, // 赛事所有人累计里程,单位米
  119. all_totalRightAnswerNum: 0, // 赛事所有人正确答题数(校园文化输出)
  120. all_totalAnswerNum: 0, // 赛事所有人答题数(校园文化输出)
  121. all_totalCp: 0, // 赛事中所有人打点数
  122. all_totalSysPoint: 0, // 赛事中所有人百味豆
  123. mcState: 0, // 赛事/活动状态 0: 未开始 1: 进行中 2: 已结束
  124. allowMcSignUp: false, // 是否允许重新分组
  125. countdown: "", // 倒计时
  126. rankList: { // 排名列表
  127. // totalDistanceRs: [],
  128. // totalCpRs: [],
  129. // totalSysPointRs: [],
  130. // fastPaceRs: []
  131. },
  132. interval: null,
  133. teamType: 0, // 队伍类型
  134. // dispArrStr: "totalDistance,totalCp,totalSysPoint,fastPace",
  135. dispArrStr: "teamCp,teamTodayCp,teamDistance,teamRightAnswerPer,teamTodayPace,regionCp,regionTodayCp,regionDistance,regionRightAnswerPer,regionTodayPace", // 要显示的集合范围
  136. tab1Current: 0,
  137. tab2Current: 0,
  138. tab1Items: ["团体"],
  139. // tab1Items: ["团体", {
  140. // selectValue: 1,
  141. // data: [
  142. // {text: "个人(中心校区)", value: 1},
  143. // {text: "个人(千佛山校区南区)", value: 2},
  144. // {text: "个人(兴隆校区)", value: 3}
  145. // ]}
  146. // ],
  147. tab2Items: [],
  148. tab2Items_team: ["总积分", "今日积分", "总里程", "校园文化", "今日配速"],
  149. tab2Items_person_region: ["总积分", "今日积分", "总里程", "校园文化", "今日配速"],
  150. tab2ItemsMark: [{
  151. textColor: "#ff6203",
  152. icon: "static/common/award.png"
  153. }],
  154. tabActiveColor: "#81cd00",
  155. rankTypeList: [],
  156. // 团队成绩类型列表
  157. rankTypeList_team: ["totalScore", "totalScore", "totalDistance", "rightAnswerPer", "fastPace"],
  158. // 个人成绩类型列表
  159. rankTypeList_person_region: ["totalScore", "totalScore", "totalDistance", "rightAnswerPer", "fastPace"],
  160. // 团体成绩列表
  161. rank1List: ["teamCpRs", "teamTodayCpRs", "teamDistanceRs", "teamRightAnswerPerRs", "teamTodayPaceRs"],
  162. // 个人成绩列表
  163. rank2List: ["regionCpRs", "regionTodayCpRs", "regionDistanceRs", "regionRightAnswerPerRs", "regionTodayPaceRs"],
  164. configParam: {
  165. subTitle: "",
  166. labelRightAnswerNum: "文化输出",
  167. labelTicketName: "我的奖券",
  168. labelAwardAddress: "兑奖地址",
  169. // labelGoodsList: "兑换商品",
  170. tab1InitActIndex: 0,
  171. tab2InitActIndex: 0
  172. },
  173. // selectedMapId: 0, // 用户选择的地图ID
  174. }
  175. },
  176. computed: {},
  177. onLoad(query) { // 类型非必填,可自动推导
  178. // console.log(query);
  179. this.queryObj = query;
  180. this.queryString = tools.objectToQueryString(this.queryObj);
  181. // console.log(queryString);
  182. this.token = query["token"] ?? token;
  183. this.ecId = query["id"] ?? 0;
  184. this.ovtype = query["ovtype"] ?? "";
  185. this.firstEnterKey += "-" + this.ecId;
  186. console.log("firstEnterKey:", this.firstEnterKey);
  187. this.rankKey += "-" + this.ecId;
  188. console.log("rankKey:", this.rankKey);
  189. this.mapKey += "-" + this.ecId;
  190. console.log("mapKey:", this.mapKey);
  191. this.messageKey += "-" + this.ecId;
  192. console.log("messageKey:", this.messageKey);
  193. this.today = tools.timestampToTime(null, 2);
  194. const mapValue = uni.getStorageSync(this.mapKey);
  195. if (mapValue) {
  196. console.log("mapValue:", mapValue);
  197. // this.selectedMapId = mapValue;
  198. this.ocaId = mapValue;
  199. }
  200. cardfunc.init(this, this.token, this.ecId);
  201. cardfunc.getCardConfig(this.cardConfigQueryCallback, localCardConfig);
  202. },
  203. // 页面初次渲染完成,此时组件已挂载完成,DOM 树($el)已可用
  204. onReady() {
  205. // this.dealFirstEnter();
  206. // this.tab2Items = this.tab2Items_team;
  207. },
  208. onShow() {
  209. this.getUserJoinCardQuery();
  210. },
  211. onUnload() {
  212. this.clear();
  213. },
  214. methods: {
  215. initTab() {
  216. if (this.tab1Current == 0) {
  217. this.rankTypeList = this.rankTypeList_team;
  218. this.tab2Items = this.tab2Items_team;
  219. } else {
  220. this.rankTypeList = this.rankTypeList_person_region;
  221. this.tab2Items = this.tab2Items_person_region;
  222. }
  223. },
  224. dealNotice(rank) {
  225. // console.log('[dealFirstEnter]');
  226. let that = this;
  227. uni.getStorage({
  228. key: that.rankKey,
  229. success: (res) => {
  230. // console.log('[getStorage]', that.rankKey, res.data);
  231. const oldRank = res.data;
  232. if (oldRank != rank) {
  233. // that.notice = true;
  234. that.setRankValue(rank);
  235. }
  236. },
  237. fail: (e) => {
  238. console.log('[getStorage] fail', that.rankKey, e);
  239. // that.notice = false;
  240. that.setRankValue(rank);
  241. },
  242. })
  243. },
  244. setRankValue(data) {
  245. let that = this;
  246. uni.setStorage({
  247. key: that.rankKey,
  248. data: data,
  249. success: () => {
  250. console.log('[setStorage] success', that.rankKey, data);
  251. },
  252. fail: (e) => {
  253. console.log('[setStorage] fail', that.rankKey, e);
  254. },
  255. })
  256. },
  257. dealFirstEnter() {
  258. // console.log('[dealFirstEnter]');
  259. let that = this;
  260. uni.getStorage({
  261. key: that.firstEnterKey,
  262. success: (res) => {
  263. console.log('[getStorage]', that.firstEnterKey, res.data);
  264. },
  265. fail: (e) => {
  266. console.log('[getStorage] fail', that.firstEnterKey, e);
  267. that.btnInfo();
  268. that.setFirstEnterValue(true);
  269. },
  270. })
  271. },
  272. setFirstEnterValue(data) {
  273. let that = this;
  274. uni.setStorage({
  275. key: that.firstEnterKey,
  276. data: data,
  277. success: () => {
  278. console.log('[setStorage] success', that.firstEnterKey, data);
  279. },
  280. fail: (e) => {
  281. console.log('[setStorage] fail', that.firstEnterKey, e);
  282. },
  283. })
  284. },
  285. clear() {
  286. if (this.interval != null) {
  287. clearInterval(this.interval);
  288. this.interval = null;
  289. }
  290. },
  291. cardConfigQueryCallback(cardconfig) {
  292. this.loadConfig(cardconfig);
  293. cardfunc.unReadMessageQuery(this.unReadMessageQueryCallback);
  294. cardfunc.warnMessageQuery(this.warnMessageQueryCallback);
  295. this.matchRsDetailQuery();
  296. setTimeout(this.dealFirstEnter, 500);
  297. },
  298. unReadMessageQueryCallback(unReadMessage, mqIdListStr) {
  299. // console.log("[unReadMessageQueryCallback] unReadMessage", unReadMessage);
  300. if (unReadMessage.length > 0) {
  301. this.messageKey += mqIdListStr;
  302. // console.log("[unReadMessageQueryCallback] messageKey:", this.messageKey);
  303. const messageValue = uni.getStorageSync(this.messageKey);
  304. // console.log("[unReadMessageQueryCallback] messageValue:", messageValue);
  305. if (!messageValue) {
  306. this.$refs.mypopupMessage.popupOpen();
  307. // uni.setStorageSync(this.messageKey, true);
  308. }
  309. }
  310. },
  311. warnMessageQueryCallback(warnMessage) {
  312. // console.log("[warnMessageQueryCallback] warnMessage", warnMessage);
  313. if (warnMessage.length > 0) {
  314. this.$refs.mypopupWarn.popupOpen();
  315. }
  316. },
  317. loadConfig(cardconfig) {
  318. cardconfig = cardfunc.parseCardConfig(cardconfig);
  319. // console.log("[loadCardConfig] cardconfig:", cardconfig);
  320. // 加载卡片通用配置
  321. if (cardconfig.common != undefined) {
  322. cardfunc.loadCardCommonConfig(cardconfig.common);
  323. }
  324. // -------- 加载当前页面的配置 --------
  325. const config = cardfunc.parseCardConfig(cardconfig[this.pageName]);
  326. // console.log("[loadConfig] config_page:", config); if (config == undefined || config == null) {
  327. this.pageReady = true; return; }
  328. // 加载CSS样式
  329. const css = config.css;
  330. if (css != undefined && css.length > 0) {
  331. tools.loadCssCode(css);
  332. }
  333. // 加载成绩参数
  334. const rankParam = config.rankParam;
  335. if (rankParam != undefined) {
  336. if (rankParam.tab2ItemsMark != undefined) {
  337. this.tab2ItemsMark = rankParam.tab2ItemsMark;
  338. }
  339. if (rankParam.dispArrStr != undefined && rankParam.dispArrStr.length > 0) {
  340. this.dispArrStr = rankParam.dispArrStr;
  341. // console.log("[loadConfig] dispArrStr:", rankParam.dispArrStr);
  342. }
  343. if (rankParam.tab2Items_team != undefined && rankParam.tab2Items_team.length > 0) {
  344. this.tab2Items_team = rankParam.tab2Items_team;
  345. // console.log("[loadConfig] tab2Items_team:", rankParam.tab2Items_team);
  346. }
  347. if (rankParam.tab2Items_person_region != undefined && rankParam.tab2Items_person_region.length > 0) {
  348. this.tab2Items_person_region = rankParam.tab2Items_person_region;
  349. }
  350. if (rankParam.rankTypeList_team != undefined && rankParam.rankTypeList_team.length > 0) {
  351. this.rankTypeList_team = rankParam.rankTypeList_team;
  352. }
  353. if (rankParam.rankTypeList_person_region != undefined && rankParam.rankTypeList_person_region.length > 0) {
  354. this.rankTypeList_person_region = rankParam.rankTypeList_person_region;
  355. }
  356. if (rankParam.rank1List != undefined && rankParam.rank1List.length > 0) {
  357. this.rank1List = rankParam.rank1List;
  358. }
  359. if (rankParam.rank2List != undefined && rankParam.rank2List.length > 0) {
  360. this.rank2List = rankParam.rank2List;
  361. }
  362. }
  363. // console.log("[loadConfig] rankParam:", rankParam);
  364. // 加载页面参数
  365. const param = config.param;
  366. if (param != undefined) {
  367. if (param.subTitle != undefined && param.subTitle.length > 0) {
  368. this.configParam.subTitle = param.subTitle;
  369. }
  370. if (param.labelRightAnswerNum != undefined && param.labelRightAnswerNum.length > 0) {
  371. this.configParam.labelRightAnswerNum = param.labelRightAnswerNum;
  372. }
  373. if (param.labelTicketName != undefined && param.labelTicketName.length > 0) {
  374. this.configParam.labelTicketName = param.labelTicketName;
  375. }
  376. if (param.labelAwardAddress != undefined && param.labelAwardAddress.length > 0) {
  377. this.configParam.labelAwardAddress = param.labelAwardAddress;
  378. }
  379. if (param.labelGoodsList != undefined && param.labelGoodsList.length > 0) {
  380. this.configParam.labelGoodsList = param.labelGoodsList;
  381. }
  382. if (param.tab1InitActIndex != undefined && param.tab1InitActIndex >= 0) {
  383. this.configParam.tab1InitActIndex = param.tab1InitActIndex;
  384. this.tab1Current = param.tab1InitActIndex;
  385. }
  386. if (param.tab2InitActIndex != undefined && param.tab2InitActIndex >= 0) {
  387. this.configParam.tab2InitActIndex = param.tab2InitActIndex;
  388. this.tab2Current = param.tab2InitActIndex;
  389. }
  390. }
  391. this.initTab();
  392. // console.log("[loadConfig] param:", this.configParam);
  393. this.pageReady = true;
  394. },
  395. // 获取倒计时
  396. getCountdown() {
  397. // console.log(this.endSecond)
  398. if (this.endSecond > 0) {
  399. const now = Date.now() / 1000;
  400. const dif = this.endSecond - now;
  401. // const dif = 3600*24 - 60;
  402. if (dif > 0) {
  403. this.countdown = '距结束 ' + tools.convertSecondsToDHM(dif);
  404. } else {
  405. this.countdown = "活动已结束";
  406. }
  407. // this.countdown = tools.convertSecondsToHMS(dif);
  408. } else {
  409. this.countdown = "距结束 --天--小时";
  410. }
  411. },
  412. // 格式化 距离
  413. fmtDistanct(val) {
  414. // return Math.round(val * 100 / 1000) / 100;
  415. if (val < 10000)
  416. return Math.round(val * 100 / 1000) / 100;
  417. else
  418. return Math.round(val / 1000);
  419. },
  420. fmtMcTime(timestamp) {
  421. return tools.fmtMcTime(timestamp);
  422. },
  423. // 获取活动时间
  424. getActtime() {
  425. this.acttime = tools.getActtime(this.beginSecond, this.endSecond);
  426. },
  427. getTeamName(teamType, teamIndex) {
  428. return teamName[teamType][teamIndex];
  429. },
  430. // 卡片对应线上赛多个活动查询
  431. matchRsDetailQuery() {
  432. uni.request({
  433. url: apiMatchRsDetailQuery,
  434. header: {
  435. "Content-Type": "application/x-www-form-urlencoded",
  436. "token": this.token,
  437. },
  438. method: "POST",
  439. data: {
  440. ecId: this.ecId
  441. },
  442. success: (res) => {
  443. // console.log("matchRsDetailQuery", res);
  444. if (checkResCode(res)) {
  445. const data = res.data.data;
  446. this.mcType = data.mcType;
  447. this.mcId = data.mcId;
  448. this.mcName = data.mcName;
  449. this.beginSecond = data.beginSecond;
  450. this.endSecond = data.endSecond;
  451. this.nickName = data.nickName;
  452. this.mcState = tools.checkMcState(this.beginSecond, this.endSecond);
  453. this.getCountdown();
  454. this.getActtime();
  455. this.mapListQuery();
  456. this.compStatisticQuery();
  457. // this.getCardRankDetailQuery();
  458. this.clear();
  459. this.interval = setInterval(this.getCountdown, 60000);
  460. }
  461. },
  462. fail: (err) => {
  463. console.log("matchRsDetailQuery err", err)
  464. },
  465. });
  466. },
  467. // 卡片对应地图列表详情查询
  468. mapListQuery() {
  469. uni.request({
  470. url: apiMapListQuery,
  471. header: {
  472. "Content-Type": "application/x-www-form-urlencoded",
  473. "token": this.token,
  474. },
  475. method: "POST",
  476. data: {
  477. mcId: this.mcId
  478. },
  479. success: (res) => {
  480. // console.log("mapListQuery", res);
  481. if (res.data.code == 0) {
  482. const data = res.data.data;
  483. this.mapList = data;
  484. let mapItems = {
  485. // selectValue: this.selectedMapId,
  486. selectValue: this.ocaId,
  487. data: []
  488. };
  489. for (var i = 0; i < data.length; i++) {
  490. if (mapItems.selectValue == 0 && i == 0) {
  491. mapItems.selectValue = data[i].ocaId;
  492. // this.selectedMapId = data[i].ocaId;
  493. this.ocaId = data[i].ocaId;
  494. }
  495. let map = {};
  496. map.text = "个人(" + data[i].mapName + ")";
  497. map.value = data[i].ocaId;
  498. mapItems.data.push(map);
  499. }
  500. this.tab1Items.push(mapItems);
  501. this.getCardRankDetailQuery();
  502. }
  503. },
  504. fail: (err) => {
  505. console.log("mapListQuery err", err);
  506. },
  507. });
  508. },
  509. // 赛事总成绩统计查询
  510. compStatisticQuery() {
  511. uni.request({
  512. url: apiCompStatisticQuery,
  513. header: {
  514. "Content-Type": "application/x-www-form-urlencoded",
  515. "token": this.token,
  516. },
  517. method: "POST",
  518. data: {
  519. mcId: this.mcId
  520. },
  521. success: (res) => {
  522. // console.log("compStatisticQuery", res);
  523. if (res.data.code == 0) {
  524. const data = res.data.data;
  525. this.all_totalDistance = data.totalDistance;
  526. this.all_totalRightAnswerNum = data.totalRightAnswerNum;
  527. this.all_totalAnswerNum = data.totalAnswerNum;
  528. this.all_totalCp = data.totalCp;
  529. this.all_totalSysPoint = data.totalSysPoint;
  530. }
  531. },
  532. fail: (err) => {
  533. console.log("compStatisticQuery err", err);
  534. },
  535. });
  536. },
  537. // 排名查询
  538. getCardRankDetailQuery() {
  539. uni.request({
  540. url: apiCardRankDetailQuery,
  541. header: {
  542. "Content-Type": "application/x-www-form-urlencoded",
  543. "token": this.token,
  544. },
  545. method: "POST",
  546. data: {
  547. mcIdListStr: this.mcId,
  548. mcType: this.mcType,
  549. ocaId: this.ocaId,
  550. dispArrStr: this.dispArrStr
  551. },
  552. success: (res) => {
  553. // console.log("getCardRankDetailQuery", res);
  554. const rankdata = res.data.data;
  555. this.rankList = rankdata;
  556. },
  557. fail: (err) => {
  558. console.log("getCardRankDetailQuery err", err);
  559. },
  560. });
  561. },
  562. // 是否允许重新分组(报名)
  563. isAllowMcSignUp() {
  564. uni.request({
  565. url: apiIsAllowMcSignUp,
  566. header: {
  567. "Content-Type": "application/x-www-form-urlencoded",
  568. "token": this.token,
  569. },
  570. method: "POST",
  571. data: {
  572. ecId: this.ecId
  573. },
  574. success: (res) => {
  575. // console.log("isAllowMcSignUp", res)
  576. if (res.data.code == 0) {
  577. const data = res.data.data;
  578. this.allowMcSignUp = data.allowSignUp;
  579. }
  580. },
  581. fail: (err) => {
  582. console.log("isAllowMcSignUp err", err)
  583. },
  584. });
  585. },
  586. // 用户是否已经报名卡片对应赛事查询
  587. getUserJoinCardQuery() {
  588. uni.request({
  589. url: apiUserJoinCardQuery,
  590. header: {
  591. "Content-Type": "application/x-www-form-urlencoded",
  592. "token": this.token
  593. },
  594. method: "POST",
  595. data: {
  596. ecId: this.ecId
  597. },
  598. success: (res) => {
  599. // console.log("getUserJoinCardQuery", res)
  600. const code = res.data.code;
  601. const data = res.data.data;
  602. if (code == 0) {
  603. this.isJoin = data.isJoin;
  604. if (this.isJoin) { // 已报名
  605. // this.btnStartGameText = "我要比赛";
  606. this.btnStartGameText = "选择场地";
  607. } else { // 未报名
  608. this.btnStartGameText = "我要报名";
  609. }
  610. }
  611. },
  612. fail: (err) => {
  613. console.log("getUserJoinCardQuery err", err)
  614. },
  615. });
  616. },
  617. onNoMoreRemindersClick() {
  618. this.$refs.mypopupMessage.popupClose();
  619. uni.setStorageSync(this.messageKey, true);
  620. },
  621. btnBack() {
  622. // window.history.back();
  623. const url = `action://to_home/`;
  624. tools.appAction(url);
  625. },
  626. btnStartGame() {
  627. if (this.isJoin) { // 已报名
  628. const url = "/pages/tpl/style3/rankOverview?" + this.queryString;
  629. tools.appAction(url, "uni.navigateTo");
  630. } else { // 未报名
  631. const url = "/pages/tpl/style3/signup?" + this.queryString;
  632. tools.appAction(url, "uni.navigateTo");
  633. }
  634. },
  635. btnInfo() {
  636. // console.log(this.$refs.mypopup);
  637. this.$refs.mypopup.popupOpen();
  638. },
  639. btnMessage() {
  640. // console.log(this.$refs.mypopup);
  641. this.$refs.mypopupMessage.popupOpen();
  642. },
  643. btnMyEgg() {
  644. const url = "/pages/achievement/index2?tabCurrent=2&" + this.queryString;
  645. tools.appAction(url, "uni.navigateTo");
  646. },
  647. btnExchg() {
  648. this.$refs.mypopupExchg.popupOpen();
  649. },
  650. btnGoodsList() {
  651. this.queryObj.from = "/pages/tpl/style3/rankList";
  652. this.queryString = tools.objectToQueryString(this.queryObj);
  653. const url = "/pages/exchange/style1/goodsList?" + this.queryString;
  654. tools.appAction(url, "uni.navigateTo");
  655. },
  656. onTab1Click(val) {
  657. console.log("onTab1Click: ", val);
  658. this.tab1Current = val;
  659. this.initTab();
  660. },
  661. onTab2Click(val) {
  662. // console.log("onTab2Click: ", val);
  663. this.tab2Current = val;
  664. },
  665. onSelectChange(val) {
  666. // console.log("onSelectChange: ", val);
  667. this.ocaId = val.value;
  668. this.getCardRankDetailQuery();
  669. uni.setStorageSync(this.mapKey, this.ocaId);
  670. },
  671. }
  672. }
  673. </script>
  674. <style scoped>
  675. .content {
  676. width: 100vw;
  677. height: 100vh;
  678. }
  679. .page-top {
  680. width: 100%;
  681. height: 170px;
  682. padding-top: 36px;
  683. justify-content: space-between;
  684. background-image: url('static/backgroud/top_bg_sddx.png');
  685. background-repeat: no-repeat;
  686. background-position: center;
  687. background-size: cover;
  688. }
  689. .topcontent {
  690. width: 90%;
  691. /* height: 90%; */
  692. /* margin-bottom: 20px; */
  693. }
  694. .topcontent2 {
  695. width: 90%;
  696. display: none;
  697. }
  698. .logo {
  699. width: 80px;
  700. height: 80px;
  701. margin-top: 10px;
  702. margin-bottom: 10px;
  703. /* background-image: url('/static/logo/sddx.png'); */
  704. background-repeat: no-repeat;
  705. background-position-x: center;
  706. background-position-y: center;
  707. background-size: contain;
  708. }
  709. .top-acttime {
  710. text-shadow: 3px 3px 0px #640008;
  711. font-family: YouSheBiaoTiHei;
  712. /* font-family: Arial, Helvetica, sans-serif; */
  713. font-weight: bold;
  714. color: #ffee0b;
  715. font-size: 20px;
  716. }
  717. .tcview {
  718. width: 90%;
  719. /* height: 100px; */
  720. }
  721. .tcbox {
  722. width: 121px;
  723. height: 63px;
  724. opacity: 1;
  725. border-radius: 6px;
  726. background: #9A300E;
  727. border: 1px solid #D3A254;
  728. }
  729. .tcbox-label {
  730. font-size: 12px;
  731. font-weight: 500;
  732. line-height: 23px;
  733. color: #f3d809;
  734. }
  735. .tcbox-value {
  736. font-size: 16px;
  737. font-weight: 500;
  738. line-height: 26px;
  739. color: #f3d809;
  740. }
  741. .today {
  742. margin-top: 8px;
  743. color: #751f00;
  744. font-size: 16px;
  745. /* font-family: "黑体", sans-serif; */
  746. font-weight: 3700;
  747. position: relative;
  748. z-index: 0;
  749. }
  750. .today::after {
  751. content: attr(data-content);
  752. -webkit-text-stroke: 3px #DCA452;
  753. /* font-family: "黑体", sans-serif; */
  754. position: absolute;
  755. left: 0;
  756. top: 0;
  757. z-index: -1;
  758. }
  759. .tcbar {
  760. display: none;
  761. width: 92%;
  762. padding: 6px 12px;
  763. background: #9a300e;
  764. border-radius: 6px;
  765. }
  766. .tcbar-text {
  767. font-family: Source Han Sans CN;
  768. font-weight: 500;
  769. color: #f3d809;
  770. font-size: 13px;
  771. }
  772. .mcName {
  773. font-size: 40rpx;
  774. font-weight: 550;
  775. }
  776. .topbtm {
  777. width: 100%;
  778. margin-bottom: 5px;
  779. justify-content: space-around;
  780. }
  781. .topbtm-name {
  782. padding: 3px 12px;
  783. background-color: #9A300E;
  784. border: 1px solid #D3A254;
  785. border-radius: 6px;
  786. text-align: center;
  787. font-weight: 500;
  788. color: #ffffff;
  789. font-size: 14px;
  790. }
  791. .topbtm-egg {
  792. width: 60px;
  793. padding: 3px 12px;
  794. background-color: #9A300E;
  795. border: 1px solid #D3A254;
  796. border-radius: 6px;
  797. text-align: center;
  798. color: #ffffff;
  799. font-size: 14px;
  800. }
  801. .topbtm-null {
  802. width: 60px;
  803. padding: 3px 12px;
  804. }
  805. .cal {
  806. width: 46rpx;
  807. height: 46rpx;
  808. margin-right: 20rpx;
  809. }
  810. .main {
  811. width: 100%;
  812. /* height: 70vh; */
  813. flex-grow: 1;
  814. justify-content: space-around;
  815. /* justify-content: space-between; */
  816. }
  817. .main-bar {
  818. display: none;
  819. width: 100%;
  820. height: 21px;
  821. background-color: #d8e8c6;
  822. font-size: 10px;
  823. font-weight: 500;
  824. color: #3d6706;
  825. }
  826. /* /deep/ .tab-active {
  827. background-color: #a43a07 !important;
  828. } */
  829. .main-tab {
  830. width: 90%;
  831. margin-top: 20rpx;
  832. }
  833. .tab-view {
  834. width: 100%;
  835. /* height: 69vh; */
  836. flex-grow: 1;
  837. }
  838. .btnBack {
  839. width: 70%;
  840. height: 80rpx;
  841. margin-bottom: 20rpx;
  842. /* font-weight: bold; */
  843. color: white;
  844. font-size: 32rpx;
  845. line-height: 80rpx;
  846. border-radius: 27px;
  847. background-color: #2e85ec;
  848. }
  849. /* .swiper-item-button {
  850. background-color: #ff870e !important;
  851. }
  852. .uni-swiper-dot-active {
  853. background: #ff870e !important;
  854. } */
  855. </style>