rankList.vue 26 KB

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