rankList.vue 27 KB

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