rankList.vue 28 KB

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