rankList.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. <!--
  2. [报名] 样式3 - 排名列表
  3. http://localhost:5173/card/#/pages/bm/style3/rankList
  4. https://oss-mbh5.colormaprun.com/card/#/pages/bm/style3/rankList
  5. -->
  6. <template>
  7. <view class="body">
  8. <view v-if="pageReady" class="content uni-column">
  9. <view class="uni-column" :class="cssTop">
  10. <my-topbar :mcName="mcName" :class="cssTopbarColor" :showMessage="popupMessageList.length > 0"
  11. @btnBackClick="btnBack" @btnInfoClick="btnInfo" @btnMessageClick="btnMessage"></my-topbar>
  12. <!-- <view class="topbar uni-row" :class="cssTopbarColor">
  13. <uni-icons type="left" class="topbar-back" @click="btnBack"></uni-icons>
  14. <text class="mcName">{{mcName}}</text>
  15. <text class="topbar-rule" @click="btnInfo">规则</text>
  16. </view> -->
  17. <view class="topbtm uni-row">
  18. <!-- <view class="topbtm-null"></view> -->
  19. <view class="topbtm-egg" @click="btnMyEgg">蛋叔券</view>
  20. <text class="topbtm-name">{{nickName}}</text>
  21. <view class="topbtm-egg" @click="btnExchg">兑换地址</view>
  22. </view>
  23. </view>
  24. <view class="main uni-column">
  25. <view class="main-bar uni-row uni-jcse">
  26. <text>总里程:{{fmtDistanct(all_totalDistance)}}km</text>
  27. <text>总打点数:{{all_totalCp}}个</text>
  28. <text>总百味豆数:{{all_totalSysPoint}}个</text>
  29. </view>
  30. <uni-segmented-control class="main-tab" :current="tabCurrent" :values="tabItems"
  31. @clickItem="onClickTabItem" styleType="button" :activeColor="tabActiveColor"></uni-segmented-control>
  32. <view class="tab-view uni-column">
  33. <!-- 里程 -->
  34. <my-ranklist v-show="tabCurrent === 0" :rankRs="rankList.totalDistanceRs" rank-type="totalDistance"></my-ranklist>
  35. <!-- 打点数 -->
  36. <my-ranklist v-show="tabCurrent === 1" :rankRs="rankList.totalCpRs" rank-type="totalCp"></my-ranklist>
  37. <!-- 百味豆 -->
  38. <my-ranklist v-show="tabCurrent === 2" :rankRs="rankList.totalSysPointRs" rank-type="totalSysPoint"></my-ranklist>
  39. <!-- 配速 -->
  40. <my-ranklist v-show="tabCurrent === 3" :rankRs="rankList.fastPaceRs" rank-type="fastPace"></my-ranklist>
  41. </view>
  42. <button class="btnBack" @click="btnStartGame">{{btnStartGameText}}</button>
  43. <!-- <button class="btnBack" @click="btnBack">返回</button> -->
  44. </view>
  45. <my-popup ref="mypopup" :config="popupRuleConfig" :dataList="popupDataList" :acttime="acttime"></my-popup>
  46. <my-popup ref="mypopupExchg" :config="popupExchgConfig" :dataList="popupExchgList"></my-popup>
  47. <my-popup ref="mypopupMessage" :config="popupMessageConfig" :dataList="popupMessageList" @noMoreRemindersClick="onNoMoreRemindersClick"></my-popup>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import tools from '/common/tools';
  53. import { teamName, defaultPopUpDataList, defaultPopUpDataList2 } from '/common/define';
  54. import {
  55. token,
  56. apiMatchRsDetailQuery,
  57. apiCardRankDetailQuery,
  58. apiCardConfigQuery,
  59. apiUserCurrentRankNumQuery,
  60. apiCompStatisticQuery,
  61. apiIsAllowMcSignUp,
  62. apiUserJoinCardQuery,
  63. apiUnReadMessageQuery,
  64. apiReadMessage,
  65. checkResCode
  66. } from '/common/api';
  67. export default {
  68. data() {
  69. return {
  70. pageReady: false,
  71. pageName: "rankList",
  72. firstEnterKey: 'firstEnter-bm-style3',
  73. rankKey: "rank-bm-style3",
  74. messageKey: "message-bm-style3",
  75. queryObj: {},
  76. queryString: "",
  77. token: "",
  78. ovtype: "",
  79. ecId: 0, // 卡片id
  80. mcId: 0, // 赛事id
  81. mcType: 0, // 赛事类型 1 普通活动 2 线下赛 3 线上赛
  82. mcName: "", // 赛事名称
  83. acttime: "", // 活动时间
  84. beginSecond: null, // 活动或赛事开始时间戳,单位秒
  85. endSecond: null, // 活动或赛事结束时间戳,单位秒
  86. ocaId: 0, // 关联id,带入到App活动详情页面
  87. nickName: "", // 昵称
  88. totalNum: null, // 总场次
  89. totalDistanct: null, // 总距离,单位米
  90. totalDistanctRankNum: null, // 总距离排名
  91. totalCp: null, // 总打点数
  92. totalCpRankNum: null, // 总打点数排名
  93. totalSysPoint: null, // 总百味豆
  94. totalSysPointRankNum: null, // 总百味豆排名
  95. fastPace: null, // 个人最快配速
  96. fastPaceRankNum: null, // 个人最快配速排名
  97. // ocaRs: [], // 卡片对应活动集合
  98. isJoin: null, // 是否报名
  99. btnStartGameText: "",
  100. all_totalDistance: 0, // 赛事所有人累计里程,单位米
  101. all_totalRightAnswerNum: 0, // 赛事所有人正确答题数(校园文化输出)
  102. all_totalAnswerNum: 0, // 赛事所有人答题数(校园文化输出)
  103. all_totalCp: 0, // 赛事中所有人打点数
  104. all_totalSysPoint: 0, // 赛事中所有人百味豆
  105. mcState: 0 , // 赛事/活动状态 0: 未开始 1: 进行中 2: 已结束
  106. allowMcSignUp: false, // 是否允许重新分组
  107. countdown: "", // 倒计时
  108. rankList: { // 排名列表
  109. totalDistanceRs: [],
  110. totalCpRs: [],
  111. totalSysPointRs: [],
  112. fastPaceRs: []
  113. },
  114. interval: null,
  115. teamType: 0, // 队伍类型
  116. dispArrStr: "totalDistance,totalCp,totalSysPoint,fastPace", // 要显示的集合范围
  117. tabItems: ["里程", "打点数", "百味豆", "配速"],
  118. tabCurrent: 0,
  119. tabActiveColor: "#81cd00",
  120. cssTop: "",
  121. cssTopbarColor: "",
  122. popupRuleConfig: {}, // 规则弹窗配置
  123. popupExchgConfig: {}, // 兑换地址弹窗配置
  124. popupMessageConfig: {}, // 通知弹窗配置
  125. popupDataList: [],
  126. popupExchgList: [],
  127. popupMessageList: [],
  128. /* popupMessageList: [
  129. {
  130. type: 6, // 6: 通知
  131. data: {
  132. mqType: 3,
  133. title: "赛事续期通知",
  134. message: `因为感受到了各位小伙伴的热情,结合即将来临的国庆假期,当然,小飞龙强力出击~“挟持”蛋叔继续赞助鸡蛋………
  135. 1. 现决定,将本次小飞龙定向赛延期至<text style="color:red">10月8日</text>,希望各位在漫步秋日的同时,放松心情,好好享受定向运动的奇妙历程。
  136. 2. 最后的领蛋截止日,顺延至<text style="color:red">10月20日</text>~
  137. 最后总结一句:
  138. 蛋叔!我们都爱你!
  139. everybody,加油!`
  140. }
  141. },
  142. {
  143. type: 6, // 6: 通知
  144. data: {
  145. mqType: 2,
  146. title: "赛事续期通知",
  147. message: "/static/common/jiangli.png"
  148. }
  149. }
  150. ], */
  151. // mqIdListStr: "", // 已读消息id列表 逗号分隔
  152. }
  153. },
  154. computed: {},
  155. onLoad(query) { // 类型非必填,可自动推导
  156. // console.log(query);
  157. this.queryObj = query;
  158. this.queryString = tools.objectToQueryString(this.queryObj);
  159. // console.log(queryString);
  160. this.token = query["token"] ?? token;
  161. this.ecId = query["id"] ?? 0;
  162. this.ovtype = query["ovtype"] ?? "";
  163. this.firstEnterKey += "-" + this.ecId;
  164. console.log("firstEnterKey:", this.firstEnterKey);
  165. this.rankKey += "-" + this.ecId;
  166. console.log("rankKey:", this.rankKey);
  167. this.messageKey += "-" + this.ecId;
  168. console.log("messageKey:", this.messageKey);
  169. tools.removeCssCode();
  170. this.getCardConfigQuery();
  171. this.dealOvtype();
  172. },
  173. // 页面初次渲染完成,此时组件已挂载完成,DOM 树($el)已可用
  174. onReady() {
  175. // this.dealFirstEnter();
  176. // this.$refs.mypopupMessage.popupOpen();
  177. },
  178. onShow() {
  179. this.getUserJoinCardQuery();
  180. },
  181. onUnload() {
  182. this.clear();
  183. },
  184. methods: {
  185. dealOvtype() {
  186. if (this.ovtype == "totalDistance") {
  187. this.tabCurrent = 0;
  188. } else if (this.ovtype == "totalCp") {
  189. this.tabCurrent = 1;
  190. } else if (this.ovtype == "totalSysPoint") {
  191. this.tabCurrent = 2;
  192. } else if (this.ovtype == "fastPace") {
  193. this.tabCurrent = 3;
  194. }
  195. console.log(`dealOvtype: ${this.ovtype} tabCurrent: ${this.tabCurrent}`);
  196. },
  197. dealNotice(rank) {
  198. // console.log('[dealFirstEnter]');
  199. let that = this;
  200. uni.getStorage({
  201. key: that.rankKey,
  202. success: (res) => {
  203. console.log('[getStorage]', that.rankKey, res.data);
  204. const oldRank = res.data;
  205. if (oldRank != rank) {
  206. // that.notice = true;
  207. that.setRankValue(rank);
  208. }
  209. },
  210. fail: (e) => {
  211. console.log('[getStorage] fail', that.rankKey, e);
  212. // that.notice = false;
  213. that.setRankValue(rank);
  214. },
  215. })
  216. },
  217. setRankValue(data) {
  218. let that = this;
  219. uni.setStorage({
  220. key: that.rankKey,
  221. data: data,
  222. success: () => {
  223. console.log('[setStorage] success', that.rankKey, data);
  224. },
  225. fail: (e) => {
  226. console.log('[setStorage] fail', that.rankKey, e);
  227. },
  228. })
  229. },
  230. dealFirstEnter() {
  231. // console.log('[dealFirstEnter]');
  232. let that = this;
  233. uni.getStorage({
  234. key: that.firstEnterKey,
  235. success: (res) => {
  236. console.log('[getStorage]', that.firstEnterKey, res.data);
  237. },
  238. fail: (e) => {
  239. console.log('[getStorage] fail', that.firstEnterKey, e);
  240. that.btnInfo();
  241. that.setFirstEnterValue(true);
  242. },
  243. })
  244. },
  245. setFirstEnterValue(data) {
  246. let that = this;
  247. uni.setStorage({
  248. key: that.firstEnterKey,
  249. data: data,
  250. success: () => {
  251. console.log('[setStorage] success', that.firstEnterKey, data);
  252. },
  253. fail: (e) => {
  254. console.log('[setStorage] fail', that.firstEnterKey, e);
  255. },
  256. })
  257. },
  258. clear() {
  259. if (this.interval != null) {
  260. clearInterval(this.interval);
  261. this.interval = null;
  262. }
  263. },
  264. loadConfig(config) {
  265. // console.log("config", config);
  266. // 加载CSS样式
  267. const css = config.css;
  268. if (css != undefined && css.length > 0) {
  269. tools.loadCssCode(css);
  270. if (css.indexOf(".top{") >= 0) {
  271. this.cssTop = "top";
  272. }
  273. if (css.indexOf(".topbar-color{") >= 0) {
  274. this.cssTopbarColor = "topbar-color";
  275. }
  276. }
  277. if (this.cssTop == "") {
  278. this.cssTop = "top-default";
  279. }
  280. if (this.cssTopbarColor == "") {
  281. this.cssTopbarColor = "topbar-color-default";
  282. }
  283. console.log("[loadConfig] cssTop:", this.cssTop);
  284. console.log("[loadConfig] cssTopbarColor:", this.cssTopbarColor);
  285. const tabActiveColor = config.tabActiveColor;
  286. if (tabActiveColor != undefined && tabActiveColor.length > 0) {
  287. this.tabActiveColor = tabActiveColor;
  288. }
  289. // 加载规则弹窗配置
  290. const popupRuleConfig = config.popupRuleConfig;
  291. if (popupRuleConfig != undefined) {
  292. this.popupRuleConfig = popupRuleConfig;
  293. }
  294. // console.log("[loadConfig] popupRuleConfig:", this.popupRuleConfig);
  295. // 加载兑换地址弹窗配置
  296. const popupExchgConfig = config.popupExchgConfig;
  297. if (popupExchgConfig != undefined) {
  298. this.popupExchgConfig = popupExchgConfig;
  299. }
  300. // console.log("[loadConfig] popupExchgConfig:", this.popupExchgConfig);
  301. // 加载通知弹窗配置
  302. const popupMessageConfig = config.popupMessageConfig;
  303. if (popupMessageConfig != undefined) {
  304. this.popupMessageConfig = popupMessageConfig;
  305. }
  306. // console.log("[loadConfig] popupMessageConfig:", this.popupMessageConfig);
  307. // 加载弹窗数据
  308. const popupDataList = config.popupDataList;
  309. // console.log("[loadConfig] popupDataList:", popupDataList);
  310. if (popupDataList != undefined && popupDataList.length > 0) {
  311. for (var i = 0; i < popupDataList.length; i++) {
  312. // console.log("[loadConfig] popupDataList", i, popupDataList[i]);
  313. if (popupDataList[i] == 'default') {
  314. for (var j = 0; j < defaultPopUpDataList.length; j++) {
  315. this.popupDataList.push(defaultPopUpDataList[j]);
  316. }
  317. } else if (popupDataList[i] == 'default2') {
  318. for (var j = 0; j < defaultPopUpDataList2.length; j++) {
  319. this.popupDataList.push(defaultPopUpDataList2[j]);
  320. }
  321. } else {
  322. this.popupDataList.push(popupDataList[i]);
  323. }
  324. }
  325. } else {
  326. this.popupDataList = defaultPopUpDataList;
  327. console.log("[loadConfig] popupDataList 加载默认列表");
  328. }
  329. // console.log("[loadConfig] popupDataList:", this.popupDataList);
  330. // 加载弹窗(兑换地点)数据
  331. const popupExchgList = config.popupExchgList;
  332. if (popupExchgList != undefined && popupExchgList.length > 0) {
  333. for (var i = 0; i < popupExchgList.length; i++) {
  334. // console.log("[loadConfig] popupExchgList", i, popupExchgList[i]);
  335. this.popupExchgList.push(popupExchgList[i]);
  336. }
  337. }
  338. // console.log("[loadConfig] popupExchgList:", this.popupExchgList);
  339. this.pageReady = true;
  340. },
  341. // 获取倒计时
  342. getCountdown() {
  343. // console.log(this.endSecond)
  344. if (this.endSecond > 0) {
  345. const now = Date.now() / 1000;
  346. const dif = this.endSecond - now;
  347. // const dif = 3600*24 - 60;
  348. if (dif > 0) {
  349. this.countdown = '距结束 ' + tools.convertSecondsToDHM(dif);
  350. } else {
  351. this.countdown = "活动已结束";
  352. }
  353. // this.countdown = tools.convertSecondsToHMS(dif);
  354. } else {
  355. this.countdown = "距结束 --天--小时";
  356. }
  357. },
  358. // 格式化 距离
  359. fmtDistanct(val) {
  360. return Math.round(val * 100 / 1000) / 100;
  361. /* if (val < 10000)
  362. return Math.round(val * 10 / 1000) / 10;
  363. else
  364. return Math.round(val / 1000); */
  365. },
  366. fmtMcTime(timestamp) {
  367. return tools.fmtMcTime(timestamp);
  368. },
  369. // 获取活动时间
  370. getActtime() {
  371. this.acttime = tools.getActtime(this.beginSecond, this.endSecond);
  372. },
  373. getTeamName(teamType, teamIndex) {
  374. return teamName[teamType][teamIndex];
  375. },
  376. getCardConfigQuery() {
  377. uni.request({
  378. url: apiCardConfigQuery,
  379. header: {
  380. "Content-Type": "application/x-www-form-urlencoded",
  381. "token": this.token,
  382. },
  383. method: "POST",
  384. data: {
  385. ecId: this.ecId,
  386. pageName: this.pageName
  387. },
  388. success: (res) => {
  389. // console.log("getCardConfigQuery", res)
  390. const data = res.data.data;
  391. // console.log("configJson", data.configJson);
  392. const config = data.configJson != "" ? JSON.parse(data.configJson) : "";
  393. // console.log("configJson", data.configJson);
  394. /* const config = {
  395. "css": `
  396. .top{
  397. width: 100%;
  398. height: 170px;
  399. padding-top: 36px;
  400. justify-content: space-between;
  401. background-image: url('static/backgroud/top_bg_guoqing.png');
  402. background-repeat: no-repeat;
  403. background-position-y: 20%;
  404. background-size: cover;
  405. }
  406. .topbar-color{
  407. color: #ffffff;
  408. }
  409. .topbtm-name{
  410. background-color: #e68328 !important;
  411. color: #ffffff !important;
  412. opacity: 0.9;
  413. }
  414. .topbtm-egg{
  415. background-color: #e68328 !important;
  416. color: #ffffff !important;
  417. opacity: 0.9;
  418. }
  419. .btnBack{
  420. background-color: #ff0000 !important;
  421. }
  422. .main-bar{
  423. background-color: #ffd1d1 !important;
  424. color: #C40000 !important;
  425. }
  426. .swiper-item-button {
  427. background-color: #C40000 !important;
  428. }
  429. .uni-swiper-dot-active {
  430. background: #C40000 !important;
  431. }
  432. `,
  433. "tabActiveColor": "#ff0000",
  434. "popupDataList": [
  435. {
  436. "type": 2,
  437. "data": {
  438. "title": "基本图例",
  439. "img": "/static/common/jbtl.png"
  440. }
  441. }, {
  442. "type": 2,
  443. "data": {
  444. "title": "基本标识",
  445. "img": "/static/common/jbbs2.png"
  446. }
  447. },
  448. {
  449. "type": 7,
  450. "data": {
  451. "title": "活动规则",
  452. "content": "<li>赛期内随时参赛、不限完赛次数、起点任选、实时排名 <li>起点-各途经点-结束点完整打卡为1次有效完赛 <li>赛事如有疑问,请咨询微信客服",
  453. "imageList": [
  454. {
  455. "src": "/static/common/qrcode_wxkf.png",
  456. "width": "100px",
  457. "height": "100px"
  458. }
  459. ]
  460. }
  461. },
  462. {
  463. "type": 7,
  464. "data": {
  465. "title": "活动奖励",
  466. "content": "<li>途经点打卡1次,获1个百味豆<br><li>每次正确答题,再获1个百味豆<br><li>20个百味豆兑换1个鸡蛋<br><li>上不封顶!随时兑换!<br><text style='font-size:12px;color:#999999;'>(限本次活动百味豆,兑换以“蛋叔券”为准)</text><br><li>健身又能“薅羊毛”~",
  467. "imageList": [
  468. {
  469. "src": "/static/common/jidanquan.png",
  470. "width": "80px",
  471. "height": "80px"
  472. }
  473. ]
  474. }
  475. },
  476. {
  477. "type": 5,
  478. "data": {
  479. "title": "兑换地点",
  480. "img": "/static/common/wslgwcs.png",
  481. "point": {
  482. "longitude": 117.022194,
  483. "latitude": 36.661612,
  484. "name": "万盛隆购物超市"
  485. }
  486. }
  487. }
  488. ],
  489. "popupExchgList": [
  490. {
  491. "type": 5,
  492. "data": {
  493. "title": "兑换地点",
  494. "img": "/static/common/wslgwcs.png",
  495. "point": {
  496. "longitude": 117.022194,
  497. "latitude": 36.661612,
  498. "name": "万盛隆购物超市"
  499. }
  500. }
  501. }
  502. ]
  503. }; */
  504. this.loadConfig(config);
  505. this.getUnReadMessageQuery();
  506. this.matchRsDetailQuery();
  507. setTimeout(this.dealFirstEnter, 500);
  508. },
  509. fail: (err) => {
  510. console.log("getCardConfigQuery err", err)
  511. },
  512. });
  513. },
  514. // 卡片对应活动或赛事详情查询
  515. // getCardDetailQuery() {
  516. // uni.request({
  517. // url: apiCardDetailQuery,
  518. // header: {
  519. // "Content-Type": "application/x-www-form-urlencoded",
  520. // "token": this.token,
  521. // },
  522. // method: "POST",
  523. // data: {
  524. // ecId: this.ecId
  525. // },
  526. // success: (res) => {
  527. // // console.log("getCardDetailQuery", res)
  528. // const data = res.data.data;
  529. // this.mcType = data.mcType;
  530. // this.mcId = data.mcId;
  531. // this.mcName = data.mcName;
  532. // this.beginSecond = data.beginSecond;
  533. // this.endSecond = data.endSecond;
  534. // this.coiName = data.coiName;
  535. // this.teamNum = data.teamNum;
  536. // this.mcState = tools.checkMcState(this.beginSecond, this.endSecond);
  537. // this.getCountdown();
  538. // this.getActtime();
  539. // this.getCardRankDetailQuery();
  540. // this.clear();
  541. // this.interval = setInterval(this.getCountdown, 60000);
  542. // },
  543. // fail: (err) => {
  544. // console.log("getCardDetailQuery err", err)
  545. // },
  546. // });
  547. // },
  548. // 卡片对应线上赛多个活动查询
  549. matchRsDetailQuery() {
  550. uni.request({
  551. url: apiMatchRsDetailQuery,
  552. header: {
  553. "Content-Type": "application/x-www-form-urlencoded",
  554. "token": this.token,
  555. },
  556. method: "POST",
  557. data: {
  558. ecId: this.ecId
  559. },
  560. success: (res) => {
  561. // console.log("matchRsDetailQuery", res);
  562. if (checkResCode(res)) {
  563. const data = res.data.data;
  564. this.mcType = data.mcType;
  565. this.mcId = data.mcId;
  566. this.mcName = data.mcName;
  567. this.beginSecond = data.beginSecond;
  568. this.endSecond = data.endSecond;
  569. this.nickName = data.nickName;
  570. this.totalNum = data.totalNum;
  571. this.totalDistanct = data.totalDistanct;
  572. this.totalDistanctRankNum = data.totalDistanctRankNum;
  573. this.totalCp = data.totalCp;
  574. this.totalCpRankNum = data.totalCpRankNum;
  575. this.totalSysPoint = data.totalSysPoint;
  576. this.totalSysPointRankNum = data.totalSysPointRankNum;
  577. this.fastPace = data.fastPace;
  578. this.fastPaceRankNum = data.fastPaceRankNum;
  579. // this.ocaRs = data.ocaRs;
  580. this.mcState = tools.checkMcState(this.beginSecond, this.endSecond);
  581. this.getCountdown();
  582. this.getActtime();
  583. this.compStatisticQuery();
  584. this.getCardRankDetailQuery();
  585. this.clear();
  586. this.interval = setInterval(this.getCountdown, 60000);
  587. }
  588. },
  589. fail: (err) => {
  590. console.log("matchRsDetailQuery err", err)
  591. },
  592. });
  593. },
  594. // 排名查询
  595. getCardRankDetailQuery() {
  596. uni.request({
  597. url: apiCardRankDetailQuery,
  598. header: {
  599. "Content-Type": "application/x-www-form-urlencoded",
  600. "token": this.token,
  601. },
  602. method: "POST",
  603. data: {
  604. mcIdListStr: this.mcId,
  605. mcType: this.mcType,
  606. dispArrStr: this.dispArrStr
  607. },
  608. success: (res) => {
  609. // console.log("getCardRankDetailQuery", res);
  610. const rankdata = res.data.data;
  611. this.rankList.totalDistanceRs = rankdata.totalDistanceRs;
  612. this.rankList.totalCpRs = rankdata.totalCpRs;
  613. this.rankList.totalSysPointRs = rankdata.totalSysPointRs;
  614. this.rankList.fastPaceRs = rankdata.fastPaceRs;
  615. },
  616. fail: (err) => {
  617. console.log("getCardRankDetailQuery err", err);
  618. },
  619. });
  620. },
  621. // 赛事总成绩统计查询
  622. compStatisticQuery() {
  623. uni.request({
  624. url: apiCompStatisticQuery,
  625. header: {
  626. "Content-Type": "application/x-www-form-urlencoded",
  627. "token": this.token,
  628. },
  629. method: "POST",
  630. data: {
  631. mcId: this.mcId
  632. },
  633. success: (res) => {
  634. // console.log("compStatisticQuery", res);
  635. if (res.data.code == 0) {
  636. const data = res.data.data;
  637. this.all_totalDistance = data.totalDistance;
  638. this.all_totalRightAnswerNum = data.totalRightAnswerNum;
  639. this.all_totalAnswerNum = data.totalAnswerNum;
  640. this.all_totalCp = data.totalCp;
  641. this.all_totalSysPoint = data.totalSysPoint;
  642. }
  643. },
  644. fail: (err) => {
  645. console.log("compStatisticQuery err", err);
  646. },
  647. });
  648. },
  649. // 卡片用户当前排名查询
  650. // getUserCurrentRankNumQuery() {
  651. // uni.request({
  652. // url: apiUserCurrentRankNumQuery,
  653. // header: {
  654. // "Content-Type": "application/x-www-form-urlencoded",
  655. // "token": this.token,
  656. // },
  657. // method: "POST",
  658. // data: {
  659. // ecId: this.ecId
  660. // },
  661. // success: (res) => {
  662. // // console.log("getUserCurrentRankNumQuery", res)
  663. // if (res.data.code == 0) {
  664. // const data = res.data.data;
  665. // const rankNum = data.rankNum;
  666. // this.dealNotice(rankNum);
  667. // }
  668. // },
  669. // fail: (err) => {
  670. // console.log("getUserCurrentRankNumQuery err", err)
  671. // },
  672. // });
  673. // },
  674. // 是否允许重新分组(报名)
  675. isAllowMcSignUp() {
  676. uni.request({
  677. url: apiIsAllowMcSignUp,
  678. header: {
  679. "Content-Type": "application/x-www-form-urlencoded",
  680. "token": this.token,
  681. },
  682. method: "POST",
  683. data: {
  684. ecId: this.ecId
  685. },
  686. success: (res) => {
  687. // console.log("isAllowMcSignUp", res)
  688. if (res.data.code == 0) {
  689. const data = res.data.data;
  690. this.allowMcSignUp = data.allowSignUp;
  691. }
  692. },
  693. fail: (err) => {
  694. console.log("isAllowMcSignUp err", err)
  695. },
  696. });
  697. },
  698. // 用户是否已经报名卡片对应赛事查询
  699. getUserJoinCardQuery() {
  700. uni.request({
  701. url: apiUserJoinCardQuery,
  702. header: {
  703. "Content-Type": "application/x-www-form-urlencoded",
  704. "token": this.token
  705. },
  706. method: "POST",
  707. data: {
  708. ecId: this.ecId
  709. },
  710. success: (res) => {
  711. // console.log("getUserJoinCardQuery", res)
  712. const code = res.data.code;
  713. const data = res.data.data;
  714. if (code == 0) {
  715. this.isJoin = data.isJoin;
  716. if (this.isJoin) { // 已报名
  717. // this.btnStartGameText = "我要比赛";
  718. this.btnStartGameText = "选择场地";
  719. } else { // 未报名
  720. this.btnStartGameText = "我要报名";
  721. }
  722. }
  723. },
  724. fail: (err) => {
  725. console.log("getUserJoinCardQuery err", err)
  726. },
  727. });
  728. },
  729. // 未读消息列表查询
  730. getUnReadMessageQuery() {
  731. uni.request({
  732. url: apiUnReadMessageQuery,
  733. header: {
  734. "Content-Type": "application/x-www-form-urlencoded",
  735. "token": this.token,
  736. },
  737. method: "POST",
  738. data: {
  739. relationType: 2, // 类型 1 成就 2 卡片
  740. relationId: this.ecId
  741. },
  742. success: (res) => {
  743. // console.log("getUnReadMessageQuery", res);
  744. if (checkResCode(res)) {
  745. const unReadMessageRs = res.data.data;
  746. this.popupMessageList.length = 0;
  747. this.mqIdListStr = "";
  748. for (var i = 0; i < unReadMessageRs.length; i++) {
  749. let popupData = {
  750. type: 6, // 6: 通知
  751. data: {}
  752. };
  753. this.messageKey += "-" + unReadMessageRs[i].mqId;
  754. popupData.data.mqType = unReadMessageRs[i].mqType;
  755. popupData.data.title = unReadMessageRs[i].mqTitle;
  756. popupData.data.message = unReadMessageRs[i].mqMessage;
  757. this.popupMessageList.push(popupData);
  758. // this.mqIdListStr += this.unReadMessageRs[i].mqId;
  759. // if (i < this.unReadMessageRs.length - 1) {
  760. // this.mqIdListStr += ",";
  761. // }
  762. }
  763. if (this.popupMessageList.length > 0) {
  764. const messageValue = uni.getStorageSync(this.messageKey);
  765. console.log("messageValue:", messageValue);
  766. if (!messageValue) {
  767. this.$refs.mypopupMessage.popupOpen();
  768. // uni.setStorageSync(this.messageKey, true);
  769. }
  770. }
  771. }
  772. },
  773. fail: (err) => {
  774. console.log("getUnReadMessageQuery err", err);
  775. },
  776. });
  777. },
  778. onNoMoreRemindersClick() {
  779. this.$refs.mypopupMessage.popupClose();
  780. uni.setStorageSync(this.messageKey, true);
  781. },
  782. // 标记消息已读
  783. readMessage() {
  784. uni.request({
  785. url: apiReadMessage,
  786. header: {
  787. "Content-Type": "application/x-www-form-urlencoded",
  788. "token": this.token,
  789. },
  790. method: "POST",
  791. data: {
  792. "mqIdListStr": this.mqIdListStr
  793. },
  794. success: (res) => {
  795. // console.log("readMessage", res);
  796. },
  797. fail: (err) => {
  798. console.log("readMessage err", err);
  799. },
  800. });
  801. },
  802. btnBack() {
  803. // window.history.back();
  804. /* uni.navigateTo({
  805. url: "/pages/bm/style3/rankOverview?" + this.queryString
  806. }); */
  807. const url = `action://to_home/`;
  808. tools.appAction(url);
  809. },
  810. btnStartGame() {
  811. if (this.isJoin) { // 已报名
  812. const url = "/pages/bm/style3/rankOverview?" + this.queryString;
  813. tools.appAction(url, "uni.navigateTo");
  814. } else { // 未报名
  815. const url = "/pages/bm/style3/signup?" + this.queryString;
  816. tools.appAction(url, "uni.navigateTo");
  817. }
  818. },
  819. btnInfo() {
  820. // console.log(this.$refs.mypopup);
  821. this.$refs.mypopup.popupOpen();
  822. },
  823. btnMessage() {
  824. // console.log(this.$refs.mypopup);
  825. this.$refs.mypopupMessage.popupOpen();
  826. },
  827. btnMyEgg() {
  828. // uni.navigateTo({
  829. // url: "/pages/achievement/index2?tabCurrent=2&" + this.queryString
  830. // });
  831. const url = "/pages/achievement/index2?tabCurrent=2&" + this.queryString;
  832. tools.appAction(url, "uni.navigateTo");
  833. },
  834. btnExchg() {
  835. this.$refs.mypopupExchg.popupOpen();
  836. },
  837. onClickTabItem(e) {
  838. if (this.tabCurrent != e.currentIndex) {
  839. this.tabCurrent = e.currentIndex;
  840. }
  841. }
  842. }
  843. }
  844. </script>
  845. <style scoped>
  846. .content {
  847. width: 100vw;
  848. height: 100vh;
  849. }
  850. .top-default {
  851. width: 100%;
  852. height: 170px;
  853. padding-top: 36px;
  854. justify-content: space-between;
  855. background-image: url("/static/backgroud/top_bg2.png");
  856. background-repeat: no-repeat;
  857. background-position: center;
  858. background-size: cover;
  859. }
  860. .topbar-color-default {
  861. color: #5b9100;
  862. }
  863. .topbtm {
  864. width: 100%;
  865. margin-bottom: 5px;
  866. justify-content: space-around;
  867. }
  868. .topbtm-name {
  869. max-width: 300rpx;
  870. padding: 3px 12px;
  871. background-color: #9fda39;
  872. border-radius: 5px;
  873. text-align: center;
  874. font-weight: 500;
  875. color: #497400;
  876. font-size: 14px;
  877. white-space: nowrap;
  878. overflow: hidden;
  879. text-overflow: ellipsis;
  880. }
  881. .topbtm-egg {
  882. width: 60px;
  883. padding: 3px 12px;
  884. background-color: #9fda39;
  885. border-radius: 50px;
  886. text-align: center;
  887. color: #497400;
  888. font-size: 14px;
  889. }
  890. .topbtm-null {
  891. width: 60px;
  892. padding: 3px 12px;
  893. }
  894. .cal {
  895. width: 46rpx;
  896. height: 46rpx;
  897. margin-right: 20rpx;
  898. }
  899. .main {
  900. width: 100%;
  901. /* height: 70vh; */
  902. flex-grow: 1;
  903. justify-content: space-around;
  904. /* justify-content: space-between; */
  905. }
  906. .main-bar {
  907. width: 100%;
  908. height: 21px;
  909. background-color: #d8e8c6;
  910. font-size: 10px;
  911. font-weight: 500;
  912. color: #3d6706;
  913. }
  914. .main-tab {
  915. width: 90%;
  916. margin-top: 20rpx;
  917. }
  918. .tab-view {
  919. width: 100%;
  920. /* height: 69vh; */
  921. flex-grow: 1;
  922. }
  923. .btnBack {
  924. width: 70%;
  925. /* height: 6vh; */
  926. height: 80rpx;
  927. /* margin-bottom: 1vh; */
  928. margin-bottom: 20rpx;
  929. /* font-weight: bold; */
  930. color: white;
  931. font-size: 32rpx;
  932. line-height: 80rpx;
  933. border-radius: 27px;
  934. background-color: #81cd00;
  935. }
  936. </style>